Changeset 264993 in webkit


Ignore:
Timestamp:
Jul 28, 2020 10:03:00 AM (4 years ago)
Author:
Karl Rackler
Message:

Unreviewed, reverting r264955.

Reverting because this commit may have caused issues with
tests.

Reverted changeset:

"WebCoreResourceHandleAsOperationQueueDelegate can use
RunLoop::dispatch"
https://bugs.webkit.org/show_bug.cgi?id=214771
https://trac.webkit.org/changeset/264955

Location:
trunk/Source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r264955 r264993  
     12020-07-28  Karl Rackler  <rackler@apple.com>
     2
     3        Unreviewed, reverting r264955.
     4
     5        Reverting because this commit may have caused issues with
     6        tests.
     7
     8        Reverted changeset:
     9
     10        "WebCoreResourceHandleAsOperationQueueDelegate can use
     11        RunLoop::dispatch"
     12        https://bugs.webkit.org/show_bug.cgi?id=214771
     13        https://trac.webkit.org/changeset/264955
     14
    1152020-07-27  Geoffrey Garen  <ggaren@apple.com>
    216
  • trunk/Source/WTF/wtf/cf/RunLoopCF.cpp

    r264955 r264993  
    8787void RunLoop::dispatch(const SchedulePairHashSet& schedulePairs, Function<void()>&& function)
    8888{
    89     if (schedulePairs.size() == 1) {
    90         auto& schedulePair = *schedulePairs.begin();
    91         if (schedulePair->mode() == kCFRunLoopCommonModes && schedulePair->runLoop() == RunLoop::main().m_runLoop)
    92             return RunLoop::main().dispatch(WTFMove(function));
    93     }
    94 
    9589    auto timer = createTimer(0_s, false, [] (CFRunLoopTimerRef timer, void* context) {
    9690        AutodrainedPool pool;
  • trunk/Source/WebCore/ChangeLog

    r264992 r264993  
     12020-07-28  Karl Rackler  <rackler@apple.com>
     2
     3        Unreviewed, reverting r264955.
     4
     5        Reverting because this commit may have caused issues with
     6        tests.
     7
     8        Reverted changeset:
     9
     10        "WebCoreResourceHandleAsOperationQueueDelegate can use
     11        RunLoop::dispatch"
     12        https://bugs.webkit.org/show_bug.cgi?id=214771
     13        https://trac.webkit.org/changeset/264955
     14
    1152020-07-28  Saam Barati  <sbarati@apple.com>
    216
  • trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm

    r264955 r264993  
    4141#import <wtf/BlockPtr.h>
    4242#import <wtf/MainThread.h>
    43 #import <wtf/RunLoop.h>
    4443
    4544using namespace WebCore;
     45
     46static bool scheduledWithCustomRunLoopMode(const Optional<SchedulePairHashSet>& pairs)
     47{
     48    if (!pairs)
     49        return false;
     50    for (auto& pair : *pairs) {
     51        auto mode = pair->mode();
     52        if (mode != kCFRunLoopCommonModes && mode != kCFRunLoopDefaultMode)
     53            return true;
     54    }
     55    return false;
     56}
    4657
    4758@implementation WebCoreResourceHandleAsOperationQueueDelegate
     
    5364        return m_messageQueue->append(makeUnique<Function<void()>>(WTFMove(function)));
    5465
    55     if (!m_scheduledPairs)
     66    // This is the common case.
     67    if (!scheduledWithCustomRunLoopMode(m_scheduledPairs))
    5668        return callOnMainThread(WTFMove(function));
    5769
    58     RunLoop::dispatch(*m_scheduledPairs, WTFMove(function));
     70    // If we have been scheduled in a custom run loop mode, schedule a block in that mode.
     71    auto block = makeBlockPtr([alreadyCalled = false, function = WTFMove(function)] () mutable {
     72        if (alreadyCalled)
     73            return;
     74        alreadyCalled = true;
     75        function();
     76        function = nullptr;
     77    });
     78    for (auto& pair : *m_scheduledPairs)
     79        CFRunLoopPerformBlock(pair->runLoop(), pair->mode(), block.get());
    5980}
    6081
Note: See TracChangeset for help on using the changeset viewer.