Changeset 275455 in webkit


Ignore:
Timestamp:
Apr 5, 2021 5:00:10 PM (3 years ago)
Author:
jer.noble@apple.com
Message:

[Cocoa] Calling AudioComponentFetchServerRegistrations on main thread causes launch time regression
https://bugs.webkit.org/show_bug.cgi?id=224137
<rdar://76137483>

Reviewed by Eric Carlson.

Run the command to fetch AudioComponent registration data on a generic background queue.

  • UIProcess/Cocoa/WebProcessProxyCocoa.mm:

(WebKit::WebProcessProxy::sendAudioComponentRegistrations):

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r275454 r275455  
     12021-04-05  Jer Noble  <jer.noble@apple.com>
     2
     3        [Cocoa] Calling AudioComponentFetchServerRegistrations on main thread causes launch time regression
     4        https://bugs.webkit.org/show_bug.cgi?id=224137
     5        <rdar://76137483>
     6
     7        Reviewed by Eric Carlson.
     8
     9        Run the command to fetch AudioComponent registration data on a generic background queue.
     10
     11        * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
     12        (WebKit::WebProcessProxy::sendAudioComponentRegistrations):
     13
    1142021-04-05  Christopher Reid  <chris.reid@sony.com>
    215
  • trunk/Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm

    r275410 r275455  
    292292        return;
    293293
    294     CFDataRef registrations { nullptr };
    295     if (noErr != AudioComponentFetchServerRegistrations(&registrations) || !registrations)
    296         return;
    297 
    298     auto registrationData = SharedBuffer::create(registrations);
    299     send(Messages::WebProcess::ConsumeAudioComponentRegistrations({ registrationData }), 0);
    300 }
    301 
    302 }
     294    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), [protectedThis = makeRef(*this)] () mutable {
     295        CFDataRef registrations { nullptr };
     296        if (noErr != AudioComponentFetchServerRegistrations(&registrations) || !registrations)
     297            return;
     298
     299        RunLoop::main().dispatch([protectedThis = WTFMove(protectedThis), registrations = retainPtr(registrations)] () mutable {
     300            auto registrationData = SharedBuffer::create(registrations.get());
     301            protectedThis->send(Messages::WebProcess::ConsumeAudioComponentRegistrations({ registrationData }), 0);
     302        });
     303    });
     304}
     305
     306}
Note: See TracChangeset for help on using the changeset viewer.