[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9

steveblock at google.com steveblock at google.com
Thu Feb 4 21:23:08 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit cc8cd997724b9dda33b4fadb767f46e892b61e66
Author: steveblock at google.com <steveblock at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jan 21 11:52:40 2010 +0000

    Move bridge interfaces Field, Class, Instance and Array from Bridge to BridgeJSC
    https://bugs.webkit.org/show_bug.cgi?id=33589
    
    Reviewed by David Levin.
    
    These interfaces use JSC-specific types, so are moved out of Bridge.h to allow the file to
    be used with both JSC and V8.
    
    No new tests, refactoring only.
    
    * Android.jscbindings.mk: Modified. Removed Bridge.cpp and added BridgeJSC.cpp
    * GNUmakefile.am: Modified. Removed Bridge.cpp and added BridgeJSC.[cpp|h]
    * WebCore.pro: Modified. Removed Bridge.cpp and added BridgeJSC.[cpp|h]
    * WebCore.xcodeproj/project.pbxproj: Modified. Removed Bridge.cpp and added BridgeJSC.[cpp|h]
    * WebCoreSources.bkl: Modified. Removed Bridge.cpp and added BridgeJSC.cpp
    * bridge/Bridge.cpp: Removed.
    * bridge/Bridge.h: Modfied. Moved Field, Class, Instance and Array interfaces to BridgeJSC.h
    * bridge/jsc: Added.
    * bridge/jsc/BridgeJSC.cpp: Copied from WebCore/bridge/Bridge.cpp.
    * bridge/jsc/BridgeJSC.h: Copied from WebCore/bridge/Bridge.h.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53620 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/Android.jscbindings.mk b/WebCore/Android.jscbindings.mk
index 1039a28..cdbd98d 100644
--- a/WebCore/Android.jscbindings.mk
+++ b/WebCore/Android.jscbindings.mk
@@ -29,6 +29,7 @@ BINDING_C_INCLUDES := \
 	$(LOCAL_PATH)/bridge/c \
 	$(LOCAL_PATH)/bridge/jni \
 	$(LOCAL_PATH)/bridge/jni/jsc \
+	$(LOCAL_PATH)/bridge/jsc \
 	\
 	$(JAVASCRIPTCORE_PATH)/API \
 	$(JAVASCRIPTCORE_PATH)/assembler \
@@ -177,7 +178,6 @@ LOCAL_SRC_FILES += \
 	\
 	bindings/ScriptControllerBase.cpp \
 	\
-	bridge/Bridge.cpp \
 	bridge/IdentifierRep.cpp \
 	bridge/NP_jsobject.cpp \
 	bridge/c/c_class.cpp \
@@ -189,6 +189,7 @@ LOCAL_SRC_FILES += \
 	bridge/jni/jsc/JNIUtilityPrivate.cpp \
 	bridge/jni/jsc/JavaClassJSC.cpp \
 	bridge/jni/jsc/JavaInstanceJSC.cpp \
+	bridge/jsc/BridgeJSC.cpp \
 	bridge/npruntime.cpp \
 	bridge/runtime_array.cpp \
 	bridge/runtime_method.cpp \
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 08969f2..f5a496c 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -2,6 +2,29 @@
 
         Reviewed by David Levin.
 
+        Move bridge interfaces Field, Class, Instance and Array from Bridge to BridgeJSC
+        https://bugs.webkit.org/show_bug.cgi?id=33589
+
+        These interfaces use JSC-specific types, so are moved out of Bridge.h to allow the file to
+        be used with both JSC and V8.
+
+        No new tests, refactoring only.
+
+        * Android.jscbindings.mk: Modified. Removed Bridge.cpp and added BridgeJSC.cpp
+        * GNUmakefile.am: Modified. Removed Bridge.cpp and added BridgeJSC.[cpp|h]
+        * WebCore.pro: Modified. Removed Bridge.cpp and added BridgeJSC.[cpp|h]
+        * WebCore.xcodeproj/project.pbxproj: Modified. Removed Bridge.cpp and added BridgeJSC.[cpp|h]
+        * WebCoreSources.bkl: Modified. Removed Bridge.cpp and added BridgeJSC.cpp
+        * bridge/Bridge.cpp: Removed.
+        * bridge/Bridge.h: Modfied. Moved Field, Class, Instance and Array interfaces to BridgeJSC.h
+        * bridge/jsc: Added.
+        * bridge/jsc/BridgeJSC.cpp: Copied from WebCore/bridge/Bridge.cpp.
+        * bridge/jsc/BridgeJSC.h: Copied from WebCore/bridge/Bridge.h.
+
+2010-01-21  Steve Block  <steveblock at google.com>
+
+        Reviewed by David Levin.
+
         Fixes style in WebCore/bridge/jni/JNIBridge
         https://bugs.webkit.org/show_bug.cgi?id=33914
 
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index 796d4e5..2f8b89f 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -499,7 +499,6 @@ webcore_sources += \
 	WebCore/bindings/js/SerializedScriptValue.h \
 	WebCore/bindings/js/StringSourceProvider.h \
 	WebCore/bindings/ScriptControllerBase.cpp \
-	WebCore/bridge/Bridge.cpp \
 	WebCore/bridge/Bridge.h \
 	WebCore/bridge/IdentifierRep.cpp \
 	WebCore/bridge/IdentifierRep.h \
@@ -518,6 +517,8 @@ webcore_sources += \
 	WebCore/bridge/jni/jni_jsobject.h \
 	WebCore/bridge/jni/jsc/JavaClassJSC.h \
 	WebCore/bridge/jni/jsc/JavaInstanceJSC.h \
+	WebCore/bridge/jsc/BridgeJSC.h \
+	WebCore/bridge/jsc/BridgeJSC.cpp \
 	WebCore/bridge/npapi.h \
 	WebCore/bridge/npruntime.cpp \
 	WebCore/bridge/npruntime.h \
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index 445059d..bd8e4eb 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -343,7 +343,6 @@ SOURCES += \
     bindings/js/ScheduledAction.cpp \
     bindings/js/SerializedScriptValue.cpp \
     bindings/ScriptControllerBase.cpp \
-    bridge/Bridge.cpp \
     bridge/IdentifierRep.cpp \
     bridge/NP_jsobject.cpp \
     bridge/npruntime.cpp \
@@ -355,6 +354,7 @@ SOURCES += \
     bridge/c/c_instance.cpp \
     bridge/c/c_runtime.cpp \
     bridge/c/c_utility.cpp \
+    bridge/jsc/BridgeJSC.cpp \
     css/CSSBorderImageValue.cpp \
     css/CSSCanvasValue.cpp \
     css/CSSCharsetRule.cpp \
@@ -1036,6 +1036,7 @@ HEADERS += \
     bridge/c/c_instance.h \
     bridge/c/c_runtime.h \
     bridge/c/c_utility.h \
+    bridge/jsc/BridgeJSC.h \
     bridge/IdentifierRep.h \
     bridge/NP_jsobject.h \
     bridge/npruntime.h \
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 015d3b2..2a0ad3e 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -1119,9 +1119,10 @@
 		5913953B110758450083EC55 /* JNIBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 5913953A110758450083EC55 /* JNIBridge.h */; };
 		5913953D1107584E0083EC55 /* JNIBridge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5913953C1107584E0083EC55 /* JNIBridge.cpp */; };
 		599E759011055A1F00D904FA /* Bridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 599E758F11055A1F00D904FA /* Bridge.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		599E759211055A2A00D904FA /* Bridge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 599E759111055A2A00D904FA /* Bridge.cpp */; };
 		59A9E7B01104758800DFB4C1 /* JavaInstanceJSC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59A9E7AF1104758800DFB4C1 /* JavaInstanceJSC.cpp */; };
 		59A9E7B21104759400DFB4C1 /* JavaInstanceJSC.h in Headers */ = {isa = PBXBuildFile; fileRef = 59A9E7B11104759400DFB4C1 /* JavaInstanceJSC.h */; };
