Changeset 279905 in webkit


Ignore:
Timestamp:
Jul 13, 2021, 10:57:07 PM (4 years ago)
Author:
Jean-Yves Avenard
Message:

MediaSessionManagerCocoa::ensureCodecsRegistered() isn't thread-safe
https://bugs.webkit.org/show_bug.cgi?id=227940

Reviewed by Maciej Stachowiak.

C++11 static initializers aren't thread-safe due to architectural and compilation
option choices. So we use Grand Central Dispatch's dispatch_once instead.

  • platform/audio/cocoa/MediaSessionManagerCocoa.mm:

(WebCore::MediaSessionManagerCocoa::ensureCodecsRegistered):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r279904 r279905  
     12021-07-13  Jean-Yves Avenard  <jya@apple.com>
     2
     3        MediaSessionManagerCocoa::ensureCodecsRegistered() isn't thread-safe
     4        https://bugs.webkit.org/show_bug.cgi?id=227940
     5
     6        Reviewed by Maciej Stachowiak.
     7
     8        C++11 static initializers aren't thread-safe due to architectural and compilation
     9        option choices. So we use Grand Central Dispatch's dispatch_once instead.
     10
     11        * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
     12        (WebCore::MediaSessionManagerCocoa::ensureCodecsRegistered):
     13
    1142021-07-13  Jean-Yves Avenard  <jya@apple.com>
    215
  • trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm

    r278483 r279905  
    6666void MediaSessionManagerCocoa::ensureCodecsRegistered()
    6767{
    68     static bool sInitDone = []() {
    6968#if ENABLE(VP9)
     69    static dispatch_once_t onceToken;
     70    dispatch_once(&onceToken, ^{
    7071        if (shouldEnableVP9Decoder())
    7172            registerSupplementalVP9Decoder();
     
    7475        if (shouldEnableVP9SWDecoder())
    7576            registerWebKitVP9Decoder();
     77    });
    7678#endif
    77         return true;
    78     }();
    79     UNUSED_VARIABLE(sInitDone);
    8079}
    8180
Note: See TracChangeset for help on using the changeset viewer.