Changeset 263223 in webkit


Ignore:
Timestamp:
Jun 18, 2020 1:06:11 PM (4 years ago)
Author:
ggaren@apple.com
Message:

Unreviewed, re-landing r262904.

r263219 and r263175 should fix the test flakiness we saw.

Re-landed changeset:

"[Cocoa] Build callOnMainThread on WTF::RunLoop rather than on
a timer"
https://bugs.webkit.org/show_bug.cgi?id=213063
https://trac.webkit.org/changeset/262904

Location:
trunk/Source/WTF
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r263208 r263223  
     12020-06-18  Geoffrey Garen  <ggaren@apple.com>
     2
     3        Unreviewed, re-landing r262904.
     4
     5        r263219 and r263175 should fix the test flakiness we saw.
     6
     7        Re-landed changeset:
     8
     9        "[Cocoa] Build callOnMainThread on WTF::RunLoop rather than on
     10        a timer"
     11        https://bugs.webkit.org/show_bug.cgi?id=213063
     12        https://trac.webkit.org/changeset/262904
     13
    1142020-06-18  David Kilzer  <ddkilzer@apple.com>
    215
  • trunk/Source/WTF/wtf/cocoa/MainThreadCocoa.mm

    r262977 r263223  
    5555#endif
    5656
    57 static bool isTimerPosted; // This is only accessed on the main thread.
    58 
    5957#if USE(WEB_THREAD)
    6058// When the Web thread is enabled, we consider it to be the main thread, not pthread main.
     
    7270}
    7371
    74 static void timerFired(CFRunLoopTimerRef timer, void*)
    75 {
    76     CFRelease(timer);
    77     isTimerPosted = false;
    78 
    79     @autoreleasepool {
    80         WTF::dispatchFunctionsFromMainThread();
    81     }
    82 }
    83 
    84 static void postTimer()
    85 {
    86     ASSERT(isMainThread());
    87 
    88     if (isTimerPosted)
    89         return;
    90 
    91     isTimerPosted = true;
    92     CFRunLoopAddTimer(CFRunLoopGetCurrent(), CFRunLoopTimerCreate(0, 0, 0, 0, 0, timerFired, 0), kCFRunLoopCommonModes);
    93 }
    94 
    9572void scheduleDispatchFunctionsOnMainThread()
    9673{
    9774#if USE(WEB_THREAD)
    98     if (isWebThread()) {
    99         postTimer();
    100         return;
    101     }
    102 
    10375    if (auto* webRunLoop = RunLoop::webIfExists()) {
    10476        webRunLoop->dispatch(dispatchFunctionsFromMainThread);
    105         return;
    106     }
    107 #else
    108     if (isMainThread()) {
    109         postTimer();
    11077        return;
    11178    }
Note: See TracChangeset for help on using the changeset viewer.