Title: [120195] trunk/Source/WebCore
Revision
120195
Author
[email protected]
Date
2012-06-13 06:11:24 -0700 (Wed, 13 Jun 2012)

Log Message

[Qt] Save a JSGlobalContextRef instead of a JSContextRef in QtConnectionObject
https://bugs.webkit.org/show_bug.cgi?id=88905

Make QtConnectionObject use JSContextGetGlobalContext and store the
JSGlobalContextRef. Previous code was working but saving JSContextRef was wrong in terms of
API.

There's an assumption that JSGlobalContextRef will outlive the connection objects, and
because of it no JSGlobalContextRetain/Release calls were added.

Reviewed by Noam Rosenthal.

* bridge/qt/qt_runtime.cpp:
(JSC::Bindings::QtRuntimeConnectionMethod::call):
(JSC::Bindings::QtConnectionObject::QtConnectionObject):
* bridge/qt/qt_runtime.h:
(QtConnectionObject):
* bridge/qt/qt_runtime_qt4.cpp:
(JSC::Bindings::QtRuntimeConnectionMethod::call):
(JSC::Bindings::QtConnectionObject::QtConnectionObject):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (120194 => 120195)


--- trunk/Source/WebCore/ChangeLog	2012-06-13 13:04:21 UTC (rev 120194)
+++ trunk/Source/WebCore/ChangeLog	2012-06-13 13:11:24 UTC (rev 120195)
@@ -1,3 +1,26 @@
+2012-06-13  Caio Marcelo de Oliveira Filho  <[email protected]>
+
+        [Qt] Save a JSGlobalContextRef instead of a JSContextRef in QtConnectionObject
+        https://bugs.webkit.org/show_bug.cgi?id=88905
+
+        Make QtConnectionObject use JSContextGetGlobalContext and store the
+        JSGlobalContextRef. Previous code was working but saving JSContextRef was wrong in terms of
+        API.
+
+        There's an assumption that JSGlobalContextRef will outlive the connection objects, and
+        because of it no JSGlobalContextRetain/Release calls were added.
+
+        Reviewed by Noam Rosenthal.
+
+        * bridge/qt/qt_runtime.cpp:
+        (JSC::Bindings::QtRuntimeConnectionMethod::call):
+        (JSC::Bindings::QtConnectionObject::QtConnectionObject):
+        * bridge/qt/qt_runtime.h:
+        (QtConnectionObject):
+        * bridge/qt/qt_runtime_qt4.cpp:
+        (JSC::Bindings::QtRuntimeConnectionMethod::call):
+        (JSC::Bindings::QtConnectionObject::QtConnectionObject):
+
 2012-06-13  David Barr  <[email protected]>
 
         Add dpi to css3-images image-resolution

Modified: trunk/Source/WebCore/bridge/qt/qt_runtime.cpp (120194 => 120195)


--- trunk/Source/WebCore/bridge/qt/qt_runtime.cpp	2012-06-13 13:04:21 UTC (rev 120194)
+++ trunk/Source/WebCore/bridge/qt/qt_runtime.cpp	2012-06-13 13:11:24 UTC (rev 120195)
@@ -27,6 +27,7 @@
 #include "FunctionPrototype.h"
 #include "Interpreter.h"
 #include "JSArray.h"
+#include "JSContextRefPrivate.h"
 #include "JSDocument.h"
 #include "JSDOMBinding.h"
 #include "JSDOMWindow.h"
@@ -1636,8 +1637,7 @@
                 //  receiver function [from arguments]
                 //  receiver this object [from arguments]
 
-                ExecState* globalExec = exec->lexicalGlobalObject()->globalExec();
-                QtConnectionObject* conn = QtConnectionObject::createWithInternalJSC(globalExec, d->m_instance, signalIndex, thisObject, funcObject);
+                QtConnectionObject* conn = QtConnectionObject::createWithInternalJSC(exec, d->m_instance, signalIndex, thisObject, funcObject);
                 bool ok = QMetaObject::connect(sender, signalIndex, conn, conn->metaObject()->methodOffset());
                 if (!ok) {
                     delete conn;
@@ -1739,7 +1739,7 @@
 
 QtConnectionObject::QtConnectionObject(JSContextRef context, PassRefPtr<QtInstance> senderInstance, int signalIndex, JSObjectRef receiver, JSObjectRef receiverFunction)
     : QObject(senderInstance->getObject())
-    , m_context(context)
+    , m_context(JSContextGetGlobalContext(context))
     , m_senderInstance(senderInstance)
     , m_originalSender(m_senderInstance->getObject())
     , m_signalIndex(signalIndex)

Modified: trunk/Source/WebCore/bridge/qt/qt_runtime.h (120194 => 120195)


--- trunk/Source/WebCore/bridge/qt/qt_runtime.h	2012-06-13 13:04:21 UTC (rev 120194)
+++ trunk/Source/WebCore/bridge/qt/qt_runtime.h	2012-06-13 13:11:24 UTC (rev 120195)
@@ -261,7 +261,7 @@
     static QtConnectionObject* createWithInternalJSC(ExecState*, PassRefPtr<QtInstance> senderInstance, int signalIndex, JSObject* receiver, JSObject* receiverFunction);
 
 private:
-    JSContextRef m_context;
+    JSGlobalContextRef m_context;
     RefPtr<QtInstance> m_senderInstance;
 
     // We use this as key in active connections multimap.

Modified: trunk/Source/WebCore/bridge/qt/qt_runtime_qt4.cpp (120194 => 120195)


--- trunk/Source/WebCore/bridge/qt/qt_runtime_qt4.cpp	2012-06-13 13:04:21 UTC (rev 120194)
+++ trunk/Source/WebCore/bridge/qt/qt_runtime_qt4.cpp	2012-06-13 13:11:24 UTC (rev 120195)
@@ -27,6 +27,7 @@
 #include "FunctionPrototype.h"
 #include "Interpreter.h"
 #include "JSArray.h"
+#include "JSContextRefPrivate.h"
 #include "JSDocument.h"
 #include "JSDOMBinding.h"
 #include "JSDOMWindow.h"
@@ -1645,8 +1646,7 @@
                 //  receiver function [from arguments]
                 //  receiver this object [from arguments]
 
-                ExecState* globalExec = exec->lexicalGlobalObject()->globalExec();
-                QtConnectionObject* conn = QtConnectionObject::createWithInternalJSC(globalExec, d->m_instance, signalIndex, thisObject, funcObject);
+                QtConnectionObject* conn = QtConnectionObject::createWithInternalJSC(exec, d->m_instance, signalIndex, thisObject, funcObject);
                 bool ok = QMetaObject::connect(sender, signalIndex, conn, conn->metaObject()->methodOffset());
                 if (!ok) {
                     delete conn;
@@ -1748,7 +1748,7 @@
 
 QtConnectionObject::QtConnectionObject(JSContextRef context, PassRefPtr<QtInstance> senderInstance, int signalIndex, JSObjectRef receiver, JSObjectRef receiverFunction)
     : QObject(senderInstance->getObject())
-    , m_context(context)
+    , m_context(JSContextGetGlobalContext(context))
     , m_senderInstance(senderInstance)
     , m_originalSender(m_senderInstance->getObject())
     , m_signalIndex(signalIndex)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to