[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.18-1-697-g2f78b87
eric at webkit.org
eric at webkit.org
Wed Jan 20 22:27:56 UTC 2010
The following commit has been merged in the debian/unstable branch:
commit c7508911defbbe926fd47cbeef22086da6d72c19
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Jan 18 18:15:24 2010 +0000
2010-01-18 Steve Block <steveblock at google.com>
Reviewed by Adam Barth.
Moves JSC-specific version of JavaInstance from bridge/jni/jni_instance to bridge/jni/jsc/JavaInstanceJSC
https://bugs.webkit.org/show_bug.cgi?id=33672
No new tests, refactoring only.
* Android.jscbindings.mk: Modified. Removed jni_instance.cpp and added JavaInstanceJSC.cpp
* GNUmakefile.am: Modified. Removed jni_instance.h and added JavaInstanceJSC.h
* WebCore.xcodeproj/project.pbxproj: Modified. Removed jni_instance.[cpp|h] and added JavaInstanceJSC.[cpp|h]
* bindings/js/ScriptControllerMac.mm: Modified. Includes JavaInstanceJSC.h
* bridge/jni/jni_instance.cpp: Removed.
* bridge/jni/jni_instance.h: Removed.
* bridge/jni/jni_runtime.h: Modified. Includes JavaInstanceJSC.h
* bridge/jni/jsc/JavaInstanceJSC.cpp: Copied from WebCore/bridge/jni/jni_instance.cpp.
* bridge/jni/jsc/JavaInstanceJSC.h: Copied from WebCore/bridge/jni/jni_instance.h.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53412 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/Android.jscbindings.mk b/WebCore/Android.jscbindings.mk
index 1ec3ab2..0e4e7ed 100644
--- a/WebCore/Android.jscbindings.mk
+++ b/WebCore/Android.jscbindings.mk
@@ -184,9 +184,9 @@ LOCAL_SRC_FILES += \
bridge/c/c_runtime.cpp \
bridge/c/c_utility.cpp \
bridge/jni/jni_class.cpp \
- bridge/jni/jni_instance.cpp \
bridge/jni/jni_runtime.cpp \
bridge/jni/jni_utility.cpp \
+ bridge/jni/jsc/JavaInstanceJSC.cpp \
bridge/jni/jsc/jni_utility_private.cpp \
bridge/npruntime.cpp \
bridge/runtime.cpp \
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 6737348..b2b2a4d 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,22 @@
+2010-01-18 Steve Block <steveblock at google.com>
+
+ Reviewed by Adam Barth.
+
+ Moves JSC-specific version of JavaInstance from bridge/jni/jni_instance to bridge/jni/jsc/JavaInstanceJSC
+ https://bugs.webkit.org/show_bug.cgi?id=33672
+
+ No new tests, refactoring only.
+
+ * Android.jscbindings.mk: Modified. Removed jni_instance.cpp and added JavaInstanceJSC.cpp
+ * GNUmakefile.am: Modified. Removed jni_instance.h and added JavaInstanceJSC.h
+ * WebCore.xcodeproj/project.pbxproj: Modified. Removed jni_instance.[cpp|h] and added JavaInstanceJSC.[cpp|h]
+ * bindings/js/ScriptControllerMac.mm: Modified. Includes JavaInstanceJSC.h
+ * bridge/jni/jni_instance.cpp: Removed.
+ * bridge/jni/jni_instance.h: Removed.
+ * bridge/jni/jni_runtime.h: Modified. Includes JavaInstanceJSC.h
+ * bridge/jni/jsc/JavaInstanceJSC.cpp: Copied from WebCore/bridge/jni/jni_instance.cpp.
+ * bridge/jni/jsc/JavaInstanceJSC.h: Copied from WebCore/bridge/jni/jni_instance.h.
+
2010-01-18 Peter Kasting <pkasting at google.com>
Reviewed by Adam Barth.
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index 0590215..0090ddd 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -14,6 +14,7 @@ webcore_cppflags += \
-I$(srcdir)/WebCore/bindings/js \
-I$(srcdir)/WebCore/bridge \
-I$(srcdir)/WebCore/bridge/c \
+ -I$(srcdir)/WebCore/bridge/jni/jsc \
-I$(srcdir)/WebCore/css \
-I$(srcdir)/WebCore/dom \
-I$(srcdir)/WebCore/dom/default \
@@ -503,10 +504,10 @@ webcore_sources += \
WebCore/bridge/c/c_utility.cpp \
WebCore/bridge/c/c_utility.h \
WebCore/bridge/jni/jni_class.h \
- WebCore/bridge/jni/jni_instance.h \
WebCore/bridge/jni/jni_jsobject.h \
WebCore/bridge/jni/jni_runtime.h \
WebCore/bridge/jni/jni_utility.h \
+ WebCore/bridge/jni/jsc/JavaInstanceJSC.h \
WebCore/bridge/npapi.h \
WebCore/bridge/npruntime.cpp \
WebCore/bridge/npruntime.h \
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 14c4257..b0d8266 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -305,8 +305,6 @@
1A569CFE0D7E2B82007C3983 /* c_utility.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A569CCD0D7E2B82007C3983 /* c_utility.h */; };
1A569CFF0D7E2B82007C3983 /* jni_class.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A569CCF0D7E2B82007C3983 /* jni_class.cpp */; };
1A569D000D7E2B82007C3983 /* jni_class.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A569CD00D7E2B82007C3983 /* jni_class.h */; };
- 1A569D010D7E2B82007C3983 /* jni_instance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A569CD10D7E2B82007C3983 /* jni_instance.cpp */; };
- 1A569D020D7E2B82007C3983 /* jni_instance.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A569CD20D7E2B82007C3983 /* jni_instance.h */; };
1A569D030D7E2B82007C3983 /* jni_jsobject.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A569CD30D7E2B82007C3983 /* jni_jsobject.mm */; };
1A569D040D7E2B82007C3983 /* jni_jsobject.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A569CD40D7E2B82007C3983 /* jni_jsobject.h */; settings = {ATTRIBUTES = (Private, ); }; };
1A569D050D7E2B82007C3983 /* jni_objc.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A569CD50D7E2B82007C3983 /* jni_objc.mm */; };
@@ -1115,6 +1113,8 @@
550A0BCA085F6039007353D6 /* QualifiedName.h in Headers */ = {isa = PBXBuildFile; fileRef = 550A0BC8085F6039007353D6 /* QualifiedName.h */; settings = {ATTRIBUTES = (Private, ); }; };
599D1E3210C97D6E00E0EF12 /* jni_utility_private.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 599D1E3010C97D6E00E0EF12 /* jni_utility_private.cpp */; };
599D1E3310C97D6E00E0EF12 /* jni_utility_private.h in Headers */ = {isa = PBXBuildFile; fileRef = 599D1E3110C97D6E00E0EF12 /* jni_utility_private.h */; };
+ 59A9E7B01104758800DFB4C1 /* JavaInstanceJSC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59A9E7AF1104758800DFB4C1 /* JavaInstanceJSC.cpp */; };
+ 59A9E7B21104759400DFB4C1 /* JavaInstanceJSC.h in Headers */ = {isa = PBXBuildFile; fileRef = 59A9E7B11104759400DFB4C1 /* JavaInstanceJSC.h */; };
59C77F2A10545B3B00506104 /* GeolocationServiceMock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59C77F2810545B3B00506104 /* GeolocationServiceMock.cpp */; };
59C77F2B10545B3B00506104 /* GeolocationServiceMock.h in Headers */ = {isa = PBXBuildFile; fileRef = 59C77F2910545B3B00506104 /* GeolocationServiceMock.h */; settings = {ATTRIBUTES = (Private, ); }; };
5D15E3AB0F9E6AC1009E0E3F /* XMLTokenizerScope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5D15E3A90F9E6AC1009E0E3F /* XMLTokenizerScope.cpp */; };
@@ -5550,8 +5550,6 @@
1A569CCD0D7E2B82007C3983 /* c_utility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_utility.h; sourceTree = "<group>"; };
1A569CCF0D7E2B82007C3983 /* jni_class.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jni_class.cpp; sourceTree = "<group>"; };
1A569CD00D7E2B82007C3983 /* jni_class.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jni_class.h; sourceTree = "<group>"; };
- 1A569CD10D7E2B82007C3983 /* jni_instance.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jni_instance.cpp; sourceTree = "<group>"; };
- 1A569CD20D7E2B82007C3983 /* jni_instance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jni_instance.h; sourceTree = "<group>"; };
1A569CD30D7E2B82007C3983 /* jni_jsobject.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = jni_jsobject.mm; sourceTree = "<group>"; };
1A569CD40D7E2B82007C3983 /* jni_jsobject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jni_jsobject.h; sourceTree = "<group>"; };
1A569CD50D7E2B82007C3983 /* jni_objc.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = jni_objc.mm; sourceTree = "<group>"; };
@@ -6465,6 +6463,8 @@
550A0BC8085F6039007353D6 /* QualifiedName.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = QualifiedName.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
599D1E3010C97D6E00E0EF12 /* jni_utility_private.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = jni_utility_private.cpp; path = jsc/jni_utility_private.cpp; sourceTree = "<group>"; };
599D1E3110C97D6E00E0EF12 /* jni_utility_private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = jni_utility_private.h; path = jsc/jni_utility_private.h; sourceTree = "<group>"; };
+ 59A9E7AF1104758800DFB4C1 /* JavaInstanceJSC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JavaInstanceJSC.cpp; path = jsc/JavaInstanceJSC.cpp; sourceTree = "<group>"; };
+ 59A9E7B11104759400DFB4C1 /* JavaInstanceJSC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JavaInstanceJSC.h; path = jsc/JavaInstanceJSC.h; sourceTree = "<group>"; };
59C77F2810545B3B00506104 /* GeolocationServiceMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GeolocationServiceMock.cpp; path = mock/GeolocationServiceMock.cpp; sourceTree = "<group>"; };
59C77F2910545B3B00506104 /* GeolocationServiceMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GeolocationServiceMock.h; path = mock/GeolocationServiceMock.h; sourceTree = "<group>"; };
5D15E3A90F9E6AC1009E0E3F /* XMLTokenizerScope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XMLTokenizerScope.cpp; sourceTree = "<group>"; };
@@ -10343,8 +10343,6 @@
599D1E2F10C97D4C00E0EF12 /* jsc */,
1A569CCF0D7E2B82007C3983 /* jni_class.cpp */,
1A569CD00D7E2B82007C3983 /* jni_class.h */,
- 1A569CD10D7E2B82007C3983 /* jni_instance.cpp */,
- 1A569CD20D7E2B82007C3983 /* jni_instance.h */,
1A569CD40D7E2B82007C3983 /* jni_jsobject.h */,
1A569CD30D7E2B82007C3983 /* jni_jsobject.mm */,
1A569CD50D7E2B82007C3983 /* jni_objc.mm */,
@@ -11057,6 +11055,8 @@
599D1E2F10C97D4C00E0EF12 /* jsc */ = {
isa = PBXGroup;
children = (
+ 59A9E7B11104759400DFB4C1 /* JavaInstanceJSC.h */,
+ 59A9E7AF1104758800DFB4C1 /* JavaInstanceJSC.cpp */,
599D1E3010C97D6E00E0EF12 /* jni_utility_private.cpp */,
599D1E3110C97D6E00E0EF12 /* jni_utility_private.h */,
);
@@ -17142,7 +17142,6 @@
1C81BA010E9733CB00266E07 /* JavaScriptProfile.h in Headers */,
1C81B9FF0E9733CB00266E07 /* JavaScriptProfileNode.h in Headers */,
1A569D000D7E2B82007C3983 /* jni_class.h in Headers */,
- 1A569D020D7E2B82007C3983 /* jni_instance.h in Headers */,
1A569D040D7E2B82007C3983 /* jni_jsobject.h in Headers */,
1A569D070D7E2B82007C3983 /* jni_runtime.h in Headers */,
1A569D090D7E2B82007C3983 /* jni_utility.h in Headers */,
@@ -18349,6 +18348,7 @@
6E4E91AD10F7FB3100A2779C /* CanvasContextAttributes.h in Headers */,
6E4E91AF10F7FB3100A2779C /* WebGLContextAttributes.h in Headers */,
6EE8A77310F803F3005A4A24 /* JSWebGLContextAttributes.h in Headers */,
+ 59A9E7B21104759400DFB4C1 /* JavaInstanceJSC.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -19315,7 +19315,6 @@
1C81BA020E9733CB00266E07 /* JavaScriptProfile.cpp in Sources */,
1C81BA000E9733CB00266E07 /* JavaScriptProfileNode.cpp in Sources */,
1A569CFF0D7E2B82007C3983 /* jni_class.cpp in Sources */,
- 1A569D010D7E2B82007C3983 /* jni_instance.cpp in Sources */,
1A569D030D7E2B82007C3983 /* jni_jsobject.mm in Sources */,
1A569D050D7E2B82007C3983 /* jni_objc.mm in Sources */,
1A569D060D7E2B82007C3983 /* jni_runtime.cpp in Sources */,
@@ -20513,6 +20512,7 @@
6E4E91AC10F7FB3100A2779C /* CanvasContextAttributes.cpp in Sources */,
6E4E91AE10F7FB3100A2779C /* WebGLContextAttributes.cpp in Sources */,
6EE8A77210F803F3005A4A24 /* JSWebGLContextAttributes.cpp in Sources */,
+ 59A9E7B01104758800DFB4C1 /* JavaInstanceJSC.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/WebCore/bindings/js/ScriptControllerMac.mm b/WebCore/bindings/js/ScriptControllerMac.mm
index 98d302e..271efa6 100644
--- a/WebCore/bindings/js/ScriptControllerMac.mm
+++ b/WebCore/bindings/js/ScriptControllerMac.mm
@@ -51,7 +51,7 @@
#import "runtime.h"
#if ENABLE(MAC_JAVA_BRIDGE)
-#import "jni_instance.h"
+#import "JavaInstanceJSC.h"
#endif
@interface NSObject (WebPlugin)
diff --git a/WebCore/bridge/jni/jni_instance.cpp b/WebCore/bridge/jni/jni_instance.cpp
deleted file mode 100644
index 3783d10..0000000
--- a/WebCore/bridge/jni/jni_instance.cpp
+++ /dev/null
@@ -1,335 +0,0 @@
-/*
- * Copyright (C) 2003, 2008 Apple Inc. All rights reserved.
- *
- * 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.
- */
-
-#include "config.h"
-#include "jni_instance.h"
-
-#if ENABLE(MAC_JAVA_BRIDGE)
-
-#include "jni_class.h"
-#include "jni_runtime.h"
-#include "jni_utility.h"
-#include "jni_utility_private.h"
-#include "runtime_object.h"
-#include "runtime_root.h"
-#include <runtime/ArgList.h>
-#include <runtime/Error.h>
-#include <runtime/JSLock.h>
-
-#if PLATFORM(ANDROID)
-#include <assert.h>
-#endif
-
-#ifdef NDEBUG
-#define JS_LOG(formatAndArgs...) ((void)0)
-#else
-#define JS_LOG(formatAndArgs...) { \
- fprintf (stderr, "%s:%d -- %s: ", __FILE__, __LINE__, __FUNCTION__); \
- fprintf(stderr, formatAndArgs); \
-}
-#endif
-
-using namespace JSC::Bindings;
-using namespace JSC;
-
-JavaInstance::JavaInstance (jobject instance, PassRefPtr<RootObject> rootObject)
- : Instance(rootObject)
-{
- _instance = new JObjectWrapper (instance);
- _class = 0;
-}
-
-JavaInstance::~JavaInstance ()
-{
- delete _class;
-}
-
-#define NUM_LOCAL_REFS 64
-
-void JavaInstance::virtualBegin()
-{
- getJNIEnv()->PushLocalFrame (NUM_LOCAL_REFS);
-}
-
-void JavaInstance::virtualEnd()
-{
- getJNIEnv()->PopLocalFrame (NULL);
-}
-
-Class *JavaInstance::getClass() const
-{
- if (_class == 0)
- _class = new JavaClass (_instance->_instance);
- return _class;
-}
-
-JSValue JavaInstance::stringValue(ExecState* exec) const
-{
- JSLock lock(SilenceAssertionsOnly);
-
- jstring stringValue = (jstring)callJNIMethod<jobject>(_instance->_instance, "toString", "()Ljava/lang/String;");
- JNIEnv *env = getJNIEnv();
- const jchar *c = getUCharactersFromJStringInEnv(env, stringValue);
- UString u((const UChar *)c, (int)env->GetStringLength(stringValue));
- releaseUCharactersForJStringInEnv(env, stringValue, c);
- return jsString(exec, u);
-}
-
-JSValue JavaInstance::numberValue(ExecState* exec) const
-{
- jdouble doubleValue = callJNIMethod<jdouble>(_instance->_instance, "doubleValue", "()D");
- return jsNumber(exec, doubleValue);
-}
-
-JSValue JavaInstance::booleanValue() const
-{
- jboolean booleanValue = callJNIMethod<jboolean>(_instance->_instance, "booleanValue", "()Z");
- return jsBoolean(booleanValue);
-}
-
-JSValue JavaInstance::invokeMethod (ExecState *exec, const MethodList &methodList, const ArgList &args)
-{
- int i, count = args.size();
- jvalue *jArgs;
- JSValue resultValue;
- Method *method = 0;
- size_t numMethods = methodList.size();
-
- // Try to find a good match for the overloaded method. The
- // fundamental problem is that JavaScript doesn have the
- // notion of method overloading and Java does. We could
- // get a bit more sophisticated and attempt to does some
- // type checking as we as checking the number of parameters.
- Method *aMethod;
- for (size_t methodIndex = 0; methodIndex < numMethods; methodIndex++) {
- aMethod = methodList[methodIndex];
- if (aMethod->numParameters() == count) {
- method = aMethod;
- break;
- }
- }
- if (method == 0) {
- JS_LOG ("unable to find an appropiate method\n");
- return jsUndefined();
- }
-
- const JavaMethod *jMethod = static_cast<const JavaMethod*>(method);
- JS_LOG ("call %s %s on %p\n", UString(jMethod->name()).UTF8String().c_str(), jMethod->signature(), _instance->_instance);
-
- if (count > 0) {
- jArgs = (jvalue *)malloc (count * sizeof(jvalue));
- }
- else
- jArgs = 0;
-
- for (i = 0; i < count; i++) {
- JavaParameter* aParameter = jMethod->parameterAt(i);
- jArgs[i] = convertValueToJValue(exec, args.at(i), aParameter->getJNIType(), aParameter->type());
- JS_LOG("arg[%d] = %s\n", i, args.at(i).toString(exec).ascii());
- }
-
- jvalue result;
-
- // Try to use the JNI abstraction first, otherwise fall back to
- // nornmal JNI. The JNI dispatch abstraction allows the Java plugin
- // to dispatch the call on the appropriate internal VM thread.
- RootObject* rootObject = this->rootObject();
- if (!rootObject)
- return jsUndefined();
-
- bool handled = false;
- if (rootObject->nativeHandle()) {
- jobject obj = _instance->_instance;
- JSValue exceptionDescription;
- const char *callingURL = 0; // FIXME, need to propagate calling URL to Java
- handled = dispatchJNICall(exec, rootObject->nativeHandle(), obj, jMethod->isStatic(), jMethod->JNIReturnType(), jMethod->methodID(obj), jArgs, result, callingURL, exceptionDescription);
- if (exceptionDescription) {
- throwError(exec, GeneralError, exceptionDescription.toString(exec));
- free (jArgs);
- return jsUndefined();
- }
- }
-
- // The following code can be conditionally removed once we have a Tiger update that
- // contains the new Java plugin. It is needed for builds prior to Tiger.
- if (!handled) {
- jobject obj = _instance->_instance;
- switch (jMethod->JNIReturnType()){
- case void_type:
- callJNIMethodIDA<void>(obj, jMethod->methodID(obj), jArgs);
- break;
- case object_type:
- result.l = callJNIMethodIDA<jobject>(obj, jMethod->methodID(obj), jArgs);
- break;
- case boolean_type:
- result.z = callJNIMethodIDA<jboolean>(obj, jMethod->methodID(obj), jArgs);
- break;
- case byte_type:
- result.b = callJNIMethodIDA<jbyte>(obj, jMethod->methodID(obj), jArgs);
- break;
- case char_type:
- result.c = callJNIMethodIDA<jchar>(obj, jMethod->methodID(obj), jArgs);
- break;
- case short_type:
- result.s = callJNIMethodIDA<jshort>(obj, jMethod->methodID(obj), jArgs);
- break;
- case int_type:
- result.i = callJNIMethodIDA<jint>(obj, jMethod->methodID(obj), jArgs);
- break;
-
- case long_type:
- result.j = callJNIMethodIDA<jlong>(obj, jMethod->methodID(obj), jArgs);
- break;
- case float_type:
- result.f = callJNIMethodIDA<jfloat>(obj, jMethod->methodID(obj), jArgs);
- break;
- case double_type:
- result.d = callJNIMethodIDA<jdouble>(obj, jMethod->methodID(obj), jArgs);
- break;
- case invalid_type:
- default:
- break;
- }
- }
-
- switch (jMethod->JNIReturnType()){
- case void_type: {
- resultValue = jsUndefined();
- }
- break;
-
- case object_type: {
- if (result.l != 0) {
- const char *arrayType = jMethod->returnType();
- if (arrayType[0] == '[') {
- resultValue = JavaArray::convertJObjectToArray(exec, result.l, arrayType, rootObject);
- }
- else {
- resultValue = JavaInstance::create(result.l, rootObject)->createRuntimeObject(exec);
- }
- }
- else {
- resultValue = jsUndefined();
- }
- }
- break;
-
- case boolean_type: {
- resultValue = jsBoolean(result.z);
- }
- break;
-
- case byte_type: {
- resultValue = jsNumber(exec, result.b);
- }
- break;
-
- case char_type: {
- resultValue = jsNumber(exec, result.c);
- }
- break;
-
- case short_type: {
- resultValue = jsNumber(exec, result.s);
- }
- break;
-
- case int_type: {
- resultValue = jsNumber(exec, result.i);
- }
- break;
-
- case long_type: {
- resultValue = jsNumber(exec, result.j);
- }
- break;
-
- case float_type: {
- resultValue = jsNumber(exec, result.f);
- }
- break;
-
- case double_type: {
- resultValue = jsNumber(exec, result.d);
- }
- break;
-
- case invalid_type:
- default: {
- resultValue = jsUndefined();
- }
- break;
- }
-
- free (jArgs);
-
- return resultValue;
-}
-
-JSValue JavaInstance::defaultValue(ExecState* exec, PreferredPrimitiveType hint) const
-{
- if (hint == PreferString)
- return stringValue(exec);
- if (hint == PreferNumber)
- return numberValue(exec);
- JavaClass *aClass = static_cast<JavaClass*>(getClass());
- if (aClass->isStringClass())
- return stringValue(exec);
- if (aClass->isNumberClass())
- return numberValue(exec);
- if (aClass->isBooleanClass())
- return booleanValue();
- return valueOf(exec);
-}
-
-JSValue JavaInstance::valueOf(ExecState* exec) const
-{
- return stringValue(exec);
-}
-
-JObjectWrapper::JObjectWrapper(jobject instance)
-: _refCount(0)
-{
- assert (instance != 0);
-
- // Cache the JNIEnv used to get the global ref for this java instanace.
- // It'll be used to delete the reference.
- _env = getJNIEnv();
-
- _instance = _env->NewGlobalRef (instance);
-
- JS_LOG ("new global ref %p for %p\n", _instance, instance);
-
- if (_instance == NULL) {
- fprintf (stderr, "%s: could not get GlobalRef for %p\n", __PRETTY_FUNCTION__, instance);
- }
-}
-
-JObjectWrapper::~JObjectWrapper() {
- JS_LOG ("deleting global ref %p\n", _instance);
- _env->DeleteGlobalRef (_instance);
-}
-
-#endif // ENABLE(MAC_JAVA_BRIDGE)
diff --git a/WebCore/bridge/jni/jni_instance.h b/WebCore/bridge/jni/jni_instance.h
deleted file mode 100644
index 049bfdb..0000000
--- a/WebCore/bridge/jni/jni_instance.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2003 Apple Computer, Inc. All rights reserved.
- *
- * 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_INSTANCE_H_
-#define _JNI_INSTANCE_H_
-
-#if ENABLE(MAC_JAVA_BRIDGE)
-
-#include "runtime.h"
-#include "runtime_root.h"
-
-#include <JavaVM/jni.h>
-
-namespace JSC {
-
-namespace Bindings {
-
-class JavaClass;
-
-class JObjectWrapper
-{
-friend class RefPtr<JObjectWrapper>;
-friend class JavaArray;
-friend class JavaField;
-friend class JavaInstance;
-friend class JavaMethod;
-
-public:
- jobject instance() const { return _instance; }
- void setInstance(jobject instance) { _instance = instance; }
-
-protected:
- JObjectWrapper(jobject instance);
- ~JObjectWrapper();
-
- void ref() { _refCount++; }
- void deref()
- {
- if (--_refCount == 0)
- delete this;
- }
-
- jobject _instance;
-
-private:
- JNIEnv *_env;
- unsigned int _refCount;
-};
-
-class JavaInstance : public Instance
-{
-public:
- static PassRefPtr<JavaInstance> create(jobject instance, PassRefPtr<RootObject> rootObject)
- {
- return adoptRef(new JavaInstance(instance, rootObject));
- }
-
- ~JavaInstance();
-
- virtual Class *getClass() const;
-
- virtual JSValue valueOf(ExecState*) const;
- virtual JSValue defaultValue(ExecState*, PreferredPrimitiveType) const;
-
- virtual JSValue invokeMethod(ExecState* exec, const MethodList& method, const ArgList& args);
-
- jobject javaInstance() const { return _instance->_instance; }
-
- JSValue stringValue(ExecState*) const;
- JSValue numberValue(ExecState*) const;
- JSValue booleanValue() const;
-
-protected:
- JavaInstance(jobject instance, PassRefPtr<RootObject>);
- virtual void virtualBegin();
- virtual void virtualEnd();
-
- RefPtr<JObjectWrapper> _instance;
- mutable JavaClass *_class;
-};
-
-} // namespace Bindings
-
-} // namespace JSC
-
-#endif // ENABLE(MAC_JAVA_BRIDGE)
-
-#endif // _JNI_INSTANCE_H_
diff --git a/WebCore/bridge/jni/jni_runtime.h b/WebCore/bridge/jni/jni_runtime.h
index 81484ff..e18b9a1 100644
--- a/WebCore/bridge/jni/jni_runtime.h
+++ b/WebCore/bridge/jni/jni_runtime.h
@@ -28,8 +28,8 @@
#if ENABLE(MAC_JAVA_BRIDGE)
-#include <jni_utility.h>
-#include <jni_instance.h>
+#include "JavaInstanceJSC.h"
+#include "jni_utility.h"
#include <runtime/JSLock.h>
diff --git a/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp b/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp
new file mode 100644
index 0000000..3f88002
--- /dev/null
+++ b/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp
@@ -0,0 +1,335 @@
+/*
+ * Copyright (C) 2003, 2008 Apple Inc. All rights reserved.
+ *
+ * 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.
+ */
+
+#include "config.h"
+#include "JavaInstanceJSC.h"
+
+#if ENABLE(MAC_JAVA_BRIDGE)
+
+#include "jni_class.h"
+#include "jni_runtime.h"
+#include "jni_utility.h"
+#include "jni_utility_private.h"
+#include "runtime_object.h"
+#include "runtime_root.h"
+#include <runtime/ArgList.h>
+#include <runtime/Error.h>
+#include <runtime/JSLock.h>
+
+#if PLATFORM(ANDROID)
+#include <assert.h>
+#endif
+
+#ifdef NDEBUG
+#define JS_LOG(formatAndArgs...) ((void)0)
+#else
+#define JS_LOG(formatAndArgs...) { \
+ fprintf (stderr, "%s:%d -- %s: ", __FILE__, __LINE__, __FUNCTION__); \
+ fprintf(stderr, formatAndArgs); \
+}
+#endif
+
+using namespace JSC::Bindings;
+using namespace JSC;
+
+JavaInstance::JavaInstance (jobject instance, PassRefPtr<RootObject> rootObject)
+ : Instance(rootObject)
+{
+ _instance = new JObjectWrapper (instance);
+ _class = 0;
+}
+
+JavaInstance::~JavaInstance ()
+{
+ delete _class;
+}
+
+#define NUM_LOCAL_REFS 64
+
+void JavaInstance::virtualBegin()
+{
+ getJNIEnv()->PushLocalFrame (NUM_LOCAL_REFS);
+}
+
+void JavaInstance::virtualEnd()
+{
+ getJNIEnv()->PopLocalFrame (NULL);
+}
+
+Class *JavaInstance::getClass() const
+{
+ if (_class == 0)
+ _class = new JavaClass (_instance->_instance);
+ return _class;
+}
+
+JSValue JavaInstance::stringValue(ExecState* exec) const
+{
+ JSLock lock(SilenceAssertionsOnly);
+
+ jstring stringValue = (jstring)callJNIMethod<jobject>(_instance->_instance, "toString", "()Ljava/lang/String;");
+ JNIEnv *env = getJNIEnv();
+ const jchar *c = getUCharactersFromJStringInEnv(env, stringValue);
+ UString u((const UChar *)c, (int)env->GetStringLength(stringValue));
+ releaseUCharactersForJStringInEnv(env, stringValue, c);
+ return jsString(exec, u);
+}
+
+JSValue JavaInstance::numberValue(ExecState* exec) const
+{
+ jdouble doubleValue = callJNIMethod<jdouble>(_instance->_instance, "doubleValue", "()D");
+ return jsNumber(exec, doubleValue);
+}
+
+JSValue JavaInstance::booleanValue() const
+{
+ jboolean booleanValue = callJNIMethod<jboolean>(_instance->_instance, "booleanValue", "()Z");
+ return jsBoolean(booleanValue);
+}
+
+JSValue JavaInstance::invokeMethod (ExecState *exec, const MethodList &methodList, const ArgList &args)
+{
+ int i, count = args.size();
+ jvalue *jArgs;
+ JSValue resultValue;
+ Method *method = 0;
+ size_t numMethods = methodList.size();
+
+ // Try to find a good match for the overloaded method. The
+ // fundamental problem is that JavaScript doesn have the
+ // notion of method overloading and Java does. We could
+ // get a bit more sophisticated and attempt to does some
+ // type checking as we as checking the number of parameters.
+ Method *aMethod;
+ for (size_t methodIndex = 0; methodIndex < numMethods; methodIndex++) {
+ aMethod = methodList[methodIndex];
+ if (aMethod->numParameters() == count) {
+ method = aMethod;
+ break;
+ }
+ }
+ if (method == 0) {
+ JS_LOG ("unable to find an appropiate method\n");
+ return jsUndefined();
+ }
+
+ const JavaMethod *jMethod = static_cast<const JavaMethod*>(method);
+ JS_LOG ("call %s %s on %p\n", UString(jMethod->name()).UTF8String().c_str(), jMethod->signature(), _instance->_instance);
+
+ if (count > 0) {
+ jArgs = (jvalue *)malloc (count * sizeof(jvalue));
+ }
+ else
+ jArgs = 0;
+
+ for (i = 0; i < count; i++) {
+ JavaParameter* aParameter = jMethod->parameterAt(i);
+ jArgs[i] = convertValueToJValue(exec, args.at(i), aParameter->getJNIType(), aParameter->type());
+ JS_LOG("arg[%d] = %s\n", i, args.at(i).toString(exec).ascii());
+ }
+
+ jvalue result;
+
+ // Try to use the JNI abstraction first, otherwise fall back to
+ // nornmal JNI. The JNI dispatch abstraction allows the Java plugin
+ // to dispatch the call on the appropriate internal VM thread.
+ RootObject* rootObject = this->rootObject();
+ if (!rootObject)
+ return jsUndefined();
+
+ bool handled = false;
+ if (rootObject->nativeHandle()) {
+ jobject obj = _instance->_instance;
+ JSValue exceptionDescription;
+ const char *callingURL = 0; // FIXME, need to propagate calling URL to Java
+ handled = dispatchJNICall(exec, rootObject->nativeHandle(), obj, jMethod->isStatic(), jMethod->JNIReturnType(), jMethod->methodID(obj), jArgs, result, callingURL, exceptionDescription);
+ if (exceptionDescription) {
+ throwError(exec, GeneralError, exceptionDescription.toString(exec));
+ free (jArgs);
+ return jsUndefined();
+ }
+ }
+
+ // The following code can be conditionally removed once we have a Tiger update that
+ // contains the new Java plugin. It is needed for builds prior to Tiger.
+ if (!handled) {
+ jobject obj = _instance->_instance;
+ switch (jMethod->JNIReturnType()){
+ case void_type:
+ callJNIMethodIDA<void>(obj, jMethod->methodID(obj), jArgs);
+ break;
+ case object_type:
+ result.l = callJNIMethodIDA<jobject>(obj, jMethod->methodID(obj), jArgs);
+ break;
+ case boolean_type:
+ result.z = callJNIMethodIDA<jboolean>(obj, jMethod->methodID(obj), jArgs);
+ break;
+ case byte_type:
+ result.b = callJNIMethodIDA<jbyte>(obj, jMethod->methodID(obj), jArgs);
+ break;
+ case char_type:
+ result.c = callJNIMethodIDA<jchar>(obj, jMethod->methodID(obj), jArgs);
+ break;
+ case short_type:
+ result.s = callJNIMethodIDA<jshort>(obj, jMethod->methodID(obj), jArgs);
+ break;
+ case int_type:
+ result.i = callJNIMethodIDA<jint>(obj, jMethod->methodID(obj), jArgs);
+ break;
+
+ case long_type:
+ result.j = callJNIMethodIDA<jlong>(obj, jMethod->methodID(obj), jArgs);
+ break;
+ case float_type:
+ result.f = callJNIMethodIDA<jfloat>(obj, jMethod->methodID(obj), jArgs);
+ break;
+ case double_type:
+ result.d = callJNIMethodIDA<jdouble>(obj, jMethod->methodID(obj), jArgs);
+ break;
+ case invalid_type:
+ default:
+ break;
+ }
+ }
+
+ switch (jMethod->JNIReturnType()){
+ case void_type: {
+ resultValue = jsUndefined();
+ }
+ break;
+
+ case object_type: {
+ if (result.l != 0) {
+ const char *arrayType = jMethod->returnType();
+ if (arrayType[0] == '[') {
+ resultValue = JavaArray::convertJObjectToArray(exec, result.l, arrayType, rootObject);
+ }
+ else {
+ resultValue = JavaInstance::create(result.l, rootObject)->createRuntimeObject(exec);
+ }
+ }
+ else {
+ resultValue = jsUndefined();
+ }
+ }
+ break;
+
+ case boolean_type: {
+ resultValue = jsBoolean(result.z);
+ }
+ break;
+
+ case byte_type: {
+ resultValue = jsNumber(exec, result.b);
+ }
+ break;
+
+ case char_type: {
+ resultValue = jsNumber(exec, result.c);
+ }
+ break;
+
+ case short_type: {
+ resultValue = jsNumber(exec, result.s);
+ }
+ break;
+
+ case int_type: {
+ resultValue = jsNumber(exec, result.i);
+ }
+ break;
+
+ case long_type: {
+ resultValue = jsNumber(exec, result.j);
+ }
+ break;
+
+ case float_type: {
+ resultValue = jsNumber(exec, result.f);
+ }
+ break;
+
+ case double_type: {
+ resultValue = jsNumber(exec, result.d);
+ }
+ break;
+
+ case invalid_type:
+ default: {
+ resultValue = jsUndefined();
+ }
+ break;
+ }
+
+ free (jArgs);
+
+ return resultValue;
+}
+
+JSValue JavaInstance::defaultValue(ExecState* exec, PreferredPrimitiveType hint) const
+{
+ if (hint == PreferString)
+ return stringValue(exec);
+ if (hint == PreferNumber)
+ return numberValue(exec);
+ JavaClass *aClass = static_cast<JavaClass*>(getClass());
+ if (aClass->isStringClass())
+ return stringValue(exec);
+ if (aClass->isNumberClass())
+ return numberValue(exec);
+ if (aClass->isBooleanClass())
+ return booleanValue();
+ return valueOf(exec);
+}
+
+JSValue JavaInstance::valueOf(ExecState* exec) const
+{
+ return stringValue(exec);
+}
+
+JObjectWrapper::JObjectWrapper(jobject instance)
+: _refCount(0)
+{
+ assert (instance != 0);
+
+ // Cache the JNIEnv used to get the global ref for this java instanace.
+ // It'll be used to delete the reference.
+ _env = getJNIEnv();
+
+ _instance = _env->NewGlobalRef (instance);
+
+ JS_LOG ("new global ref %p for %p\n", _instance, instance);
+
+ if (_instance == NULL) {
+ fprintf (stderr, "%s: could not get GlobalRef for %p\n", __PRETTY_FUNCTION__, instance);
+ }
+}
+
+JObjectWrapper::~JObjectWrapper() {
+ JS_LOG ("deleting global ref %p\n", _instance);
+ _env->DeleteGlobalRef (_instance);
+}
+
+#endif // ENABLE(MAC_JAVA_BRIDGE)
diff --git a/WebCore/bridge/jni/jsc/JavaInstanceJSC.h b/WebCore/bridge/jni/jsc/JavaInstanceJSC.h
new file mode 100644
index 0000000..a9b83e3
--- /dev/null
+++ b/WebCore/bridge/jni/jsc/JavaInstanceJSC.h
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2003 Apple Computer, Inc. All rights reserved.
+ *
+ * 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 JavaInstanceJSC_h
+#define JavaInstanceJSC_h
+
+#if ENABLE(MAC_JAVA_BRIDGE)
+
+#include "runtime.h"
+#include "runtime_root.h"
+
+#include <JavaVM/jni.h>
+
+namespace JSC {
+
+namespace Bindings {
+
+class JavaClass;
+
+class JObjectWrapper
+{
+friend class RefPtr<JObjectWrapper>;
+friend class JavaArray;
+friend class JavaField;
+friend class JavaInstance;
+friend class JavaMethod;
+
+public:
+ jobject instance() const { return _instance; }
+ void setInstance(jobject instance) { _instance = instance; }
+
+protected:
+ JObjectWrapper(jobject instance);
+ ~JObjectWrapper();
+
+ void ref() { _refCount++; }
+ void deref()
+ {
+ if (--_refCount == 0)
+ delete this;
+ }
+
+ jobject _instance;
+
+private:
+ JNIEnv *_env;
+ unsigned int _refCount;
+};
+
+class JavaInstance : public Instance
+{
+public:
+ static PassRefPtr<JavaInstance> create(jobject instance, PassRefPtr<RootObject> rootObject)
+ {
+ return adoptRef(new JavaInstance(instance, rootObject));
+ }
+
+ ~JavaInstance();
+
+ virtual Class *getClass() const;
+
+ virtual JSValue valueOf(ExecState*) const;
+ virtual JSValue defaultValue(ExecState*, PreferredPrimitiveType) const;
+
+ virtual JSValue invokeMethod(ExecState* exec, const MethodList& method, const ArgList& args);
+
+ jobject javaInstance() const { return _instance->_instance; }
+
+ JSValue stringValue(ExecState*) const;
+ JSValue numberValue(ExecState*) const;
+ JSValue booleanValue() const;
+
+protected:
+ JavaInstance(jobject instance, PassRefPtr<RootObject>);
+ virtual void virtualBegin();
+ virtual void virtualEnd();
+
+ RefPtr<JObjectWrapper> _instance;
+ mutable JavaClass *_class;
+};
+
+} // namespace Bindings
+
+} // namespace JSC
+
+#endif // ENABLE(MAC_JAVA_BRIDGE)
+
+#endif // JavaInstanceJSC_h
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list