Changeset 251514 in webkit


Ignore:
Timestamp:
Oct 23, 2019 5:05:58 PM (4 years ago)
Author:
Truitt Savell
Message:

Unreviewed, rolling out r251261.

This broke multiple tests

Reverted changeset:

"Using version 1 CFRunloopSource for faster task dispatch"
https://bugs.webkit.org/show_bug.cgi?id=202874
https://trac.webkit.org/changeset/251261

Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r251513 r251514  
     12019-10-23  Truitt Savell  <tsavell@apple.com>
     2
     3        Unreviewed, rolling out r251261.
     4
     5        This broke multiple tests
     6
     7        Reverted changeset:
     8
     9        "Using version 1 CFRunloopSource for faster task dispatch"
     10        https://bugs.webkit.org/show_bug.cgi?id=202874
     11        https://trac.webkit.org/changeset/251261
     12
    1132019-10-23  Truitt Savell  <tsavell@apple.com>
    214
  • trunk/LayoutTests/inspector/css/pseudo-creation-expected.txt

    r251261 r251514  
    1313Calling "createElementWithClass("test-pseudo-with-content")"...
    1414Checking for nodes with class ".test-pseudo-with-content"...
     15PASS: Created ::before pseudo element
    1516PASS: There should be 1 node with the class ".test-pseudo-with-content".
    16 PASS: Created ::before pseudo element
    1717
    1818Calling "removeElementWithClass("test-pseudo-with-content")"...
    1919Checking for nodes with class ".test-pseudo-with-content"...
     20PASS: Removed ::before pseudo element
    2021PASS: There should be 0 node with the class ".test-pseudo-with-content".
    21 PASS: Removed ::before pseudo element
    2222
  • trunk/LayoutTests/inspector/css/pseudo-creation.html

    r251261 r251514  
    2727function test() {
    2828    let documentNode = null;
    29     let pseudoElementAdded = null;
    30     let pseudoElementRemoved = null;
     29    let pseudoElement = null;
    3130
    3231    function handlePromiseReject(error) {
     
    5857    }
    5958
    60     function createElementWithClass(className, shouldCheckElement) {
     59    function createElementWithClass(className) {
    6160        return evaluateWithLog(`createElementWithClass("${className}")`)
    6261        .then(() => checkElementsWithClass(className, 1))
    63         .then(() => {
    64             if (shouldCheckElement) {
    65                 if (pseudoElementAdded)
    66                     ProtocolTest.pass(`Created ::${pseudoElementAdded.pseudoType} pseudo element`);
    67                 else
    68                     return pseudoElementAddedPromise.then(() => { ProtocolTest.pass(`Created ::${pseudoElementAdded.pseudoType} pseudo element`); });
    69             }
    70         })
    7162        .catch(handlePromiseReject);
    7263    }
    7364
    74     function removeElementWithClass(className, shouldCheckElement) {
     65    function removeElementWithClass(className) {
    7566        return evaluateWithLog(`removeElementWithClass("${className}")`)
    7667        .then(() => checkElementsWithClass(className, 0))
    77         .then(() => {
    78             if (shouldCheckElement) {
    79                 if (pseudoElementRemoved)
    80                     ProtocolTest.expectEqual(pseudoElementRemoved.pseudoElementId, pseudoElementAdded.nodeId, `Removed ::${pseudoElementAdded.pseudoType} pseudo element`);
    81                 else
    82                     return pseudoElementRemovedPromise.then(() => { ProtocolTest.expectEqual(pseudoElementRemoved.pseudoElementId, pseudoElementAdded.nodeId, `Removed ::${pseudoElementAdded.pseudoType} pseudo element`); });
    83             }
    84         })
    8568        .catch(handlePromiseReject);
    8669    }
    8770
    88     let pseudoElementAddedPromise = InspectorProtocol.awaitEvent({event: "DOM.pseudoElementAdded"}).then((event) => { pseudoElementAdded = event.params.pseudoElement});
    89     let pseudoElementRemovedPromise = InspectorProtocol.awaitEvent({event: "DOM.pseudoElementRemoved"}).then((event) => { pseudoElementRemoved = event.params});
     71    InspectorProtocol.eventHandler["DOM.pseudoElementAdded"] = (response) => {
     72        pseudoElement = response.params.pseudoElement;
    9073
     74        ProtocolTest.pass(`Created ::${pseudoElement.pseudoType} pseudo element`);
     75    };
     76
     77    InspectorProtocol.eventHandler["DOM.pseudoElementRemoved"] = (response) => {
     78        ProtocolTest.expectEqual(response.params.pseudoElementId, pseudoElement.nodeId, `Removed ::${pseudoElement.pseudoType} pseudo element`);
     79    };
    9180
    9281    ProtocolTest.log("Requesting document...");
     
    9786
    9887        Promise.resolve()
    99         .then(() => createElementWithClass("test-pseudo-without-content"), false)
    100         .then(() => removeElementWithClass("test-pseudo-without-content"), false)
    101         .then(() => createElementWithClass("test-pseudo-with-content", true))
    102         .then(() => removeElementWithClass("test-pseudo-with-content", true))
     88        .then(() => createElementWithClass("test-pseudo-without-content"))
     89        .then(() => removeElementWithClass("test-pseudo-without-content"))
     90        .then(() => createElementWithClass("test-pseudo-with-content"))
     91        .then(() => removeElementWithClass("test-pseudo-with-content"))
    10392        .then(() => ProtocolTest.completeTest())
    10493        .catch(handlePromiseReject);
  • trunk/Source/WTF/ChangeLog

    r251508 r251514  
     12019-10-23  Truitt Savell  <tsavell@apple.com>
     2
     3        Unreviewed, rolling out r251261.
     4
     5        This broke multiple tests
     6
     7        Reverted changeset:
     8
     9        "Using version 1 CFRunloopSource for faster task dispatch"
     10        https://bugs.webkit.org/show_bug.cgi?id=202874
     11        https://trac.webkit.org/changeset/251261
     12
    1132019-10-23  Myles C. Maxfield  <mmaxfield@apple.com>
    214
  • trunk/Source/WTF/wtf/RunLoop.cpp

    r251261 r251514  
    3434
    3535static RunLoop* s_mainRunLoop;
    36 #if USE(WEB_THREAD)
    37 static RunLoop* s_webRunLoop;
    38 #endif
    3936
    4037// Helper class for ThreadSpecificData.
     
    7269    return *s_mainRunLoop;
    7370}
    74 
    75 #if USE(WEB_THREAD)
    76 void RunLoop::initializeWebRunLoop()
    77 {
    78     s_webRunLoop = &RunLoop::current();
    79 }
    80 
    81 RunLoop& RunLoop::web()
    82 {
    83     ASSERT(s_webRunLoop);
    84     return *s_webRunLoop;
    85 }
    86 #endif
    8771
    8872bool RunLoop::isMain()
  • trunk/Source/WTF/wtf/RunLoop.h

    r251261 r251514  
    5050    // can be called from any thread).
    5151    WTF_EXPORT_PRIVATE static void initializeMainRunLoop();
    52 #if USE(WEB_THREAD)
    53     WTF_EXPORT_PRIVATE static void initializeWebRunLoop();
    54 #endif
    5552
    5653    WTF_EXPORT_PRIVATE static RunLoop& current();
    5754    WTF_EXPORT_PRIVATE static RunLoop& main();
    58 #if USE(WEB_THREAD)
    59     WTF_EXPORT_PRIVATE static RunLoop& web();
    60 #endif
    6155    WTF_EXPORT_PRIVATE static bool isMain();
    6256    ~RunLoop();
     
    185179    Lock m_loopLock;
    186180#elif USE(COCOA_EVENT_LOOP)
    187     static void performWork(CFMachPortRef, void* msg, CFIndex size, void* info);
     181    static void performWork(void*);
    188182    RetainPtr<CFRunLoopRef> m_runLoop;
    189183    RetainPtr<CFRunLoopSourceRef> m_runLoopSource;
    190     RetainPtr<CFMachPortRef> m_port;
    191184#elif USE(GLIB_EVENT_LOOP)
    192185    GRefPtr<GMainContext> m_mainContext;
  • trunk/Source/WTF/wtf/cf/RunLoopCF.cpp

    r251261 r251514  
    2929#include <CoreFoundation/CoreFoundation.h>
    3030#include <dispatch/dispatch.h>
    31 #include <mach/mach.h>
    3231#include <wtf/AutodrainedPool.h>
    3332
    3433namespace WTF {
    3534
    36 void RunLoop::performWork(CFMachPortRef, void*, CFIndex, void* info)
     35void RunLoop::performWork(void* context)
    3736{
    3837    AutodrainedPool pool;
    39     static_cast<RunLoop*>(info)->performWork();
     38    static_cast<RunLoop*>(context)->performWork();
    4039}
    4140
     
    4342    : m_runLoop(CFRunLoopGetCurrent())
    4443{
    45     CFMachPortContext context = { 0, this, nullptr, nullptr, nullptr };
    46     m_port = adoptCF(CFMachPortCreate(kCFAllocatorDefault, performWork, &context, nullptr));
    47     m_runLoopSource = adoptCF(CFMachPortCreateRunLoopSource(kCFAllocatorDefault, m_port.get(), 0));
     44    CFRunLoopSourceContext context = { 0, this, 0, 0, 0, 0, 0, 0, 0, performWork };
     45    m_runLoopSource = adoptCF(CFRunLoopSourceCreate(kCFAllocatorDefault, 0, &context));
    4846    CFRunLoopAddSource(m_runLoop.get(), m_runLoopSource.get(), kCFRunLoopCommonModes);
    4947}
     
    5149RunLoop::~RunLoop()
    5250{
    53     CFMachPortInvalidate(m_port.get());
    5451    CFRunLoopSourceInvalidate(m_runLoopSource.get());
    5552}
     
    6259void RunLoop::wakeUp()
    6360{
    64     mach_msg_header_t header;
    65     header.msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_COPY_SEND, 0);
    66     header.msgh_size = sizeof(mach_msg_header_t);
    67     header.msgh_remote_port = CFMachPortGetPort(m_port.get());
    68     header.msgh_local_port = MACH_PORT_NULL;
    69     header.msgh_id = 0;
    70     mach_msg_return_t result = mach_msg(&header, MACH_SEND_MSG | MACH_SEND_TIMEOUT, header.msgh_size, 0, MACH_PORT_NULL, 0, MACH_PORT_NULL);
    71     RELEASE_ASSERT(result == MACH_MSG_SUCCESS || result == MACH_SEND_TIMED_OUT);
    72     if (result == MACH_SEND_TIMED_OUT)
    73         mach_msg_destroy(&header);
     61    CFRunLoopSourceSignal(m_runLoopSource.get());
     62    CFRunLoopWakeUp(m_runLoop.get());
    7463}
    7564
  • trunk/Source/WTF/wtf/cocoa/MainThreadCocoa.mm

    r251261 r251514  
    3737#import <wtf/HashSet.h>
    3838#import <wtf/RetainPtr.h>
    39 #import <wtf/RunLoop.h>
    4039#import <wtf/SchedulePair.h>
    4140#import <wtf/Threading.h>
     
    4443#include <wtf/ios/WebCoreThread.h>
    4544#endif
     45
     46@interface JSWTFMainThreadCaller : NSObject
     47- (void)call;
     48@end
     49
     50@implementation JSWTFMainThreadCaller
     51
     52- (void)call
     53{
     54    WTF::dispatchFunctionsFromMainThread();
     55}
     56
     57@end
    4658
    4759#define LOG_CHANNEL_PREFIX Log
     
    5567#endif
    5668
     69
     70static JSWTFMainThreadCaller* staticMainThreadCaller;
    5771static bool isTimerPosted; // This is only accessed on the main thread.
    5872
     
    7185        RELEASE_LOG_FAULT(Threading, "WebKit Threading Violation - initial use of WebKit from a secondary thread.");
    7286    ASSERT(pthread_main_np());
     87
     88    ASSERT(!staticMainThreadCaller);
     89    staticMainThreadCaller = [[JSWTFMainThreadCaller alloc] init];
    7390}
    7491
     
    96113void scheduleDispatchFunctionsOnMainThread()
    97114{
     115    ASSERT(staticMainThreadCaller);
     116   
    98117#if USE(WEB_THREAD)
    99118    if (isWebThread()) {
     
    103122
    104123    if (mainThreadPthread) {
    105         RunLoop::web().dispatch([] {
    106             WTF::dispatchFunctionsFromMainThread();
    107         });
     124        [staticMainThreadCaller performSelector:@selector(call) onThread:mainThreadNSThread withObject:nil waitUntilDone:NO];
    108125        return;
    109126    }
     
    115132#endif
    116133
    117     RunLoop::main().dispatch([] {
    118         WTF::dispatchFunctionsFromMainThread();
    119     });
     134    [staticMainThreadCaller performSelectorOnMainThread:@selector(call) withObject:nil waitUntilDone:NO];
    120135}
    121136
     
    182197        mainThreadNSThread = [NSThread currentThread];
    183198        sWebThread = &Thread::current();
    184         RunLoop::initializeWebRunLoop();
    185199    });
    186200}
  • trunk/Tools/ChangeLog

    r251500 r251514  
     12019-10-23  Truitt Savell  <tsavell@apple.com>
     2
     3        Unreviewed, rolling out r251261.
     4
     5        This broke multiple tests
     6
     7        Reverted changeset:
     8
     9        "Using version 1 CFRunloopSource for faster task dispatch"
     10        https://bugs.webkit.org/show_bug.cgi?id=202874
     11        https://trac.webkit.org/changeset/251261
     12
    1132019-10-21  Jiewen Tan  <jiewen_tan@apple.com>
    214
  • trunk/Tools/TestWebKitAPI/Tests/WebKit/getUserMedia.html

    r251261 r251514  
    33    <head>
    44        <script>
    5             let streamPromise = Promise.resolve();
     5
     6            let stream = null;
    67
    78            function promptForCapture()
    89            {
    9                 streamPromise = navigator.mediaDevices.enumerateDevices().then(() => {
     10                navigator.mediaDevices.enumerateDevices().then(() => {
    1011                    return navigator.mediaDevices.getUserMedia({ audio: false, video: true })
    11                 });
    12 
    13                 streamPromise.then((stream) => {
     12                }).then((s) => {
    1413                    stream = s;
    1514                    video.srcObject = stream;
     
    2019            function stop(kind)
    2120            {
    22                 streamPromise.then((stream) => {
    23                     let activeTracks = [];
    24                     stream.getTracks().forEach(track => {
    25                         if (!kind || track.kind == kind)
    26                             track.stop();
    27                         else
    28                             activeTracks.push(track);
    29                     });
    30  
    31                     if (!activeTracks.length) {
    32                         streamPromiseDidResolve = false;
    33                         video.srcObject = null;
    34                     }
     21                let activeTracks = [];
     22                stream.getTracks().forEach(track => {
     23                    if (!kind || track.kind == kind)
     24                        track.stop();
     25                    else
     26                        activeTracks.push(track);
    3527                });
     28
     29                if (!activeTracks.length) {
     30                    stream = null;
     31                    video.srcObject = null;
     32                }
    3633            }
    37 
    38             let streamPromiseDidResolve = false;
    3934
    4035            function haveStream()
    4136            {
    42                 // Our caller polls repeatedly until our promise resolves.
    43                 streamPromise.then((stream) => streamPromiseDidResolve = !!stream);
    44                 return streamPromiseDidResolve;
     37                return stream !== null;
    4538            }
    4639
     
    6154            function captureAudio()
    6255            {
    63                 streamPromise = navigator.mediaDevices.getUserMedia({audio: true});
     56                navigator.mediaDevices.getUserMedia({audio: true}).then(s => stream = s);
    6457            }
    6558
    6659            function captureAudioAndVideo()
    6760            {
    68                 streamPromise = navigator.mediaDevices.getUserMedia({audio: true, video: true});
     61                navigator.mediaDevices.getUserMedia({audio: true, video: true}).then(s => stream = s);
    6962            }
    7063        </script>
Note: See TracChangeset for help on using the changeset viewer.