OSDN Git Service

V8 can now use WebCore/bridge/jni/JNIBridge.h
authorSteve Block <steveblock@google.com>
Thu, 21 Jan 2010 19:08:14 +0000 (19:08 +0000)
committerSteve Block <steveblock@google.com>
Wed, 27 Jan 2010 16:06:32 +0000 (16:06 +0000)
JNIBridge.h is now used by both JSC and V8

$ diff WebCore/bridge/jni/JNIBridge.h V8Binding/jni/jni_runtime.h
2d1
<  * Copyright (C) 2003, 2004, 2005, 2007, 2009, 2010 Apple Inc. All rights reserved.
27,30c26,27
< #ifndef JNIBridge_h
< #define JNIBridge_h
<
< #if ENABLE(MAC_JAVA_BRIDGE)
---
> #ifndef jni_runtime_h
> #define jni_runtime_h
31a29
> #include "Bridge.h"
34,35c32,33
< #if USE(JSC)
< #include "JavaStringJSC.h"
---
> #if USE(V8)
> #include "JavaStringV8.h"
64,66d61
< #if USE(JSC)
<     operator UString() const { return m_impl.uString(); }
< #endif
118,120c113
< #endif // ENABLE(MAC_JAVA_BRIDGE)
<
< #endif // JNIBridge_h
---
> #endif // jni_runtime_h

Change-Id: I59c7dafb295aa7c81e79283333266c3f9f5a9a52

Android.mk
V8Binding/jni/jni_runtime.cpp
V8Binding/jni/jni_runtime.h [deleted file]
WebCore/Android.v8bindings.mk
WebCore/bridge/jni/JNIBridge.h
WebCore/bridge/jni/v8/JNIBridgeV8.h
WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp
WebCore/bridge/jni/v8/JavaClassV8.cpp
WebCore/bridge/jni/v8/JavaInstanceV8.cpp
WebCore/bridge/jni/v8/JavaNPObjectV8.cpp
WebCore/bridge/jni/v8/JavaNPObjectV8.h

index 58a4bb6..e24770e 100644 (file)
@@ -173,12 +173,6 @@ ifeq ($(JAVASCRIPT_ENGINE),v8)
 include $(LOCAL_PATH)/Android.v8bindings.mk
 # TODO: We should use the WebCore JNI code instead.
 JNI_PATH := V8Binding/jni
-# bridge/jni path must be listed after V8Bindings, so files are preferentially
-# included from V8bindings.
-BINDING_C_INCLUDES += \
-       $(BASE_PATH)/$(JNI_PATH) \
-       $(LOCAL_PATH)/bridge/jni \
-       $(LOCAL_PATH)/bridge/jni/v8
 JNI_SRC_FILES := \
        jni_runtime.cpp
 WEBKIT_SRC_FILES += $(addprefix $(JNI_PATH)/,$(JNI_SRC_FILES))
index 3b183bc..edb1b2f 100644 (file)
@@ -24,7 +24,7 @@
  */
 
 #include "config.h"
-#include "jni_runtime.h"
+#include "JNIBridge.h"
 
 #include "JNIUtility.h"
 #include "StringBuilder.h"
