Title: [164902] trunk/Source/_javascript_Core
Revision
164902
Author
commit-qu...@webkit.org
Date
2014-02-28 18:51:39 -0800 (Fri, 28 Feb 2014)

Log Message

Deadlock remotely inspecting iOS Simulator
https://bugs.webkit.org/show_bug.cgi?id=129511

Patch by Joseph Pecoraro <pecor...@apple.com> on 2014-02-28
Reviewed by Timothy Hatcher.

Avoid synchronous setup. Do it asynchronously, and let
the RemoteInspector singleton know later if it failed.

* inspector/remote/RemoteInspector.h:
* inspector/remote/RemoteInspector.mm:
(Inspector::RemoteInspector::setupFailed):
* inspector/remote/RemoteInspectorDebuggableConnection.h:
* inspector/remote/RemoteInspectorDebuggableConnection.mm:
(Inspector::RemoteInspectorDebuggableConnection::setup):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (164901 => 164902)


--- trunk/Source/_javascript_Core/ChangeLog	2014-03-01 02:05:14 UTC (rev 164901)
+++ trunk/Source/_javascript_Core/ChangeLog	2014-03-01 02:51:39 UTC (rev 164902)
@@ -1,3 +1,20 @@
+2014-02-28  Joseph Pecoraro  <pecor...@apple.com>
+
+        Deadlock remotely inspecting iOS Simulator
+        https://bugs.webkit.org/show_bug.cgi?id=129511
+
+        Reviewed by Timothy Hatcher.
+
+        Avoid synchronous setup. Do it asynchronously, and let
+        the RemoteInspector singleton know later if it failed.
+
+        * inspector/remote/RemoteInspector.h:
+        * inspector/remote/RemoteInspector.mm:
+        (Inspector::RemoteInspector::setupFailed):
+        * inspector/remote/RemoteInspectorDebuggableConnection.h:
+        * inspector/remote/RemoteInspectorDebuggableConnection.mm:
+        (Inspector::RemoteInspectorDebuggableConnection::setup):
+
 2014-02-28  Oliver Hunt  <oli...@apple.com>
 
         REGRESSION(r164835): It broke 10 JSC stress test on 32 bit platforms

Modified: trunk/Source/_javascript_Core/inspector/remote/RemoteInspector.h (164901 => 164902)


--- trunk/Source/_javascript_Core/inspector/remote/RemoteInspector.h	2014-03-01 02:05:14 UTC (rev 164901)
+++ trunk/Source/_javascript_Core/inspector/remote/RemoteInspector.h	2014-03-01 02:51:39 UTC (rev 164902)
@@ -52,6 +52,7 @@
     void unregisterDebuggable(RemoteInspectorDebuggable*);
     void updateDebuggable(RemoteInspectorDebuggable*);
     void sendMessageToRemoteFrontend(unsigned identifier, const String& message);
+    void setupFailed(unsigned identifier);
 
     bool enabled() const { return m_enabled; }
     bool hasActiveDebugSession() const { return m_hasActiveDebugSession; }

Modified: trunk/Source/_javascript_Core/inspector/remote/RemoteInspector.mm (164901 => 164902)


--- trunk/Source/_javascript_Core/inspector/remote/RemoteInspector.mm	2014-03-01 02:05:14 UTC (rev 164901)
+++ trunk/Source/_javascript_Core/inspector/remote/RemoteInspector.mm	2014-03-01 02:51:39 UTC (rev 164902)
@@ -165,6 +165,17 @@
     m_xpcConnection->sendMessage(WIRRawDataMessage, userInfo);
 }
 
+void RemoteInspector::setupFailed(unsigned identifier)
+{
+    std::lock_guard<std::mutex> lock(m_mutex);
+
+    m_connectionMap.remove(identifier);
+
+    updateHasActiveDebugSession();
+
+    pushListingSoon();
+}
+
 void RemoteInspector::start()
 {
     std::lock_guard<std::mutex> lock(m_mutex);

Modified: trunk/Source/_javascript_Core/inspector/remote/RemoteInspectorDebuggableConnection.h (164901 => 164902)


--- trunk/Source/_javascript_Core/inspector/remote/RemoteInspectorDebuggableConnection.h	2014-03-01 02:05:14 UTC (rev 164901)
+++ trunk/Source/_javascript_Core/inspector/remote/RemoteInspectorDebuggableConnection.h	2014-03-01 02:51:39 UTC (rev 164902)
@@ -57,7 +57,6 @@
     virtual bool sendMessageToFrontend(const String&) override;
 
 private:
-    void dispatchSyncOnDebuggable(void (^block)());
     void dispatchAsyncOnDebuggable(void (^block)());
 
     // This connection from the RemoteInspector singleton to the Debuggable

Modified: trunk/Source/_javascript_Core/inspector/remote/RemoteInspectorDebuggableConnection.mm (164901 => 164902)


--- trunk/Source/_javascript_Core/inspector/remote/RemoteInspectorDebuggableConnection.mm	2014-03-01 02:05:14 UTC (rev 164901)
+++ trunk/Source/_javascript_Core/inspector/remote/RemoteInspectorDebuggableConnection.mm	2014-03-01 02:51:39 UTC (rev 164902)
@@ -68,18 +68,6 @@
     return [[m_connectionIdentifier copy] autorelease];
 }
 
-void RemoteInspectorDebuggableConnection::dispatchSyncOnDebuggable(void (^block)())
-{
-    if (m_queueForDebuggable)
-        dispatch_sync(m_queueForDebuggable, block);
-#if PLATFORM(IOS)
-    else if (WebCoreWebThreadIsEnabled && WebCoreWebThreadIsEnabled())
-        WebCoreWebThreadRunSync(block);
-#endif
-    else
-        dispatch_sync(dispatch_get_main_queue(), block);
-}
-
 void RemoteInspectorDebuggableConnection::dispatchAsyncOnDebuggable(void (^block)())
 {
     if (m_queueForDebuggable)
@@ -99,18 +87,22 @@
     if (!m_debuggable)
         return false;
 
-    dispatchSyncOnDebuggable(^{
-        if (!m_debuggable->remoteDebuggingAllowed())
-            return;
-
-        if (m_debuggable->hasLocalDebugger())
-            return;
-
-        m_debuggable->connect(this);
-        m_connected = true;
+    ref();
+    dispatchAsyncOnDebuggable(^{
+        {
+            std::lock_guard<std::mutex> lock(m_debuggableMutex);
+            if (!m_debuggable || !m_debuggable->remoteDebuggingAllowed() || m_debuggable->hasLocalDebugger()) {
+                RemoteInspector::shared().setupFailed(identifier());
+                m_debuggable = nullptr;
+            } else {
+                m_debuggable->connect(this);
+                m_connected = true;
+            }
+        }
+        deref();
     });
 
-    return m_connected;
+    return true;
 }
 
 void RemoteInspectorDebuggableConnection::closeFromDebuggable()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to