Changeset 261206 in webkit


Ignore:
Timestamp:
May 5, 2020 4:52:48 PM (4 years ago)
Author:
Chris Dumez
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.

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r261203 r261206  
     12020-05-05  Chris Dumez  <cdumez@apple.com>
     2
     3        Crash under _LSSetApplicationInformationItem()
     4        https://bugs.webkit.org/show_bug.cgi?id=211478
     5        <rdar://problem/62201314>
     6
     7        Reviewed by Alex Christensen.
     8
     9        Given the crashes, I suspect it is not actually safe to call _LSSetApplicationInformationItem()
     10        from a non main-thread like it was done in r238289. We still run the code asynchronously to
     11        address the issue that r238289 was trying to fix but we now call _LSSetApplicationInformationItem()
     12        on the main thread.
     13
     14        * WebProcess/cocoa/WebProcessCocoa.mm:
     15        (WebKit::WebProcess::updateProcessName):
     16        (WebKit::WebProcess::updateActivePages):
     17        (WebKit::setProcessNameQueue): Deleted.
     18
    1192020-05-05  Peng Liu  <peng.liu6@apple.com>
    220
  • trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm

    r261145 r261206  
    381381}
    382382
    383 #if PLATFORM(MAC)
    384 static WorkQueue& setProcessNameQueue()
    385 {
    386     static NeverDestroyed<Ref<WorkQueue>> queue(WorkQueue::create("setProcessNameQueue"));
    387     return queue.get().get();
    388 }
    389 #endif
    390 
    391383void WebProcess::updateProcessName()
    392384{
     
    411403    }
    412404
    413     setProcessNameQueue().dispatch([this, applicationName = WTFMove(applicationName)] {
     405    RunLoop::main().dispatch([this, applicationName = WTFMove(applicationName)] {
    414406        // Note that it is important for _RegisterApplication() to have been called before setting the display name.
    415407        auto error = _LSSetApplicationInformationItem(kLSDefaultSessionID, _LSGetCurrentApplicationASN(), _kLSDisplayNameKey, (CFStringRef)applicationName.get(), nullptr);
     
    679671#if PLATFORM(MAC)
    680672    if (!overrideDisplayName) {
    681         setProcessNameQueue().dispatch([activeOrigins = activePagesOrigins(m_pageMap)] {
     673        RunLoop::main().dispatch([activeOrigins = activePagesOrigins(m_pageMap)] {
    682674            _LSSetApplicationInformationItem(kLSDefaultSessionID, _LSGetCurrentApplicationASN(), CFSTR("LSActivePageUserVisibleOriginsKey"), (__bridge CFArrayRef)activeOrigins.get(), nullptr);
    683675        });
    684676    } else {
    685         setProcessNameQueue().dispatch([name = overrideDisplayName.createCFString()] {
     677        RunLoop::main().dispatch([name = overrideDisplayName.createCFString()] {
    686678            _LSSetApplicationInformationItem(kLSDefaultSessionID, _LSGetCurrentApplicationASN(), _kLSDisplayNameKey, name.get(), nullptr);
    687679        });
Note: See TracChangeset for help on using the changeset viewer.