Diff
Modified: trunk/Source/WebCore/ChangeLog (104405 => 104406)
--- trunk/Source/WebCore/ChangeLog 2012-01-08 19:35:03 UTC (rev 104405)
+++ trunk/Source/WebCore/ChangeLog 2012-01-08 21:03:00 UTC (rev 104406)
@@ -1,3 +1,36 @@
+2012-01-08 Steve Block <[email protected]>
+
+ Remove V8-specific Java Bridge code
+ https://bugs.webkit.org/show_bug.cgi?id=75801
+
+ Reviewed by Darin Adler.
+
+ Also remove superfluous JSC and V8 guards, as the code is now used only
+ with JSC.
+
+ No new tests, removing dead code only.
+
+ * WebCore.gypi:
+ * bridge/jni/JNIUtility.cpp:
+ (JSC::Bindings::javaTypeFromClassName):
+ (JSC::Bindings::signatureFromJavaType):
+ (JSC::Bindings::getJNIField):
+ (JSC::Bindings::callJNIMethod):
+ * bridge/jni/JavaType.h:
+ * bridge/jni/jsc/JavaMethodJSC.cpp:
+ (appendClassName):
+ (JavaMethod::signature):
+ * bridge/jni/v8/JNIUtilityPrivate.cpp: Removed.
+ * bridge/jni/v8/JNIUtilityPrivate.h: Removed.
+ * bridge/jni/v8/JavaClassV8.h: Removed.
+ * bridge/jni/v8/JavaFieldV8.h: Removed.
+ * bridge/jni/v8/JavaInstanceV8.h: Removed.
+ * bridge/jni/v8/JavaMethodV8.h: Removed.
+ * bridge/jni/v8/JavaNPObjectV8.cpp: Removed.
+ * bridge/jni/v8/JavaNPObjectV8.h: Removed.
+ * bridge/jni/v8/JavaValueV8.h: Removed.
+ * bridge/jsc/BridgeJSC.h:
+
2012-01-08 Sheriff Bot <[email protected]>
Unreviewed, rolling out r104403.
Modified: trunk/Source/WebCore/WebCore.gypi (104405 => 104406)
--- trunk/Source/WebCore/WebCore.gypi 2012-01-08 19:35:03 UTC (rev 104405)
+++ trunk/Source/WebCore/WebCore.gypi 2012-01-08 21:03:00 UTC (rev 104406)
@@ -2326,15 +2326,6 @@
'bridge/jni/jsc/JavaRuntimeObject.cpp',
'bridge/jni/jsc/JavaRuntimeObject.h',
'bridge/jni/jsc/JavaStringJSC.h',
- 'bridge/jni/v8/JNIUtilityPrivate.cpp',
- 'bridge/jni/v8/JNIUtilityPrivate.h',
- 'bridge/jni/v8/JavaClassV8.h',
- 'bridge/jni/v8/JavaFieldV8.h',
- 'bridge/jni/v8/JavaInstanceV8.h',
- 'bridge/jni/v8/JavaMethodV8.h',
- 'bridge/jni/v8/JavaNPObjectV8.cpp',
- 'bridge/jni/v8/JavaNPObjectV8.h',
- 'bridge/jni/v8/JavaValueV8.h',
'bridge/jsc/BridgeJSC.cpp',
'bridge/npruntime.cpp',
'bridge/npruntime_priv.h',
Modified: trunk/Source/WebCore/bridge/jni/JNIUtility.cpp (104405 => 104406)
--- trunk/Source/WebCore/bridge/jni/JNIUtility.cpp 2012-01-08 19:35:03 UTC (rev 104405)
+++ trunk/Source/WebCore/bridge/jni/JNIUtility.cpp 2012-01-08 21:03:00 UTC (rev 104406)
@@ -187,10 +187,6 @@
type = JavaTypeVoid;
else if ('[' == name[0])
type = JavaTypeArray;
-#if USE(V8)
- else if (!strcmp("java.lang.String", name))
- type = JavaTypeString;
-#endif
else
type = JavaTypeObject;
@@ -207,9 +203,6 @@
return "[";
case JavaTypeObject:
-#if USE(V8)
- case JavaTypeString:
-#endif
return "L";
case JavaTypeBoolean:
@@ -300,9 +293,6 @@
switch (type) {
case JavaTypeArray:
case JavaTypeObject:
-#if USE(V8)
- case JavaTypeString:
-#endif
result.l = env->functions->GetObjectField(env, obj, field);
break;
case JavaTypeBoolean:
@@ -356,9 +346,6 @@
callJNIMethodIDA<void>(object, methodId, args);
break;
case JavaTypeObject:
-#if USE(V8)
- case JavaTypeString:
-#endif
result.l = callJNIMethodIDA<jobject>(object, methodId, args);
break;
case JavaTypeBoolean:
Modified: trunk/Source/WebCore/bridge/jni/JavaType.h (104405 => 104406)
--- trunk/Source/WebCore/bridge/jni/JavaType.h 2012-01-08 19:35:03 UTC (rev 104405)
+++ trunk/Source/WebCore/bridge/jni/JavaType.h 2012-01-08 21:03:00 UTC (rev 104406)
@@ -53,20 +53,6 @@
JavaTypeFloat,
JavaTypeDouble,
JavaTypeArray,
-#if USE(V8)
- // JavaTypeString is distinct from JavaTypeObject because strings receive
- // special handling when we convert to and from _javascript_. When calling
- // Java methods, we must create Java String objects for string arguments.
- // However, at conversion time we cannot assume that the mechanism used to
- // interact with Java is JNI. Instead we use a special JavaTypeString.
- // Implementations of JavaInstance which use JNI will create a Java String
- // object when converting the JavaValue to a jvalue.
- //
- // Note that this type is independent of the _javascript_ engine, but is
- // currently used only with V8.
- // See https://bugs.webkit.org/show_bug.cgi?id=57023.
- JavaTypeString,
-#endif
};
} // namespace Bindings
Modified: trunk/Source/WebCore/bridge/jni/jsc/JavaMethodJSC.cpp (104405 => 104406)
--- trunk/Source/WebCore/bridge/jni/jsc/JavaMethodJSC.cpp 2012-01-08 19:35:03 UTC (rev 104405)
+++ trunk/Source/WebCore/bridge/jni/jsc/JavaMethodJSC.cpp 2012-01-08 21:03:00 UTC (rev 104406)
@@ -92,9 +92,7 @@
// we get '.' between components from the reflection API.
static void appendClassName(StringBuilder& builder, const char* className)
{
-#if USE(JSC)
ASSERT(JSLock::lockCount() > 0);
-#endif
char* c = fastStrDup(className);
@@ -113,9 +111,7 @@
const char* JavaMethod::signature() const
{
if (!m_signature) {
-#if USE(JSC)
JSLock lock(SilenceAssertionsOnly);
-#endif
StringBuilder signatureBuilder;
signatureBuilder.append('(');
@@ -126,11 +122,7 @@
appendClassName(signatureBuilder, javaClassName.data());
else {
signatureBuilder.append(signatureFromJavaType(type));
- if (type == JavaTypeObject
-#if USE(V8)
- || type == JavaTypeString
-#endif
- ) {
+ if (type == JavaTypeObject) {
appendClassName(signatureBuilder, javaClassName.data());
signatureBuilder.append(';');
}
@@ -143,11 +135,7 @@
appendClassName(signatureBuilder, returnType);
else {
signatureBuilder.append(signatureFromJavaType(m_returnType));
- if (m_returnType == JavaTypeObject
-#if USE(V8)
- || m_returnType == JavaTypeString
-#endif
- ) {
+ if (m_returnType == JavaTypeObject) {
appendClassName(signatureBuilder, returnType);
signatureBuilder.append(';');
}
Deleted: trunk/Source/WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp (104405 => 104406)
--- trunk/Source/WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp 2012-01-08 19:35:03 UTC (rev 104405)
+++ trunk/Source/WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp 2012-01-08 21:03:00 UTC (rev 104406)
@@ -1,241 +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:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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 THE COPYRIGHT HOLDERS ``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 THE COPYRIGHT OWNER 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 "JNIUtilityPrivate.h"
-
-#if ENABLE(JAVA_BRIDGE)
-
-#include "JavaInstanceV8.h"
-#include "JavaNPObjectV8.h"
-#include "JavaValueV8.h"
-#include <wtf/text/CString.h>
-
-namespace JSC {
-
-namespace Bindings {
-
-JavaValue convertNPVariantToJavaValue(NPVariant value, const String& javaClass)
-{
- CString javaClassName = javaClass.utf8();
- JavaType javaType = javaTypeFromClassName(javaClassName.data());
- JavaValue result;
- result.m_type = javaType;
- NPVariantType type = value.type;
-
- switch (javaType) {
- case JavaTypeArray:
- case JavaTypeObject:
- {
- // See if we have a Java instance.
- if (type == NPVariantType_Object) {
- NPObject* objectImp = NPVARIANT_TO_OBJECT(value);
- result.m_objectValue = ExtractJavaInstance(objectImp);
- }
- }
- break;
-
- case JavaTypeString:
- {
-#ifdef CONVERT_NULL_TO_EMPTY_STRING
- if (type == NPVariantType_Null) {
- result.m_type = JavaTypeString;
- result.m_stringValue = String::fromUTF8("");
- } else
-#else
- if (type == NPVariantType_String)
-#endif
- {
- NPString src = ""
- result.m_type = JavaTypeString;
- result.m_stringValue = String::fromUTF8(src.UTF8Characters);
- }
- }
- break;
-
- case JavaTypeBoolean:
- {
- if (type == NPVariantType_Bool)
- result.m_booleanValue = NPVARIANT_TO_BOOLEAN(value);
- }
- break;
-
- case JavaTypeByte:
- {
- if (type == NPVariantType_Int32)
- result.m_byteValue = static_cast<signed char>(NPVARIANT_TO_INT32(value));
- else if (type == NPVariantType_Double)
- result.m_byteValue = static_cast<signed char>(NPVARIANT_TO_DOUBLE(value));
- }
- break;
-
- case JavaTypeChar:
- {
- if (type == NPVariantType_Int32)
- result.m_charValue = static_cast<unsigned short>(NPVARIANT_TO_INT32(value));
- }
- break;
-
- case JavaTypeShort:
- {
- if (type == NPVariantType_Int32)
- result.m_shortValue = static_cast<short>(NPVARIANT_TO_INT32(value));
- else if (type == NPVariantType_Double)
- result.m_shortValue = static_cast<short>(NPVARIANT_TO_DOUBLE(value));
- }
- break;
-
- case JavaTypeInt:
- {
- if (type == NPVariantType_Int32)
- result.m_intValue = static_cast<int>(NPVARIANT_TO_INT32(value));
- else if (type == NPVariantType_Double)
- result.m_intValue = static_cast<int>(NPVARIANT_TO_DOUBLE(value));
- }
- break;
-
- case JavaTypeLong:
- {
- if (type == NPVariantType_Int32)
- result.m_longValue = static_cast<long long>(NPVARIANT_TO_INT32(value));
- else if (type == NPVariantType_Double)
- result.m_longValue = static_cast<long long>(NPVARIANT_TO_DOUBLE(value));
- }
- break;
-
- case JavaTypeFloat:
- {
- if (type == NPVariantType_Int32)
- result.m_floatValue = static_cast<float>(NPVARIANT_TO_INT32(value));
- else if (type == NPVariantType_Double)
- result.m_floatValue = static_cast<float>(NPVARIANT_TO_DOUBLE(value));
- }
- break;
-
- case JavaTypeDouble:
- {
- if (type == NPVariantType_Int32)
- result.m_doubleValue = static_cast<double>(NPVARIANT_TO_INT32(value));
- else if (type == NPVariantType_Double)
- result.m_doubleValue = static_cast<double>(NPVARIANT_TO_DOUBLE(value));
- }
- break;
- default:
- break;
- }
- return result;
-}
-
-
-void convertJavaValueToNPVariant(JavaValue value, NPVariant* result)
-{
- switch (value.m_type) {
- case JavaTypeVoid:
- {
- VOID_TO_NPVARIANT(*result);
- }
- break;
-
- case JavaTypeObject:
- {
- // If the JavaValue is a String object, it should have type JavaTypeString.
- if (value.m_objectValue)
- OBJECT_TO_NPVARIANT(JavaInstanceToNPObject(value.m_objectValue.get()), *result);
- else
- VOID_TO_NPVARIANT(*result);
- }
- break;
-
- case JavaTypeString:
- {
- const char* utf8String = strdup(value.m_stringValue.utf8().data());
- // The copied string is freed in NPN_ReleaseVariantValue (see npruntime.cpp)
- STRINGZ_TO_NPVARIANT(utf8String, *result);
- }
- break;
-
- case JavaTypeBoolean:
- {
- BOOLEAN_TO_NPVARIANT(value.m_booleanValue, *result);
- }
- break;
-
- case JavaTypeByte:
- {
- INT32_TO_NPVARIANT(value.m_byteValue, *result);
- }
- break;
-
- case JavaTypeChar:
- {
- INT32_TO_NPVARIANT(value.m_charValue, *result);
- }
- break;
-
- case JavaTypeShort:
- {
- INT32_TO_NPVARIANT(value.m_shortValue, *result);
- }
- break;
-
- case JavaTypeInt:
- {
- INT32_TO_NPVARIANT(value.m_intValue, *result);
- }
- break;
-
- // TODO: Check if cast to double is needed.
- case JavaTypeLong:
- {
- DOUBLE_TO_NPVARIANT(value.m_longValue, *result);
- }
- break;
-
- case JavaTypeFloat:
- {
- DOUBLE_TO_NPVARIANT(value.m_floatValue, *result);
- }
- break;
-
- case JavaTypeDouble:
- {
- DOUBLE_TO_NPVARIANT(value.m_doubleValue, *result);
- }
- break;
-
- case JavaTypeInvalid:
- default:
- {
- VOID_TO_NPVARIANT(*result);
- }
- break;
- }
-}
-
-} // namespace Bindings
-
-} // namespace JSC
-
-#endif // ENABLE(JAVA_BRIDGE)
Deleted: trunk/Source/WebCore/bridge/jni/v8/JNIUtilityPrivate.h (104405 => 104406)
--- trunk/Source/WebCore/bridge/jni/v8/JNIUtilityPrivate.h 2012-01-08 19:35:03 UTC (rev 104405)
+++ trunk/Source/WebCore/bridge/jni/v8/JNIUtilityPrivate.h 2012-01-08 21:03:00 UTC (rev 104406)
@@ -1,50 +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:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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 THE COPYRIGHT HOLDERS ``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 THE COPYRIGHT OWNER 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 JNIUtilityPrivate_h
-#define JNIUtilityPrivate_h
-
-#if ENABLE(JAVA_BRIDGE)
-
-#include "JNIUtility.h"
-#include "npruntime.h"
-#include <wtf/text/WTFString.h>
-
-namespace JSC {
-
-namespace Bindings {
-
-class JavaValue;
-
-JavaValue convertNPVariantToJavaValue(NPVariant, const String& javaClass);
-void convertJavaValueToNPVariant(JavaValue, NPVariant*);
-
-} // namespace Bindings
-
-} // namespace JSC
-
-#endif // ENABLE(JAVA_BRIDGE)
-
-#endif // JNIUtilityPrivate_h
Deleted: trunk/Source/WebCore/bridge/jni/v8/JavaClassV8.h (104405 => 104406)
--- trunk/Source/WebCore/bridge/jni/v8/JavaClassV8.h 2012-01-08 19:35:03 UTC (rev 104405)
+++ trunk/Source/WebCore/bridge/jni/v8/JavaClassV8.h 2012-01-08 21:03:00 UTC (rev 104406)
@@ -1,60 +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:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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 THE COPYRIGHT HOLDERS ``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 THE COPYRIGHT OWNER 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 JavaClassV8_h
-#define JavaClassV8_h
-
-#if ENABLE(JAVA_BRIDGE)
-
-#include <wtf/HashMap.h>
-#include <wtf/Vector.h>
-#include <wtf/text/StringHash.h>
-#include <wtf/text/WTFString.h>
-
-namespace JSC {
-
-namespace Bindings {
-
-class JavaField;
-class JavaMethod;
-
-typedef Vector<JavaMethod*> MethodList;
-typedef HashMap<WTF::String, JavaField*> FieldMap;
-
-class JavaClass {
-public:
- virtual ~JavaClass() {}
-
- virtual MethodList methodsNamed(const char* name) const = 0;
- virtual JavaField* fieldNamed(const char* name) const = 0;
-};
-
-} // namespace Bindings
-
-} // namespace JSC
-
-#endif // ENABLE(JAVA_BRIDGE)
-
-#endif // JavaClassV8_h
Deleted: trunk/Source/WebCore/bridge/jni/v8/JavaFieldV8.h (104405 => 104406)
--- trunk/Source/WebCore/bridge/jni/v8/JavaFieldV8.h 2012-01-08 19:35:03 UTC (rev 104405)
+++ trunk/Source/WebCore/bridge/jni/v8/JavaFieldV8.h 2012-01-08 21:03:00 UTC (rev 104406)
@@ -1,51 +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:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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 THE COPYRIGHT HOLDERS ``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 THE COPYRIGHT OWNER 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 JavaFieldV8_h
-#define JavaFieldV8_h
-
-#if ENABLE(JAVA_BRIDGE)
-
-#include "JNIUtility.h"
-#include <wtf/text/WTFString.h>
-
-namespace JSC {
-
-namespace Bindings {
-
-class JavaField {
-public:
- virtual ~JavaField() {}
-
- virtual String name() const = 0;
-};
-
-} // namespace Bindings
-
-} // namespace JSC
-
-#endif // ENABLE(JAVA_BRIDGE)
-
-#endif // JavaFieldV8_h
Deleted: trunk/Source/WebCore/bridge/jni/v8/JavaInstanceV8.h (104405 => 104406)
--- trunk/Source/WebCore/bridge/jni/v8/JavaInstanceV8.h 2012-01-08 19:35:03 UTC (rev 104405)
+++ trunk/Source/WebCore/bridge/jni/v8/JavaInstanceV8.h 2012-01-08 21:03:00 UTC (rev 104406)
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2003, 2008, 2010 Apple Inc. All rights reserved.
- * 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:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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 THE COPYRIGHT HOLDERS ``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 THE COPYRIGHT OWNER 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 JavaInstanceV8_h
-#define JavaInstanceV8_h
-
-#if ENABLE(JAVA_BRIDGE)
-
-#include "JavaValueV8.h"
-#include <wtf/RefCounted.h>
-
-using namespace WTF;
-
-namespace JSC {
-
-namespace Bindings {
-
-class JavaClass;
-class JavaField;
-class JavaMethod;
-
-class JavaInstance : public RefCounted<JavaInstance> {
-public:
- virtual ~JavaInstance() {}
-
- virtual JavaClass* getClass() const = 0;
- // args must be an array of length greater than or equal to the number of
- // arguments expected by the method.
- virtual JavaValue invokeMethod(const JavaMethod&, JavaValue* args) = 0;
- virtual JavaValue getField(const JavaField&) = 0;
-};
-
-} // namespace Bindings
-
-} // namespace JSC
-
-#endif // ENABLE(JAVA_BRIDGE)
-
-#endif // JavaInstanceV8_h
Deleted: trunk/Source/WebCore/bridge/jni/v8/JavaMethodV8.h (104405 => 104406)
--- trunk/Source/WebCore/bridge/jni/v8/JavaMethodV8.h 2012-01-08 19:35:03 UTC (rev 104405)
+++ trunk/Source/WebCore/bridge/jni/v8/JavaMethodV8.h 2012-01-08 21:03:00 UTC (rev 104406)
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2003, 2004, 2005, 2007, 2009, 2010 Apple Inc. All rights reserved.
- * 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 JavaMethodV8_h
-#define JavaMethodV8_h
-
-#if ENABLE(JAVA_BRIDGE)
-
-#include "Bridge.h"
-#include "JavaType.h"
-
-#include <wtf/text/WTFString.h>
-
-namespace JSC {
-
-namespace Bindings {
-
-typedef const char* RuntimeType;
-
-class JavaMethod : public Method {
-public:
- virtual ~JavaMethod() { }
-
- virtual String name() const = 0;
- virtual String parameterAt(int) const = 0;
-};
-
-} // namespace Bindings
-
-} // namespace JSC
-
-#endif // ENABLE(JAVA_BRIDGE)
-
-#endif // JavaMethodV8_h
Deleted: trunk/Source/WebCore/bridge/jni/v8/JavaNPObjectV8.cpp (104405 => 104406)
--- trunk/Source/WebCore/bridge/jni/v8/JavaNPObjectV8.cpp 2012-01-08 19:35:03 UTC (rev 104405)
+++ trunk/Source/WebCore/bridge/jni/v8/JavaNPObjectV8.cpp 2012-01-08 21:03:00 UTC (rev 104406)
@@ -1,190 +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:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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 THE COPYRIGHT HOLDERS ``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 THE COPYRIGHT OWNER 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 "JavaNPObjectV8.h"
-
-#if ENABLE(JAVA_BRIDGE)
-
-#include "JNIUtilityPrivate.h"
-#include "JavaClassV8.h"
-#include "JavaFieldV8.h"
-#include "JavaInstanceV8.h"
-#include "JavaMethodV8.h"
-#include "JavaValueV8.h"
-#include "npruntime_impl.h"
-
-namespace JSC {
-
-namespace Bindings {
-
-static NPObject* AllocJavaNPObject(NPP, NPClass*)
-{
- JavaNPObject* obj = static_cast<JavaNPObject*>(malloc(sizeof(JavaNPObject)));
- if (!obj)
- return 0;
- memset(obj, 0, sizeof(JavaNPObject));
- return reinterpret_cast<NPObject*>(obj);
-}
-
-static void FreeJavaNPObject(NPObject* npobj)
-{
- JavaNPObject* obj = reinterpret_cast<JavaNPObject*>(npobj);
- obj->m_instance = 0; // free does not call the destructor
- free(obj);
-}
-
-static NPClass JavaNPObjectClass = {
- NP_CLASS_STRUCT_VERSION,
- AllocJavaNPObject, // allocate,
- FreeJavaNPObject, // free,
- 0, // invalidate
- JavaNPObjectHasMethod,
- JavaNPObjectInvoke,
- 0, // invokeDefault,
- JavaNPObjectHasProperty,
- JavaNPObjectGetProperty,
- 0, // setProperty
- 0, // removeProperty
- 0, // enumerate
- 0 // construct
-};
-
-NPObject* JavaInstanceToNPObject(JavaInstance* instance)
-{
- JavaNPObject* object = reinterpret_cast<JavaNPObject*>(_NPN_CreateObject(0, &JavaNPObjectClass));
- object->m_instance = instance;
- return reinterpret_cast<NPObject*>(object);
-}
-
-// Returns null if obj is not a wrapper of JavaInstance
-JavaInstance* ExtractJavaInstance(NPObject* obj)
-{
- if (obj->_class == &JavaNPObjectClass)
- return reinterpret_cast<JavaNPObject*>(obj)->m_instance.get();
- return 0;
-}
-
-bool JavaNPObjectHasMethod(NPObject* obj, NPIdentifier identifier)
-{
- JavaInstance* instance = ExtractJavaInstance(obj);
- if (!instance)
- return false;
- NPUTF8* name = _NPN_UTF8FromIdentifier(identifier);
- if (!name)
- return false;
-
- bool result = (instance->getClass()->methodsNamed(name).size() > 0);
-
- // TODO: use NPN_MemFree
- free(name);
-
- return result;
-}
-
-bool JavaNPObjectInvoke(NPObject* obj, NPIdentifier identifier, const NPVariant* args, uint32_t argCount, NPVariant* result)
-{
- JavaInstance* instance = ExtractJavaInstance(obj);
- if (!instance)
- return false;
- NPUTF8* name = _NPN_UTF8FromIdentifier(identifier);
- if (!name)
- return false;
-
- MethodList methodList = instance->getClass()->methodsNamed(name);
- // TODO: use NPN_MemFree
- free(name);
-
- // Try to find a good match for the overloaded method. The
- // fundamental problem is that _javascript_ doesn't have the
- // notion of method overloading and Java does. We could
- // get a bit more sophisticated and attempt to do some
- // type checking as well as checking the number of parameters.
- size_t numMethods = methodList.size();
- JavaMethod* aMethod;
- JavaMethod* jMethod = 0;
- for (size_t methodIndex = 0; methodIndex < numMethods; methodIndex++) {
- aMethod = methodList[methodIndex];
- if (aMethod->numParameters() == static_cast<int>(argCount)) {
- jMethod = aMethod;
- break;
- }
- }
- if (!jMethod)
- return false;
-
- JavaValue* jArgs = new JavaValue[argCount];
- for (unsigned int i = 0; i < argCount; i++)
- jArgs[i] = convertNPVariantToJavaValue(args[i], jMethod->parameterAt(i));
-
- JavaValue jResult = instance->invokeMethod(*jMethod, jArgs);
- delete[] jArgs;
-
- VOID_TO_NPVARIANT(*result);
- convertJavaValueToNPVariant(jResult, result);
- return true;
-}
-
-bool JavaNPObjectHasProperty(NPObject* obj, NPIdentifier identifier)
-{
- JavaInstance* instance = ExtractJavaInstance(obj);
- if (!instance)
- return false;
- NPUTF8* name = _NPN_UTF8FromIdentifier(identifier);
- if (!name)
- return false;
- bool result = instance->getClass()->fieldNamed(name);
- free(name);
- return result;
-}
-
-bool JavaNPObjectGetProperty(NPObject* obj, NPIdentifier identifier, NPVariant* result)
-{
- VOID_TO_NPVARIANT(*result);
- JavaInstance* instance = ExtractJavaInstance(obj);
- if (!instance)
- return false;
- NPUTF8* name = _NPN_UTF8FromIdentifier(identifier);
- if (!name)
- return false;
-
- JavaField* field = instance->getClass()->fieldNamed(name);
- free(name); // TODO: use NPN_MemFree
- if (!field)
- return false;
-
- JavaValue value = instance->getField(*field);
-
- convertJavaValueToNPVariant(value, result);
-
- return true;
-}
-
-} // namespace Bindings
-
-} // namespace JSC
-
-#endif // ENABLE(JAVA_BRIDGE)
Deleted: trunk/Source/WebCore/bridge/jni/v8/JavaNPObjectV8.h (104405 => 104406)
--- trunk/Source/WebCore/bridge/jni/v8/JavaNPObjectV8.h 2012-01-08 19:35:03 UTC (rev 104405)
+++ trunk/Source/WebCore/bridge/jni/v8/JavaNPObjectV8.h 2012-01-08 21:03:00 UTC (rev 104406)
@@ -1,60 +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:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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 THE COPYRIGHT HOLDERS ``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 THE COPYRIGHT OWNER 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 JavaNPObjectV8_h
-#define JavaNPObjectV8_h
-
-#if ENABLE(JAVA_BRIDGE)
-
-#include "npruntime.h"
-#include <wtf/RefPtr.h>
-
-
-namespace JSC {
-
-namespace Bindings {
-
-class JavaInstance;
-
-struct JavaNPObject {
- NPObject m_object;
- RefPtr<JavaInstance> m_instance;
-};
-
-NPObject* JavaInstanceToNPObject(JavaInstance*);
-JavaInstance* ExtractJavaInstance(NPObject*);
-
-bool JavaNPObjectHasMethod(NPObject*, NPIdentifier name);
-bool JavaNPObjectInvoke(NPObject*, NPIdentifier methodName, const NPVariant* args, uint32_t argCount, NPVariant* result);
-bool JavaNPObjectHasProperty(NPObject*, NPIdentifier name);
-bool JavaNPObjectGetProperty(NPObject*, NPIdentifier name, NPVariant* result);
-
-} // namespace Bindings
-
-} // namespace JSC
-
-#endif // ENABLE(JAVA_BRIDGE)
-
-#endif // JavaNPObjectV8_h
Deleted: trunk/Source/WebCore/bridge/jni/v8/JavaValueV8.h (104405 => 104406)
--- trunk/Source/WebCore/bridge/jni/v8/JavaValueV8.h 2012-01-08 19:35:03 UTC (rev 104405)
+++ trunk/Source/WebCore/bridge/jni/v8/JavaValueV8.h 2012-01-08 21:03:00 UTC (rev 104406)
@@ -1,75 +0,0 @@
-/*
- * Copyright 2011, 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 THE COPYRIGHT HOLDERS ``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 THE COPYRIGHT OWNER 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 JavaValueV8_h
-#define JavaValueV8_h
-
-#if ENABLE(JAVA_BRIDGE)
-
-#include "JavaType.h"
-
-#include <wtf/text/WTFString.h>
-
-namespace JSC {
-
-namespace Bindings {
-
-class JavaInstance;
-
-// A variant used to represent a Java value, almost identical to the JNI
-// jvalue type. It exists because the logic to convert between _javascript_
-// objects (as JavaNPObject or JSValue) and Java objects should not depend upon
-// JNI, to allow ports to provide a JavaInstance object etc which does not use
-// JNI. This means that the 'object' field of this variant uses JavaInstance,
-// not jobject.
-//
-// Note that this class is independent of the _javascript_ engine, but is
-// currently used only with V8.
-// See https://bugs.webkit.org/show_bug.cgi?id=57023.
-struct JavaValue {
- JavaValue() : m_type(JavaTypeInvalid) {}
-
- JavaType m_type;
- // We don't use a union because we want to be able to ref-count some of the
- // values. This requires types with non-trivial constructors.
- RefPtr<JavaInstance> m_objectValue;
- bool m_booleanValue;
- signed char m_byteValue;
- unsigned short m_charValue;
- short m_shortValue;
- int m_intValue;
- long long m_longValue;
- float m_floatValue;
- double m_doubleValue;
- String m_stringValue;
-};
-
-} // namespace Bindings
-
-} // namespace JSC
-
-#endif // ENABLE(JAVA_BRIDGE)
-
-#endif // JavaValueV8_h
Modified: trunk/Source/WebCore/bridge/jsc/BridgeJSC.h (104405 => 104406)
--- trunk/Source/WebCore/bridge/jsc/BridgeJSC.h 2012-01-08 19:35:03 UTC (rev 104405)
+++ trunk/Source/WebCore/bridge/jsc/BridgeJSC.h 2012-01-08 21:03:00 UTC (rev 104406)
@@ -27,8 +27,6 @@
#ifndef BridgeJSC_h
#define BridgeJSC_h
-#if USE(JSC)
-
#include "Bridge.h"
#include <runtime/JSString.h>
#include <wtf/HashMap.h>
@@ -151,6 +149,4 @@
} // namespace JSC
-#endif // USE(JSC)
-
#endif