Title: [243795] trunk/Source
Revision
243795
Author
[email protected]
Date
2019-04-03 05:42:38 -0700 (Wed, 03 Apr 2019)

Log Message

Web Inspector: Remote Inspector indicate callback should always happen on the main thread
https://bugs.webkit.org/show_bug.cgi?id=196513
<rdar://problem/49498284>

Reviewed by Devin Rousso.

Source/_javascript_Core:

* inspector/remote/cocoa/RemoteInspectorCocoa.mm:
(Inspector::RemoteInspector::receivedIndicateMessage):
When we have a WebThread, don't just run on the WebThread,
run on the MainThread with the WebThreadLock.

Source/WebCore:

* platform/ios/wak/WebCoreThreadSystemInterface.cpp:
(InitWebCoreThreadSystemInterface):

Source/WTF:

* wtf/MainThread.h:
* wtf/cocoa/MainThreadCocoa.mm:
(WTF::dispatchAsyncOnMainThreadWithWebThreadLockIfNeeded):
* wtf/ios/WebCoreThread.cpp:
* wtf/ios/WebCoreThread.h:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (243794 => 243795)


--- trunk/Source/_javascript_Core/ChangeLog	2019-04-03 08:33:41 UTC (rev 243794)
+++ trunk/Source/_javascript_Core/ChangeLog	2019-04-03 12:42:38 UTC (rev 243795)
@@ -1,3 +1,16 @@
+2019-04-03  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: Remote Inspector indicate callback should always happen on the main thread
+        https://bugs.webkit.org/show_bug.cgi?id=196513
+        <rdar://problem/49498284>
+
+        Reviewed by Devin Rousso.
+
+        * inspector/remote/cocoa/RemoteInspectorCocoa.mm:
+        (Inspector::RemoteInspector::receivedIndicateMessage):
+        When we have a WebThread, don't just run on the WebThread,
+        run on the MainThread with the WebThreadLock.
+
 2019-04-02  Michael Saboff  <[email protected]>
 
         Crash in Options::setOptions() using --configFile option and libgmalloc

Modified: trunk/Source/_javascript_Core/inspector/remote/cocoa/RemoteInspectorCocoa.mm (243794 => 243795)


--- trunk/Source/_javascript_Core/inspector/remote/cocoa/RemoteInspectorCocoa.mm	2019-04-03 08:33:41 UTC (rev 243794)
+++ trunk/Source/_javascript_Core/inspector/remote/cocoa/RemoteInspectorCocoa.mm	2019-04-03 12:42:38 UTC (rev 243795)
@@ -592,7 +592,7 @@
     if (!targetIdentifier)
         return;
 
