Title: [261206] trunk/Source/WebKit
Revision
261206
Author
cdu...@apple.com
Date
2020-05-05 16:52:48 -0700 (Tue, 05 May 2020)

Log Message

Crash under _LSSetApplicationInformationItem()
https://bugs.webkit.org/show_bug.cgi?id=211478
<rdar://problem/62201314>

Reviewed by Alex Christensen.

Given the crashes, I suspect it is not actually safe to call _LSSetApplicationInformationItem()
from a non main-thread like it was done in r238289. We still run the code asynchronously to
address the issue that r238289 was trying to fix but we now call _LSSetApplicationInformationItem()
on the main thread.

* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::updateProcessName):
(WebKit::WebProcess::updateActivePages):
(WebKit::setProcessNameQueue): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (261205 => 261206)


--- trunk/Source/WebKit/ChangeLog	2020-05-05 23:12:30 UTC (rev 261205)
+++ trunk/Source/WebKit/ChangeLog	2020-05-05 23:52:48 UTC (rev 261206)
@@ -1,3 +1,21 @@
+2020-05-05  Chris Dumez  <cdu...@apple.com>
+
+        Crash under _LSSetApplicationInformationItem()
+        https://bugs.webkit.org/show_bug.cgi?id=211478
+        <rdar://problem/62201314>
+
+        Reviewed by Alex Christensen.
+
+        Given the crashes, I suspect it is not actually safe to call _LSSetApplicationInformationItem()
+        from a non main-thread like it was done in r238289. We still run the code asynchronously to
+        address the issue that r238289 was trying to fix but we now call _LSSetApplicationInformationItem()
+        on the main thread.
+
+        * WebProcess/cocoa/WebProcessCocoa.mm:
+        (WebKit::WebProcess::updateProcessName):
+        (WebKit::WebProcess::updateActivePages):
+        (WebKit::setProcessNameQueue): Deleted.
+
 2020-05-05  Peng Liu  <peng.l...@apple.com>
 
         Update WebKitTestRunner to support running multiple video fullscreen and Picture-in-Picture tests simultaneously

Modified: trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (261205 => 261206)


--- trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2020-05-05 23:12:30 UTC (rev 261205)
+++ trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2020-05-05 23:52:48 UTC (rev 261206)
@@ -380,14 +380,6 @@
 #endif
 }
 
-#if PLATFORM(MAC)
-static WorkQueue& setProcessNameQueue()
-{
-    static NeverDestroyed<Ref<WorkQueue>> queue(WorkQueue::create("setProcessNameQueue"));
-    return queue.get().get();
-}
-#endif
-
 void WebProcess::updateProcessName()
 {
 #if PLATFORM(MAC)
@@ -410,7 +402,7 @@
         break;
     }
 
-    setProcessNameQueue().dispatch([this, applicationName = WTFMove(applicationName)] {
+    RunLoop::main().dispatch([this, applicationName = WTFMove(applicationName)] {
         // Note that it is important for _RegisterApplication() to have been called before setting the display name.
         auto error = _LSSetApplicationInformationItem(kLSDefaultSessionID, _LSGetCurrentApplicationASN(), _kLSDisplayNameKey, (CFStringRef)applicationName.get(), nullptr);
         ASSERT(!error);
@@ -678,11 +670,11 @@
 {
 #if PLATFORM(MAC)
     if (!overrideDisplayName) {
-        setProcessNameQueue().dispatch([activeOrigins = activePagesOrigins(m_pageMap)] {
+        RunLoop::main().dispatch([activeOrigins = activePagesOrigins(m_pageMap)] {
             _LSSetApplicationInformationItem(kLSDefaultSessionID, _LSGetCurrentApplicationASN(), CFSTR("LSActivePageUserVisibleOriginsKey"), (__bridge CFArrayRef)activeOrigins.get(), nullptr);
         });
     } else {
-        setProcessNameQueue().dispatch([name = overrideDisplayName.createCFString()] {
+        RunLoop::main().dispatch([name = overrideDisplayName.createCFString()] {
             _LSSetApplicationInformationItem(kLSDefaultSessionID, _LSGetCurrentApplicationASN(), _kLSDisplayNameKey, name.get(), nullptr);
         });
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to