Title: [163648] trunk/Source/_javascript_Core
Revision
163648
Author
[email protected]
Date
2014-02-07 14:31:00 -0800 (Fri, 07 Feb 2014)

Log Message

[iOS] Eliminate race between XPC connection queue and Notification queue
https://bugs.webkit.org/show_bug.cgi?id=128384

Patch by Joseph Pecoraro <[email protected]> on 2014-02-07
Reviewed by Timothy Hatcher.

* inspector/remote/RemoteInspector.h:
* inspector/remote/RemoteInspector.mm:
(Inspector::RemoteInspector::RemoteInspector):
(Inspector::RemoteInspector::start):
(Inspector::RemoteInspector::setupXPCConnectionIfNeeded):
Create the queue to use for RemoteInspector xpc connection
management and the connection itself.

* inspector/remote/RemoteInspectorXPCConnection.h:
* inspector/remote/RemoteInspectorXPCConnection.mm:
(Inspector::RemoteInspectorXPCConnection::RemoteInspectorXPCConnection):
Use the passed in queue instead of creating one for itself.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (163647 => 163648)


--- trunk/Source/_javascript_Core/ChangeLog	2014-02-07 22:27:06 UTC (rev 163647)
+++ trunk/Source/_javascript_Core/ChangeLog	2014-02-07 22:31:00 UTC (rev 163648)
@@ -1,3 +1,23 @@
+2014-02-07  Joseph Pecoraro  <[email protected]>
+
+        [iOS] Eliminate race between XPC connection queue and Notification queue
+        https://bugs.webkit.org/show_bug.cgi?id=128384
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/remote/RemoteInspector.h:
+        * inspector/remote/RemoteInspector.mm:
+        (Inspector::RemoteInspector::RemoteInspector):
+        (Inspector::RemoteInspector::start):
+        (Inspector::RemoteInspector::setupXPCConnectionIfNeeded):
+        Create the queue to use for RemoteInspector xpc connection
+        management and the connection itself.
+
+        * inspector/remote/RemoteInspectorXPCConnection.h:
+        * inspector/remote/RemoteInspectorXPCConnection.mm:
+        (Inspector::RemoteInspectorXPCConnection::RemoteInspectorXPCConnection):
+        Use the passed in queue instead of creating one for itself.
+
 2014-02-07  Oliver Hunt  <[email protected]>
 
         REGRESSION (r160628): LLint does not appear to handle impure get own property properly

Modified: trunk/Source/_javascript_Core/inspector/remote/RemoteInspector.h (163647 => 163648)


--- trunk/Source/_javascript_Core/inspector/remote/RemoteInspector.h	2014-02-07 22:27:06 UTC (rev 163647)
+++ trunk/Source/_javascript_Core/inspector/remote/RemoteInspector.h	2014-02-07 22:31:00 UTC (rev 163648)
@@ -95,6 +95,7 @@
     HashMap<unsigned, std::pair<RemoteInspectorDebuggable*, RemoteInspectorDebuggableInfo>> m_debuggableMap;
     HashMap<unsigned, RefPtr<RemoteInspectorDebuggableConnection>> m_connectionMap;
     RefPtr<RemoteInspectorXPCConnection> m_xpcConnection;
+    dispatch_queue_t m_xpcQueue;
     unsigned m_nextAvailableIdentifier;
     int m_notifyToken;
     bool m_enabled;

Modified: trunk/Source/_javascript_Core/inspector/remote/RemoteInspector.mm (163647 => 163648)


--- trunk/Source/_javascript_Core/inspector/remote/RemoteInspector.mm	2014-02-07 22:27:06 UTC (rev 163647)
+++ trunk/Source/_javascript_Core/inspector/remote/RemoteInspector.mm	2014-02-07 22:31:00 UTC (rev 163648)
@@ -80,7 +80,8 @@
 }
 
 RemoteInspector::RemoteInspector()