-    callOnWebThreadOrDispatchAsyncOnMainThread(^{
+    dispatchAsyncOnMainThreadWithWebThreadLockIfNeeded(^{
         RemoteControllableTarget* target = nullptr;
         {
             LockHolder lock(m_mutex);

Modified: trunk/Source/WTF/ChangeLog (243794 => 243795)


--- trunk/Source/WTF/ChangeLog	2019-04-03 08:33:41 UTC (rev 243794)
+++ trunk/Source/WTF/ChangeLog	2019-04-03 12:42:38 UTC (rev 243795)
@@ -1,3 +1,17 @@
+2019-04-03  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: Remote Inspector indicate callback should always happen on the main thread
+        https://bugs.webkit.org/show_bug.cgi?id=196513
+        <rdar://problem/49498284>
+
+        Reviewed by Devin Rousso.
+
+        * wtf/MainThread.h:
+        * wtf/cocoa/MainThreadCocoa.mm:
+        (WTF::dispatchAsyncOnMainThreadWithWebThreadLockIfNeeded):
+        * wtf/ios/WebCoreThread.cpp:
+        * wtf/ios/WebCoreThread.h:
+
 2019-04-02  Keith Rollin  <[email protected]>
 
         Inhibit CFNetwork logging in private sessions

Modified: trunk/Source/WTF/wtf/MainThread.h (243794 => 243795)


--- trunk/Source/WTF/wtf/MainThread.h	2019-04-03 08:33:41 UTC (rev 243794)
+++ trunk/Source/WTF/wtf/MainThread.h	2019-04-03 12:42:38 UTC (rev 243795)
@@ -46,6 +46,7 @@
 WTF_EXPORT_PRIVATE void callOnMainThreadAndWait(Function<void()>&&);
 
 #if PLATFORM(COCOA)
+WTF_EXPORT_PRIVATE void dispatchAsyncOnMainThreadWithWebThreadLockIfNeeded(void (^block)());
 WTF_EXPORT_PRIVATE void callOnWebThreadOrDispatchAsyncOnMainThread(void (^block)());
 #endif
 
@@ -108,6 +109,7 @@
 using WTF::mayBeGCThread;
 using WTF::setMainThreadCallbacksPaused;
 #if PLATFORM(COCOA)
+using WTF::dispatchAsyncOnMainThreadWithWebThreadLockIfNeeded;
 using WTF::callOnWebThreadOrDispatchAsyncOnMainThread;
 #endif
 #if USE(WEB_THREAD)

Modified: trunk/Source/WTF/wtf/cocoa/MainThreadCocoa.mm (243794 => 243795)


--- trunk/Source/WTF/wtf/cocoa/MainThreadCocoa.mm	2019-04-03 08:33:41 UTC (rev 243794)
+++ trunk/Source/WTF/wtf/cocoa/MainThreadCocoa.mm	2019-04-03 12:42:38 UTC (rev 243795)
@@ -140,6 +140,20 @@
     [staticMainThreadCaller performSelector:@selector(call) onThread:mainThreadNSThread withObject:nil waitUntilDone:NO];
 }
 
+void dispatchAsyncOnMainThreadWithWebThreadLockIfNeeded(void (^block)())
+{
+#if USE(WEB_THREAD)
+    if (WebCoreWebThreadIsEnabled && WebCoreWebThreadIsEnabled()) {
+        dispatch_async(dispatch_get_main_queue(), ^{
+            WebCoreWebThreadLock();
+            block();
+        });
+        return;
+    }
+#endif
+    dispatch_async(dispatch_get_main_queue(), block);
+}
+
 void callOnWebThreadOrDispatchAsyncOnMainThread(void (^block)())
 {
 #if USE(WEB_THREAD)

Modified: trunk/Source/WTF/wtf/ios/WebCoreThread.cpp (243794 => 243795)


--- trunk/Source/WTF/wtf/ios/WebCoreThread.cpp	2019-04-03 08:33:41 UTC (rev 243794)
+++ trunk/Source/WTF/wtf/ios/WebCoreThread.cpp	2019-04-03 12:42:38 UTC (rev 243795)
@@ -27,6 +27,7 @@
 #include <wtf/ios/WebCoreThread.h>
 
 #if USE(WEB_THREAD)
+WTF_EXPORT_PRIVATE void (*WebCoreWebThreadLock)(void);
 WTF_EXPORT_PRIVATE bool (*WebCoreWebThreadIsLockedOrDisabled)(void);
 WTF_EXPORT_PRIVATE bool (*WebCoreWebThreadIsEnabled)(void);
 WTF_EXPORT_PRIVATE void (*WebCoreWebThreadRun)(void (^block)());

Modified: trunk/Source/WTF/wtf/ios/WebCoreThread.h (243794 => 243795)


--- trunk/Source/WTF/wtf/ios/WebCoreThread.h	2019-04-03 08:33:41 UTC (rev 243794)
+++ trunk/Source/WTF/wtf/ios/WebCoreThread.h	2019-04-03 12:42:38 UTC (rev 243795)
@@ -29,6 +29,7 @@
 extern "C" {
 #endif
 
+extern void (*WebCoreWebThreadLock)(void);
 extern bool (*WebCoreWebThreadIsLockedOrDisabled)(void);
 extern bool (*WebCoreWebThreadIsEnabled)(void);
 extern void (*WebCoreWebThreadRun)(void (^block)());

Modified: trunk/Source/WebCore/ChangeLog (243794 => 243795)


--- trunk/Source/WebCore/ChangeLog	2019-04-03 08:33:41 UTC (rev 243794)
+++ trunk/Source/WebCore/ChangeLog	2019-04-03 12:42:38 UTC (rev 243795)
@@ -1,3 +1,14 @@
+2019-04-03  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: Remote Inspector indicate callback should always happen on the main thread
+        https://bugs.webkit.org/show_bug.cgi?id=196513
+        <rdar://problem/49498284>
+
+        Reviewed by Devin Rousso.
+
+        * platform/ios/wak/WebCoreThreadSystemInterface.cpp:
+        (InitWebCoreThreadSystemInterface):
+
 2019-04-02  Simon Fraser  <[email protected]>
 
         REGRESSION (r238266): Exchange 2013 Outlook Web Access displays partially blank page when creating new e-mail

Modified: trunk/Source/WebCore/platform/ios/wak/WebCoreThreadSystemInterface.cpp (243794 => 243795)


--- trunk/Source/WebCore/platform/ios/wak/WebCoreThreadSystemInterface.cpp	2019-04-03 08:33:41 UTC (rev 243794)
+++ trunk/Source/WebCore/platform/ios/wak/WebCoreThreadSystemInterface.cpp	2019-04-03 12:42:38 UTC (rev 243795)
@@ -44,6 +44,7 @@
     if (didInit)
         return;
 
+    INIT(WebThreadLock);
     INIT(WebThreadIsLockedOrDisabled);
     INIT(WebThreadIsEnabled);
     INIT(WebThreadRun);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to