+		59B597731108656B007159E8 /* BridgeJSC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59B597721108656B007159E8 /* BridgeJSC.cpp */; };
+		59B5977511086579007159E8 /* BridgeJSC.h in Headers */ = {isa = PBXBuildFile; fileRef = 59B5977411086579007159E8 /* BridgeJSC.h */; };
 		59BC393F11054A1300FD85DB /* JavaStringJSC.h in Headers */ = {isa = PBXBuildFile; fileRef = 59BC393E11054A1300FD85DB /* JavaStringJSC.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, ); }; };
@@ -6493,9 +6494,10 @@
 		5913953A110758450083EC55 /* JNIBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JNIBridge.h; sourceTree = "<group>"; };
 		5913953C1107584E0083EC55 /* JNIBridge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JNIBridge.cpp; sourceTree = "<group>"; };
 		599E758F11055A1F00D904FA /* Bridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Bridge.h; path = bridge/Bridge.h; sourceTree = "<group>"; };
-		599E759111055A2A00D904FA /* Bridge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Bridge.cpp; path = bridge/Bridge.cpp; 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>"; };
+		59B597721108656B007159E8 /* BridgeJSC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BridgeJSC.cpp; path = bridge/jsc/BridgeJSC.cpp; sourceTree = "<group>"; };
+		59B5977411086579007159E8 /* BridgeJSC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BridgeJSC.h; path = bridge/jsc/BridgeJSC.h; sourceTree = "<group>"; };
 		59BC393E11054A1300FD85DB /* JavaStringJSC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JavaStringJSC.h; path = jsc/JavaStringJSC.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>"; };
@@ -10340,7 +10342,7 @@
 		1A569CC40D7E2B60007C3983 /* bridge */ = {
 			isa = PBXGroup;
 			children = (
-				599E759111055A2A00D904FA /* Bridge.cpp */,
+				59B5977111086556007159E8 /* jsc */,
 				599E758F11055A1F00D904FA /* Bridge.h */,
 				1A569CC50D7E2B82007C3983 /* c */,
 				1A569CCE0D7E2B82007C3983 /* jni */,
@@ -11116,6 +11118,15 @@
 			name = jsc;
 			sourceTree = "<group>";
 		};
+		59B5977111086556007159E8 /* jsc */ = {
+			isa = PBXGroup;
+			children = (
+				59B5977411086579007159E8 /* BridgeJSC.h */,
+				59B597721108656B007159E8 /* BridgeJSC.cpp */,
+			);
+			name = jsc;
+			sourceTree = "<group>";
+		};
 		59C77F101054591C00506104 /* mock */ = {
 			isa = PBXGroup;
 			children = (
@@ -18428,6 +18439,7 @@
 				2E2D99CE10E2BBDA00496337 /* JSBlob.h in Headers */,
 				2E2D99E710E2BC1C00496337 /* DOMBlob.h in Headers */,
 				2E2D99EA10E2BC3800496337 /* DOMBlobInternal.h in Headers */,
+				59B5977511086579007159E8 /* BridgeJSC.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -20591,7 +20603,6 @@
 				E15A36D91104572700B7B639 /* XMLNSNames.cpp in Sources */,
 				59A9E7B01104758800DFB4C1 /* JavaInstanceJSC.cpp in Sources */,
 				59E560A91105336F00AA1258 /* JavaClassJSC.cpp in Sources */,
-				599E759211055A2A00D904FA /* Bridge.cpp in Sources */,
 				59EE122C1106080500885116 /* JNIUtilityPrivate.cpp in Sources */,
 				59EE12301106081F00885116 /* JNIUtility.cpp in Sources */,
 				76CDD2F21103DA6600680521 /* AccessibilityMenuList.cpp in Sources */,
@@ -20601,6 +20612,7 @@
 				2EAFAF0E10E2AF2D007ED3D6 /* Blob.cpp in Sources */,
 				2E2D99CD10E2BBDA00496337 /* JSBlob.cpp in Sources */,
 				2E2D99E810E2BC1C00496337 /* DOMBlob.mm in Sources */,
+				59B597731108656B007159E8 /* BridgeJSC.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/WebCore/WebCoreSources.bkl b/WebCore/WebCoreSources.bkl
index 9e631be..43fb7e3 100644
--- a/WebCore/WebCoreSources.bkl
+++ b/WebCore/WebCoreSources.bkl
@@ -165,13 +165,13 @@ This file contains the list of files needed to build WebCore.
     </set>
 
     <set append="1" var="WEBCORE_SOURCES_BRIDGE">
-        bridge/Bridge.cpp
         bridge/IdentifierRep.cpp
         bridge/NP_jsobject.cpp
         bridge/c/c_class.cpp
         bridge/c/c_instance.cpp
         bridge/c/c_runtime.cpp
         bridge/c/c_utility.cpp
+        bridge/jsc/BridgeJSC.cpp
         bridge/npruntime.cpp
         bridge/runtime_array.cpp
         bridge/runtime_method.cpp
diff --git a/WebCore/bridge/Bridge.cpp b/WebCore/bridge/Bridge.cpp
deleted file mode 100644
index 2daf3eb..0000000
--- a/WebCore/bridge/Bridge.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (C) 2003, 2006, 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 "Bridge.h"
-
-#include "runtime_object.h"
-#include "runtime_root.h"
-#include <runtime/JSLock.h>
-
-#if PLATFORM(QT)
-#include "qt_instance.h"
-#endif
-
-namespace JSC {
-
-namespace Bindings {
-
-Array::Array(PassRefPtr<RootObject> rootObject)
-    : m_rootObject(rootObject)
-{
-    ASSERT(m_rootObject);
-}
-
-Array::~Array()
-{
-}
-
-Instance::Instance(PassRefPtr<RootObject> rootObject)
-    : m_rootObject(rootObject)
-    , m_runtimeObject(0)
-{
-    ASSERT(m_rootObject);
-}
-
-Instance::~Instance()
-{
-    ASSERT(!m_runtimeObject);
-}
-
-static KJSDidExecuteFunctionPtr s_didExecuteFunction;
-
-void Instance::setDidExecuteFunction(KJSDidExecuteFunctionPtr func)
-{
-    s_didExecuteFunction = func;
-}
-
-KJSDidExecuteFunctionPtr Instance::didExecuteFunction()
-{
-    return s_didExecuteFunction;
-}
-
-void Instance::begin()
-{
-    virtualBegin();
-}
-
-void Instance::end()
-{
-    virtualEnd();
-}
-
-RuntimeObjectImp* Instance::createRuntimeObject(ExecState* exec)
-{
-    ASSERT(m_rootObject);
-    ASSERT(m_rootObject->isValid());
-    if (m_runtimeObject)
-        return m_runtimeObject;
-    JSLock lock(SilenceAssertionsOnly);
-    m_runtimeObject = newRuntimeObject(exec);
-    m_rootObject->addRuntimeObject(m_runtimeObject);
-    return m_runtimeObject;
-}
-
-RuntimeObjectImp* Instance::newRuntimeObject(ExecState* exec)
-{
-    JSLock lock(SilenceAssertionsOnly);
-    return new (exec)RuntimeObjectImp(exec, this);
-}
-
-void Instance::willDestroyRuntimeObject()
-{
-    ASSERT(m_rootObject);
-    ASSERT(m_rootObject->isValid());
-    ASSERT(m_runtimeObject);
-    m_rootObject->removeRuntimeObject(m_runtimeObject);
-    m_runtimeObject = 0;
-}
-
-void Instance::willInvalidateRuntimeObject()
-{
-    ASSERT(m_runtimeObject);
-    m_runtimeObject = 0;
-}
-
-RootObject* Instance::rootObject() const
-{
-    return m_rootObject && m_rootObject->isValid() ? m_rootObject.get() : 0;
-}
-
-} // namespace Bindings
-
-} // namespace JSC
diff --git a/WebCore/bridge/Bridge.h b/WebCore/bridge/Bridge.h
index 71c72c3..d92cd15 100644
--- a/WebCore/bridge/Bridge.h
+++ b/WebCore/bridge/Bridge.h
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2003, 2008, 2009 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
@@ -26,35 +27,12 @@
 #ifndef Bridge_h
 #define Bridge_h
 
-#include <runtime/JSString.h>
-#include <wtf/HashMap.h>
-#include <wtf/RefCounted.h>
-#include <wtf/Vector.h>
+#include "BridgeJSC.h"
 
 namespace JSC  {
 
-class ArgList;
-class Identifier;
-class JSGlobalObject;
-class PropertyNameArray;
-class RuntimeObjectImp;
-
 namespace Bindings {
 
-class Instance;
-class Method;
-class RootObject;
-
-typedef Vector<Method*> MethodList;
-
-class Field {
-public:
-    virtual JSValue valueFromInstance(ExecState*, const Instance*) const = 0;
-    virtual void setValueToInstance(ExecState*, const Instance*, JSValue) const = 0;
-
-    virtual ~Field() { }
-};
-
 class Method : public Noncopyable {
 public:
     virtual int numParameters() const = 0;
@@ -62,90 +40,6 @@ public:
     virtual ~Method() { }
 };
 
-class Class : public Noncopyable {
-public:
-    virtual MethodList methodsNamed(const Identifier&, Instance*) const = 0;
-    virtual Field* fieldNamed(const Identifier&, Instance*) const = 0;
-    virtual JSValue fallbackObject(ExecState*, Instance*, const Identifier&) { return jsUndefined(); }
-
-    virtual ~Class() { }
-};
-
-typedef void (*KJSDidExecuteFunctionPtr)(ExecState*, JSObject* rootObject);
-
-class Instance : public RefCounted<Instance> {
-public:
-    Instance(PassRefPtr<RootObject>);
-
-    static void setDidExecuteFunction(KJSDidExecuteFunctionPtr func);
-    static KJSDidExecuteFunctionPtr didExecuteFunction();
-
-    // These functions are called before and after the main entry points into
-    // the native implementations.  They can be used to establish and cleanup
-    // any needed state.
-    void begin();
-    void end();
-
-    virtual Class* getClass() const = 0;
-    RuntimeObjectImp* createRuntimeObject(ExecState*);
-    void willInvalidateRuntimeObject();
-    void willDestroyRuntimeObject();
-
-    // Returns false if the value was not set successfully.
-    virtual bool setValueOfUndefinedField(ExecState*, const Identifier&, JSValue) { return false; }
-
-    virtual JSValue invokeMethod(ExecState*, const MethodList&, const ArgList& args) = 0;
-
-    virtual bool supportsInvokeDefaultMethod() const { return false; }
-    virtual JSValue invokeDefaultMethod(ExecState*, const ArgList&) { return jsUndefined(); }
-
-    virtual bool supportsConstruct() const { return false; }
-    virtual JSValue invokeConstruct(ExecState*, const ArgList&) { return JSValue(); }
-
-    virtual void getPropertyNames(ExecState*, PropertyNameArray&) { }
-
-    virtual JSValue defaultValue(ExecState*, PreferredPrimitiveType) const = 0;
-
-    virtual JSValue valueOf(ExecState* exec) const = 0;
-
-    RootObject* rootObject() const;
-
-    virtual ~Instance();
-
-    virtual bool getOwnPropertySlot(JSObject*, ExecState*, const Identifier&, PropertySlot&) { return false; }
-    virtual bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&) { return false; }
-    virtual void put(JSObject*, ExecState*, const Identifier&, JSValue, PutPropertySlot&) { }
-
-protected:
-    virtual void virtualBegin() { }
-    virtual void virtualEnd() { }
-    virtual RuntimeObjectImp* newRuntimeObject(ExecState*);
-
-    RefPtr<RootObject> m_rootObject;
-
-private:
-    RuntimeObjectImp* m_runtimeObject;
-};
-
-class Array : public Noncopyable {
-public:
-    Array(PassRefPtr<RootObject>);
-    virtual ~Array();
-
-    virtual void setValueAt(ExecState*, unsigned index, JSValue) const = 0;
-    virtual JSValue valueAt(ExecState*, unsigned index) const = 0;
-    virtual unsigned int getLength() const = 0;
-
-protected:
-    RefPtr<RootObject> m_rootObject;
-};
-
-const char* signatureForParameters(const ArgList&);
-
-typedef HashMap<RefPtr<UString::Rep>, MethodList*> MethodListMap;
-typedef HashMap<RefPtr<UString::Rep>, Method*> MethodMap;
-typedef HashMap<RefPtr<UString::Rep>, Field*> FieldMap;
-
 } // namespace Bindings
 
 } // namespace JSC
diff --git a/WebCore/bridge/jsc/BridgeJSC.cpp b/WebCore/bridge/jsc/BridgeJSC.cpp
new file mode 100644
index 0000000..ed582d3
--- /dev/null
+++ b/WebCore/bridge/jsc/BridgeJSC.cpp
@@ -0,0 +1,126 @@
+/*
+ * Copyright (C) 2003, 2006, 2008 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.
+ */
+
+#include "config.h"
+#include "BridgeJSC.h"
+
+#include "runtime_object.h"
+#include "runtime_root.h"
+#include <runtime/JSLock.h>
+
+#if PLATFORM(QT)
+#include "qt_instance.h"
+#endif
+
+namespace JSC {
+
+namespace Bindings {
+
+Array::Array(PassRefPtr<RootObject> rootObject)
+    : m_rootObject(rootObject)
+{
+    ASSERT(m_rootObject);
+}
+
+Array::~Array()
+{
+}
+
+Instance::Instance(PassRefPtr<RootObject> rootObject)
+    : m_rootObject(rootObject)
+    , m_runtimeObject(0)
+{
+    ASSERT(m_rootObject);
+}
+
+Instance::~Instance()
+{
+    ASSERT(!m_runtimeObject);
+}
+
+static KJSDidExecuteFunctionPtr s_didExecuteFunction;
+
+void Instance::setDidExecuteFunction(KJSDidExecuteFunctionPtr func)
+{
+    s_didExecuteFunction = func;
+}
+
+KJSDidExecuteFunctionPtr Instance::didExecuteFunction()
+{
+    return s_didExecuteFunction;
+}
+
+void Instance::begin()
+{
+    virtualBegin();
+}
+
+void Instance::end()
+{
+    virtualEnd();
+}
+
+RuntimeObjectImp* Instance::createRuntimeObject(ExecState* exec)
+{
+    ASSERT(m_rootObject);
+    ASSERT(m_rootObject->isValid());
+    if (m_runtimeObject)
+        return m_runtimeObject;
+    JSLock lock(SilenceAssertionsOnly);
+    m_runtimeObject = newRuntimeObject(exec);
+    m_rootObject->addRuntimeObject(m_runtimeObject);
+    return m_runtimeObject;
+}
+
+RuntimeObjectImp* Instance::newRuntimeObject(ExecState* exec)
+{
+    JSLock lock(SilenceAssertionsOnly);
+    return new (exec)RuntimeObjectImp(exec, this);
+}
+
+void Instance::willDestroyRuntimeObject()
+{
+    ASSERT(m_rootObject);
+    ASSERT(m_rootObject->isValid());
+    ASSERT(m_runtimeObject);
+    m_rootObject->removeRuntimeObject(m_runtimeObject);
+    m_runtimeObject = 0;
+}
+
+void Instance::willInvalidateRuntimeObject()
+{
+    ASSERT(m_runtimeObject);
+    m_runtimeObject = 0;
+}
+
+RootObject* Instance::rootObject() const
+{
+    return m_rootObject && m_rootObject->isValid() ? m_rootObject.get() : 0;
+}
+
+} // namespace Bindings
+
+} // namespace JSC
diff --git a/WebCore/bridge/jsc/BridgeJSC.h b/WebCore/bridge/jsc/BridgeJSC.h
new file mode 100644
index 0000000..8e2cb2b
--- /dev/null
+++ b/WebCore/bridge/jsc/BridgeJSC.h
@@ -0,0 +1,151 @@
+/*
+ * Copyright (C) 2003, 2008, 2009 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 BridgeJSC_h
+#define BridgeJSC_h
+
+#if USE(JSC)
+
+#include <runtime/JSString.h>
+#include <wtf/HashMap.h>
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+
+namespace JSC  {
+
+class ArgList;
+class Identifier;
+class JSGlobalObject;
+class PropertyNameArray;
+class RuntimeObjectImp;
+
+namespace Bindings {
+
+class Instance;
+class Method;
+class RootObject;
+
+typedef Vector<Method*> MethodList;
+
+class Field {
+public:
+    virtual JSValue valueFromInstance(ExecState*, const Instance*) const = 0;
+    virtual void setValueToInstance(ExecState*, const Instance*, JSValue) const = 0;
+
+    virtual ~Field() { }
+};
+
+class Class : public Noncopyable {
+public:
+    virtual MethodList methodsNamed(const Identifier&, Instance*) const = 0;
+    virtual Field* fieldNamed(const Identifier&, Instance*) const = 0;
+    virtual JSValue fallbackObject(ExecState*, Instance*, const Identifier&) { return jsUndefined(); }
+
+    virtual ~Class() { }
+};
+
+typedef void (*KJSDidExecuteFunctionPtr)(ExecState*, JSObject* rootObject);
+
+class Instance : public RefCounted<Instance> {
+public:
+    Instance(PassRefPtr<RootObject>);
+
+    static void setDidExecuteFunction(KJSDidExecuteFunctionPtr func);
+    static KJSDidExecuteFunctionPtr didExecuteFunction();
+
+    // These functions are called before and after the main entry points into
+    // the native implementations.  They can be used to establish and cleanup
+    // any needed state.
+    void begin();
+    void end();
+
+    virtual Class* getClass() const = 0;
+    RuntimeObjectImp* createRuntimeObject(ExecState*);
+    void willInvalidateRuntimeObject();
+    void willDestroyRuntimeObject();
+
+    // Returns false if the value was not set successfully.
+    virtual bool setValueOfUndefinedField(ExecState*, const Identifier&, JSValue) { return false; }
+
+    virtual JSValue invokeMethod(ExecState*, const MethodList&, const ArgList& args) = 0;
+
+    virtual bool supportsInvokeDefaultMethod() const { return false; }
+    virtual JSValue invokeDefaultMethod(ExecState*, const ArgList&) { return jsUndefined(); }
+
+    virtual bool supportsConstruct() const { return false; }
+    virtual JSValue invokeConstruct(ExecState*, const ArgList&) { return JSValue(); }
+
+    virtual void getPropertyNames(ExecState*, PropertyNameArray&) { }
+
+    virtual JSValue defaultValue(ExecState*, PreferredPrimitiveType) const = 0;
+
+    virtual JSValue valueOf(ExecState* exec) const = 0;
+
+    RootObject* rootObject() const;
+
+    virtual ~Instance();
+
+    virtual bool getOwnPropertySlot(JSObject*, ExecState*, const Identifier&, PropertySlot&) { return false; }
+    virtual bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&) { return false; }
+    virtual void put(JSObject*, ExecState*, const Identifier&, JSValue, PutPropertySlot&) { }
+
+protected:
+    virtual void virtualBegin() { }
+    virtual void virtualEnd() { }
+    virtual RuntimeObjectImp* newRuntimeObject(ExecState*);
+
+    RefPtr<RootObject> m_rootObject;
+
+private:
+    RuntimeObjectImp* m_runtimeObject;
+};
+
+class Array : public Noncopyable {
+public:
+    Array(PassRefPtr<RootObject>);
+    virtual ~Array();
+
+    virtual void setValueAt(ExecState*, unsigned index, JSValue) const = 0;
+    virtual JSValue valueAt(ExecState*, unsigned index) const = 0;
+    virtual unsigned int getLength() const = 0;
+
+protected:
+    RefPtr<RootObject> m_rootObject;
+};
+
+const char* signatureForParameters(const ArgList&);
+
+typedef HashMap<RefPtr<UString::Rep>, MethodList*> MethodListMap;
+typedef HashMap<RefPtr<UString::Rep>, Method*> MethodMap;
+typedef HashMap<RefPtr<UString::Rep>, Field*> FieldMap;
+
+} // namespace Bindings
+
+} // namespace JSC
+
+#endif // USE(JSC)
+
+#endif

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list