Changeset 263636 in webkit


Ignore:
Timestamp:
Jun 28, 2020 2:34:20 PM (4 years ago)
Author:
Chris Dumez
Message:

Fix thread-safety issue in webProcessPoolHighDynamicRangeDidChangeCallback()
https://bugs.webkit.org/show_bug.cgi?id=213689
<rdar://problem/64443996>

Reviewed by Darin Adler.

webProcessPoolHighDynamicRangeDidChangeCallback() gets called on a background thread so we
need to make sure we dispatch to the main thread before we iterate over the process pools.

  • UIProcess/Cocoa/WebProcessPoolCocoa.mm:

(WebKit::webProcessPoolHighDynamicRangeDidChangeCallback):

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r263635 r263636  
     12020-06-28  Chris Dumez  <cdumez@apple.com>
     2
     3        Fix thread-safety issue in webProcessPoolHighDynamicRangeDidChangeCallback()
     4        https://bugs.webkit.org/show_bug.cgi?id=213689
     5        <rdar://problem/64443996>
     6
     7        Reviewed by Darin Adler.
     8
     9        webProcessPoolHighDynamicRangeDidChangeCallback() gets called on a background thread so we
     10        need to make sure we dispatch to the main thread before we iterate over the process pools.
     11
     12        * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
     13        (WebKit::webProcessPoolHighDynamicRangeDidChangeCallback):
     14
    1152020-06-28  Geoffrey Garen  <ggaren@apple.com>
    216
  • trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm

    r263320 r263636  
    904904static void webProcessPoolHighDynamicRangeDidChangeCallback(CMNotificationCenterRef, const void*, CFStringRef notificationName, const void*, CFTypeRef)
    905905{
    906     auto screenProperties = WebCore::collectScreenProperties();
    907     for (auto& processPool : WebProcessPool::allProcessPools())
    908         processPool->sendToAllProcesses(Messages::WebProcess::SetScreenProperties(screenProperties));
     906    dispatch_async(dispatch_get_main_queue(), ^{
     907        auto properties = WebCore::collectScreenProperties();
     908        for (auto& pool : WebProcessPool::allProcessPools())
     909            pool->sendToAllProcesses(Messages::WebProcess::SetScreenProperties(properties));
     910    });
    909911}
    910912
Note: See TracChangeset for help on using the changeset viewer.