Changeset 262977 in webkit


Ignore:
Timestamp:
Jun 12, 2020 2:58:25 PM (4 years ago)
Author:
Jason_Lawrence
Message:

Unreviewed, reverting r262904.

This commit broke a test on Mac wk1 Debug.

Reverted 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

    r262973 r262977  
     12020-06-12  Jason Lawrence  <lawrence.j@apple.com>
     2
     3        Unreviewed, reverting r262904.
     4
     5        This commit broke a test on Mac wk1 Debug.
     6
     7        Reverted 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-12  Adrian Perez de Castro  <aperez@igalia.com>
    215
  • trunk/Source/WTF/wtf/cocoa/MainThreadCocoa.mm

    r262904 r262977  
    5555#endif
    5656
     57static bool isTimerPosted; // This is only accessed on the main thread.
     58
    5759#if USE(WEB_THREAD)
    5860// When the Web thread is enabled, we consider it to be the main thread, not pthread main.
     
    7072}
    7173
     74static void timerFired(CFRunLoopTimerRef timer, void*)
     75{
     76    CFRelease(timer);
     77    isTimerPosted = false;
     78
     79    @autoreleasepool {
     80        WTF::dispatchFunctionsFromMainThread();
     81    }
     82}
     83
     84static 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
    7295void scheduleDispatchFunctionsOnMainThread()
    7396{
    7497#if USE(WEB_THREAD)
     98    if (isWebThread()) {
     99        postTimer();
     100        return;
     101    }
     102
    75103    if (auto* webRunLoop = RunLoop::webIfExists()) {
    76104        webRunLoop->dispatch(dispatchFunctionsFromMainThread);
     105        return;
     106    }
     107#else
     108    if (isMainThread()) {
     109        postTimer();
    77110        return;
    78111    }
Note: See TracChangeset for help on using the changeset viewer.