diff --git a/V8Binding/jni/jni_runtime.h b/V8Binding/jni/jni_runtime.h
deleted file mode 100644 (file)
index c6565d0..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright 2010, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef jni_runtime_h
-#define jni_runtime_h
-
-#include "Bridge.h"
-#include "JNIUtility.h"
-
-#if USE(V8)
-#include "JavaStringV8.h"
-#endif
-
-namespace JSC {
-
-namespace Bindings {
-
-typedef const char* RuntimeType;
-
-class JavaString {
-public:
-    JavaString()
-    {
-        m_impl.init();
-    }
-
-    JavaString(JNIEnv* e, jstring s)
-    {
-        m_impl.init(e, s);
-    }
-
-    JavaString(jstring s)
-    {
-        m_impl.init(getJNIEnv(), s);
-    }
-
-    const char* UTF8String() const { return m_impl.UTF8String(); }
-    const jchar* uchars() const { return m_impl.uchars(); }
-    int length() const { return m_impl.length(); }
-
-private:
-    JavaStringImpl m_impl;
-};
-
-class JavaParameter {
-public:
-    JavaParameter() : m_JNIType(invalid_type) { }
-    JavaParameter(JNIEnv*, jstring type);
-    virtual ~JavaParameter() { }
-
-    RuntimeType type() const { return m_type.UTF8String(); }
-    JNIType getJNIType() const { return m_JNIType; }
-
-private:
-    JavaString m_type;
-    JNIType m_JNIType;
-};
-
-class JavaMethod : public Method {
-public:
-    JavaMethod(JNIEnv*, jobject aMethod);
-    ~JavaMethod();
-
-    const JavaString& name() const { return m_name; }
-    RuntimeType returnType() const { return m_returnType.UTF8String(); }
-    JavaParameter* parameterAt(int i) const { return &m_parameters[i]; }
-    int numParameters() const { return m_numParameters; }
-
-    const char* signature() const;
-    JNIType JNIReturnType() const;
-
-    jmethodID methodID(jobject obj) const;
-
-    bool isStatic() const { return m_isStatic; }
-
-private:
-    JavaParameter* m_parameters;
-    int m_numParameters;
-    JavaString m_name;
-    mutable char* m_signature;
-    JavaString m_returnType;
-    JNIType m_JNIReturnType;
-    mutable jmethodID m_methodID;
-    bool m_isStatic;
-};
-
-} // namespace Bindings
-
-} // namespace JSC
-
-#endif // jni_runtime_h
index ce6c42d..6aa18d4 100644 (file)
@@ -31,6 +31,8 @@ BINDING_C_INCLUDES := \
        $(LOCAL_PATH)/bindings/v8 \
        $(LOCAL_PATH)/bindings/v8/custom \
        $(LOCAL_PATH)/bridge \
+       $(LOCAL_PATH)/bridge/jni \
+       $(LOCAL_PATH)/bridge/jni/v8 \
        $(LOCAL_PATH)/bridge/jsc \
        \
        $(base_intermediates)/WebCore/bindings \
index 712ee7d..c48ed98 100644 (file)
 
 #if ENABLE(MAC_JAVA_BRIDGE)
 
+#include "Bridge.h"
 #include "JNIUtility.h"
 
+// ANDROID
+// Upstream the V8 ifdef to webkit.org
 #if USE(JSC)
 #include "JavaStringJSC.h"
+#elif USE(V8)
+#include "JavaStringV8.h"
 #endif
 
 namespace JSC {
index 3922d62..eb5c77a 100644 (file)
 #ifndef JNIBridgeV8_h
 #define JNIBridgeV8_h
 
+#include "JNIBridge.h"
 #include "JNIUtility.h"
 #include "JavaInstanceV8.h"
-#include "JavaStringV8.h"
-#include "jni_runtime.h"
-
 
 namespace JSC {
 
index a71814c..a6cfb2d 100644 (file)
@@ -26,9 +26,9 @@
 #include "config.h"
 #include "JNIUtilityPrivate.h"
 
+#include "JNIBridge.h"
 #include "JavaInstanceV8.h"
 #include "JavaNPObjectV8.h"
-#include "jni_runtime.h"
 
 namespace JSC {
 
index c29cf86..8d794ee 100644 (file)
@@ -27,8 +27,8 @@
 #include "config.h"
 #include "JavaClassV8.h"
 
+#include "JNIBridge.h"
 #include "JNIUtility.h"
-#include "jni_runtime.h"
 
 using namespace JSC::Bindings;
 
index 13d4984..4d6b49f 100644 (file)
@@ -26,9 +26,9 @@
 #include "config.h"
 #include "JavaInstanceV8.h"
 
+#include "JNIBridge.h"
 #include "JNIUtility.h"
 #include "JavaClassV8.h"
-#include "jni_runtime.h"
 
 #include <assert.h>
 #include <utils/Log.h>
index 636d075..94c2198 100644 (file)
@@ -30,7 +30,6 @@
 #include "JNIUtility.h"
 #include "JavaClassV8.h"
 #include "JavaInstanceV8.h"
-#include "jni_runtime.h"
 #include "npruntime_impl.h"
 
 namespace JSC {
index c36ef70..89e2f3b 100644 (file)
@@ -26,7 +26,7 @@
 #ifndef JavaNPObjectV8_h
 #define JavaNPObjectV8_h
 
-#include "jni_runtime.h"
+#include "JNIBridge.h"
 #include "npruntime.h"
 #include <JavaVM/jni.h>
 #include <wtf/RefPtr.h>