-    : m_nextAvailableIdentifier(1)
+    : m_xpcQueue(dispatch_queue_create("com.apple._javascript_Core.remote-inspector-xpc", DISPATCH_QUEUE_SERIAL))
+    , m_nextAvailableIdentifier(1)
     , m_notifyToken(0)
     , m_enabled(false)
     , m_hasActiveDebugSession(false)
@@ -172,7 +173,7 @@
 
     m_enabled = true;
 
-    notify_register_dispatch(WIRServiceAvailableNotification, &m_notifyToken, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(int) {
+    notify_register_dispatch(WIRServiceAvailableNotification, &m_notifyToken, m_xpcQueue, ^(int) {
         RemoteInspector::shared().setupXPCConnectionIfNeeded();
     });
 
@@ -211,11 +212,11 @@
     if (m_xpcConnection)
         return;
 
-    xpc_connection_t connection = xpc_connection_create_mach_service(WIRXPCMachPortName, dispatch_get_main_queue(), 0);
+    xpc_connection_t connection = xpc_connection_create_mach_service(WIRXPCMachPortName, m_xpcQueue, 0);
     if (!connection)
         return;
 
-    m_xpcConnection = adoptRef(new RemoteInspectorXPCConnection(connection, this));
+    m_xpcConnection = adoptRef(new RemoteInspectorXPCConnection(connection, m_xpcQueue, this));
     m_xpcConnection->sendMessage(@"syn", nil); // Send a simple message to initialize the XPC connection.
     xpc_release(connection);
 

Modified: trunk/Source/_javascript_Core/inspector/remote/RemoteInspectorXPCConnection.h (163647 => 163648)


--- trunk/Source/_javascript_Core/inspector/remote/RemoteInspectorXPCConnection.h	2014-02-07 22:27:06 UTC (rev 163647)
+++ trunk/Source/_javascript_Core/inspector/remote/RemoteInspectorXPCConnection.h	2014-02-07 22:31:00 UTC (rev 163648)
@@ -47,7 +47,7 @@
         virtual void xpcConnectionUnhandledMessage(RemoteInspectorXPCConnection*, xpc_object_t) = 0;
     };
 
-    RemoteInspectorXPCConnection(xpc_connection_t, Client*);
+    RemoteInspectorXPCConnection(xpc_connection_t, dispatch_queue_t, Client*);
     virtual ~RemoteInspectorXPCConnection();
 
     void close();

Modified: trunk/Source/_javascript_Core/inspector/remote/RemoteInspectorXPCConnection.mm (163647 => 163648)


--- trunk/Source/_javascript_Core/inspector/remote/RemoteInspectorXPCConnection.mm	2014-02-07 22:27:06 UTC (rev 163647)
+++ trunk/Source/_javascript_Core/inspector/remote/RemoteInspectorXPCConnection.mm	2014-02-07 22:31:00 UTC (rev 163648)
@@ -45,12 +45,14 @@
 #define RemoteInspectorXPCConnectionUserInfoKey @"userInfo"
 #define RemoteInspectorXPCConnectionSerializedMessageKey "msgData"
 
-RemoteInspectorXPCConnection::RemoteInspectorXPCConnection(xpc_connection_t connection, Client* client)
+RemoteInspectorXPCConnection::RemoteInspectorXPCConnection(xpc_connection_t connection, dispatch_queue_t queue, Client* client)
     : m_connection(connection)
-    , m_queue(dispatch_queue_create("com.apple._javascript_Core.remote-inspector-xpc-connection", DISPATCH_QUEUE_SERIAL))
+    , m_queue(queue)
     , m_client(client)
     , m_closed(false)
 {
+    dispatch_retain(m_queue);
+
     xpc_retain(m_connection);
     xpc_connection_set_target_queue(m_connection, m_queue);
     xpc_connection_set_event_handler(m_connection, ^(xpc_object_t object) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to