Title: [263432] trunk/Source
Revision
263432
Author
gga...@apple.com
Date
2020-06-23 17:27:44 -0700 (Tue, 23 Jun 2020)

Log Message

Remove WTF::setMainThreadCallbacksPaused
https://bugs.webkit.org/show_bug.cgi?id=213112

Reviewed by Tim Horton.

Source/WebCore:

* inspector/PageScriptDebugServer.cpp:
(WebCore::PageScriptDebugServer::setJavaScriptPaused):

Source/WTF:

setMainThreadCallbacksPaused pauses all uses of callOnMainThread. That
has too many side-effects. For example, you can scroll, but you can't
paint any large images (since they do async image decoding).

Meanwhile, setMainThreadCallbacksPaused doesn't pause RunLoop::dispatch.
So, other things don't get paused.

Let's just rely on suspending the ScriptExecutionContext and document
event queue. That should suspend _javascript_-visible stuff without
suspending engine-critical stuff.

* wtf/MainThread.cpp:
(WTF::dispatchFunctionsFromMainThread):
(WTF::setMainThreadCallbacksPaused): Deleted.
* wtf/MainThread.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (263431 => 263432)


--- trunk/Source/WTF/ChangeLog	2020-06-23 23:35:04 UTC (rev 263431)
+++ trunk/Source/WTF/ChangeLog	2020-06-24 00:27:44 UTC (rev 263432)
@@ -1,3 +1,26 @@
+2020-06-23  Geoffrey Garen  <gga...@apple.com>
+
+        Remove WTF::setMainThreadCallbacksPaused
+        https://bugs.webkit.org/show_bug.cgi?id=213112
+
+        Reviewed by Tim Horton.
+
+        setMainThreadCallbacksPaused pauses all uses of callOnMainThread. That
+        has too many side-effects. For example, you can scroll, but you can't
+        paint any large images (since they do async image decoding).
+
+        Meanwhile, setMainThreadCallbacksPaused doesn't pause RunLoop::dispatch.
+        So, other things don't get paused.
+
+        Let's just rely on suspending the ScriptExecutionContext and document
+        event queue. That should suspend _javascript_-visible stuff without
+        suspending engine-critical stuff.
+
+        * wtf/MainThread.cpp:
+        (WTF::dispatchFunctionsFromMainThread):
+        (WTF::setMainThreadCallbacksPaused): Deleted.
+        * wtf/MainThread.h:
+
 2020-06-23  Chris Dumez  <cdu...@apple.com>
 
         Remove a lot of unnecessary calls to Ref::copyRef()

Modified: trunk/Source/WTF/wtf/MainThread.cpp (263431 => 263432)


--- trunk/Source/WTF/wtf/MainThread.cpp	2020-06-23 23:35:04 UTC (rev 263431)
+++ trunk/Source/WTF/wtf/MainThread.cpp	2020-06-24 00:27:44 UTC (rev 263432)
@@ -41,7 +41,6 @@
 
 namespace WTF {
 
-static bool callbacksPaused; // This global variable is only accessed from main thread.
 static Lock mainThreadFunctionQueueMutex;
 
 static Deque<Function<void ()>>& functionQueue()
@@ -74,9 +73,6 @@
 {
     ASSERT(isMainThread());
 
-    if (callbacksPaused)
-        return;
-
     auto startTime = MonotonicTime::now();
 
     Function<void ()> function;
@@ -132,19 +128,6 @@
         scheduleDispatchFunctionsOnMainThread();
 }
 
-void setMainThreadCallbacksPaused(bool paused)
-{
-    ASSERT(isMainThread());
-
-    if (callbacksPaused == paused)
-        return;
-
-    callbacksPaused = paused;
-
-    if (!callbacksPaused)
-        scheduleDispatchFunctionsOnMainThread();
-}
-
 bool isMainThreadOrGCThread()
 {
     if (Thread::mayBeGCThread())

Modified: trunk/Source/WTF/wtf/MainThread.h (263431 => 263432)


--- trunk/Source/WTF/wtf/MainThread.h	2020-06-23 23:35:04 UTC (rev 263431)
+++ trunk/Source/WTF/wtf/MainThread.h	2020-06-24 00:27:44 UTC (rev 263432)
@@ -50,8 +50,6 @@
 WTF_EXPORT_PRIVATE void callOnWebThreadOrDispatchAsyncOnMainThread(void (^block)());
 #endif
 
-WTF_EXPORT_PRIVATE void setMainThreadCallbacksPaused(bool paused);
-
 WTF_EXPORT_PRIVATE bool isMainThread();
 
 WTF_EXPORT_PRIVATE bool canCurrentThreadAccessThreadLocalData(Thread&);
@@ -88,7 +86,6 @@
 using WTF::isMainThreadOrGCThread;
 using WTF::isUIThread;
 using WTF::isWebThread;
-using WTF::setMainThreadCallbacksPaused;
 #if PLATFORM(COCOA)
 using WTF::dispatchAsyncOnMainThreadWithWebThreadLockIfNeeded;
 using WTF::callOnWebThreadOrDispatchAsyncOnMainThread;

Modified: trunk/Source/WebCore/ChangeLog (263431 => 263432)


--- trunk/Source/WebCore/ChangeLog	2020-06-23 23:35:04 UTC (rev 263431)
+++ trunk/Source/WebCore/ChangeLog	2020-06-24 00:27:44 UTC (rev 263432)
@@ -1,3 +1,13 @@
+2020-06-23  Geoffrey Garen  <gga...@apple.com>
+
+        Remove WTF::setMainThreadCallbacksPaused
+        https://bugs.webkit.org/show_bug.cgi?id=213112
+
+        Reviewed by Tim Horton.
+
+        * inspector/PageScriptDebugServer.cpp:
+        (WebCore::PageScriptDebugServer::setJavaScriptPaused):
+
 2020-06-23  Chris Dumez  <cdu...@apple.com>
 
         Unreviewed, update xcfilelist files after some recent WebXR changes.

Modified: trunk/Source/WebCore/inspector/PageScriptDebugServer.cpp (263431 => 263432)


--- trunk/Source/WebCore/inspector/PageScriptDebugServer.cpp	2020-06-23 23:35:04 UTC (rev 263431)
+++ trunk/Source/WebCore/inspector/PageScriptDebugServer.cpp	2020-06-24 00:27:44 UTC (rev 263432)
@@ -135,8 +135,6 @@
 
 void PageScriptDebugServer::setJavaScriptPaused(const PageGroup& pageGroup, bool paused)
 {
-    setMainThreadCallbacksPaused(paused);
-
     for (auto& page : pageGroup.pages()) {
         for (Frame* frame = &page->mainFrame(); frame; frame = frame->tree().traverseNext())
             setJavaScriptPaused(*frame, paused);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to