Title: [125452] trunk/Source
Revision
125452
Author
[email protected]
Date
2012-08-13 14:37:19 -0700 (Mon, 13 Aug 2012)

Log Message

Unreviewed, rolling out r125444.
http://trac.webkit.org/changeset/125444
https://bugs.webkit.org/show_bug.cgi?id=93872

Broke some tests

Source/_javascript_Core:

* Target.pri:

Source/WebCore:

* bridge/qt/qt_runtime.cpp:
(JSC::Bindings::QtRuntimeMethod::~QtRuntimeMethod):
(JSC::Bindings::QtRuntimeMethod::jsObjectRef):
* bridge/qt/qt_runtime.h:
(QtRuntimeMethod):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (125451 => 125452)


--- trunk/Source/_javascript_Core/ChangeLog	2012-08-13 21:29:11 UTC (rev 125451)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-08-13 21:37:19 UTC (rev 125452)
@@ -1,5 +1,15 @@
 2012-08-13  Simon Hausmann  <[email protected]>
 
+        Unreviewed, rolling out r125444.
+        http://trac.webkit.org/changeset/125444
+        https://bugs.webkit.org/show_bug.cgi?id=93872
+
+        Broke some tests
+
+        * Target.pri:
+
+2012-08-13  Simon Hausmann  <[email protected]>
+
         [Qt] Replace use of internal Weak smart pointer with JSWeakObjectMap
         https://bugs.webkit.org/show_bug.cgi?id=93872
 

Modified: trunk/Source/_javascript_Core/Target.pri (125451 => 125452)


--- trunk/Source/_javascript_Core/Target.pri	2012-08-13 21:29:11 UTC (rev 125451)
+++ trunk/Source/_javascript_Core/Target.pri	2012-08-13 21:37:19 UTC (rev 125452)
@@ -40,7 +40,6 @@
     API/JSObjectRef.cpp \
     API/JSStringRef.cpp \
     API/JSValueRef.cpp \
-    API/JSWeakObjectMapRefPrivate.cpp \
     API/OpaqueJSString.cpp \
     assembler/ARMAssembler.cpp \
     assembler/ARMv7Assembler.cpp \

Modified: trunk/Source/WebCore/ChangeLog (125451 => 125452)


--- trunk/Source/WebCore/ChangeLog	2012-08-13 21:29:11 UTC (rev 125451)
+++ trunk/Source/WebCore/ChangeLog	2012-08-13 21:37:19 UTC (rev 125452)
@@ -1,3 +1,17 @@
+2012-08-13  Simon Hausmann  <[email protected]>
+
+        Unreviewed, rolling out r125444.
+        http://trac.webkit.org/changeset/125444
+        https://bugs.webkit.org/show_bug.cgi?id=93872
+
+        Broke some tests
+
+        * bridge/qt/qt_runtime.cpp:
+        (JSC::Bindings::QtRuntimeMethod::~QtRuntimeMethod):
+        (JSC::Bindings::QtRuntimeMethod::jsObjectRef):
+        * bridge/qt/qt_runtime.h:
+        (QtRuntimeMethod):
+
 2012-08-13  Thiago Marcos P. Santos  <[email protected]>
 
         CanvasRenderContext2D::font() does not re-serialize the font

Modified: trunk/Source/WebCore/bridge/qt/qt_runtime.cpp (125451 => 125452)


--- trunk/Source/WebCore/bridge/qt/qt_runtime.cpp	2012-08-13 21:29:11 UTC (rev 125451)
+++ trunk/Source/WebCore/bridge/qt/qt_runtime.cpp	2012-08-13 21:37:19 UTC (rev 125452)
@@ -38,7 +38,6 @@
 #include "JSObject.h"
 #include "JSRetainPtr.h"
 #include "JSUint8ClampedArray.h"
-#include "JSWeakObjectMapRefPrivate.h"
 #include "ObjectPrototype.h"
 #include "PropertyNameArray.h"
 #include "qdatetime.h"
@@ -1291,15 +1290,6 @@
     return cls;
 }
 
-typedef HashMap<JSGlobalContextRef, JSWeakObjectMapRef> WeakRuntimeMethodMap;
-static WeakRuntimeMethodMap weakRuntimeMethodCache;
-
-static void methodMapCleaner(JSWeakObjectMapRef, void* data)
-{
-    JSGlobalContextRef ref = static_cast<JSGlobalContextRef>(data);
-    weakRuntimeMethodCache.remove(ref);
-}
-
 QtRuntimeMethod::QtRuntimeMethod(JSContextRef ctx, QObject* object, const QByteArray& identifier, int index, int flags, QtInstance* instance)
     : m_object(object)
     , m_identifier(identifier)
@@ -1311,13 +1301,8 @@
 
 QtRuntimeMethod::~QtRuntimeMethod()
 {
-    for (WeakRuntimeMethodMap::const_iterator it = weakRuntimeMethodCache.begin(), end = weakRuntimeMethodCache.end();
-         it != end; ++it) {
-        if (JSObjectRef obj = JSWeakObjectMapGet(it->first, it->second, this)) {
-            JSObjectSetPrivate(obj, 0);
-            JSWeakObjectMapRemove(it->first, it->second, this);
-        }
-    }
+    if (m_jsObject)
+        JSObjectSetPrivate(toRef(m_jsObject.get()), 0);
 }
 
 JSValueRef QtRuntimeMethod::call(JSContextRef context, JSObjectRef function, JSObjectRef /*thisObject*/, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
@@ -1365,12 +1350,8 @@
 
 JSObjectRef QtRuntimeMethod::jsObjectRef(JSContextRef context, JSValueRef* exception)
 {
-    JSGlobalContextRef globalContext = JSContextGetGlobalContext(context);
-    WeakRuntimeMethodMap::iterator cache = weakRuntimeMethodCache.find(globalContext);
-    if (cache != weakRuntimeMethodCache.end()) {
-        if (JSObjectRef cachedMethod = JSWeakObjectMapGet(cache->first, cache->second, this))
-            return cachedMethod;
-    }
+    if (m_jsObject)
+        return toRef(m_jsObject.get());
 
     static const JSClassDefinition classDefForConnect = {
         0, 0, "connect", 0, 0, 0,
@@ -1406,14 +1387,7 @@
     JSObjectSetProperty(context, object, lengthStr, JSValueMakeNumber(context, 0), attributes, exception);
     JSObjectSetProperty(context, object, nameStr, JSValueMakeString(context, actualNameStr.get()), attributes, exception);
 
-    JSWeakObjectMapRef map;
-    if (cache == weakRuntimeMethodCache.end()) {
-        map = JSWeakObjectMapCreate(globalContext, globalContext, methodMapCleaner);
-        weakRuntimeMethodCache.add(globalContext, map);
-    } else
-        map = cache->second;
-    JSWeakObjectMapSet(globalContext, map, this, object);
-
+    m_jsObject = PassWeak<JSObject>(toJS(object));
     return object;
 }
 

Modified: trunk/Source/WebCore/bridge/qt/qt_runtime.h (125451 => 125452)


--- trunk/Source/WebCore/bridge/qt/qt_runtime.h	2012-08-13 21:29:11 UTC (rev 125451)
+++ trunk/Source/WebCore/bridge/qt/qt_runtime.h	2012-08-13 21:37:19 UTC (rev 125452)
@@ -122,6 +122,7 @@
     QByteArray m_identifier;
     int m_index;
     int m_flags;
+    Weak<JSObject> m_jsObject;
     QtInstance* m_instance;
 };
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to