Changeset 251514 in webkit
- Timestamp:
- Oct 23, 2019 5:05:58 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r251513 r251514 1 2019-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 1 13 2019-10-23 Truitt Savell <tsavell@apple.com> 2 14 -
trunk/LayoutTests/inspector/css/pseudo-creation-expected.txt
r251261 r251514 13 13 Calling "createElementWithClass("test-pseudo-with-content")"... 14 14 Checking for nodes with class ".test-pseudo-with-content"... 15 PASS: Created ::before pseudo element 15 16 PASS: There should be 1 node with the class ".test-pseudo-with-content". 16 PASS: Created ::before pseudo element17 17 18 18 Calling "removeElementWithClass("test-pseudo-with-content")"... 19 19 Checking for nodes with class ".test-pseudo-with-content"... 20 PASS: Removed ::before pseudo element 20 21 PASS: There should be 0 node with the class ".test-pseudo-with-content". 21 PASS: Removed ::before pseudo element22 22 -
trunk/LayoutTests/inspector/css/pseudo-creation.html
r251261 r251514 27 27 function test() { 28 28 let documentNode = null; 29 let pseudoElementAdded = null; 30 let pseudoElementRemoved = null; 29 let pseudoElement = null; 31 30 32 31 function handlePromiseReject(error) { … … 58 57 } 59 58 60 function createElementWithClass(className , shouldCheckElement) {59 function createElementWithClass(className) { 61 60 return evaluateWithLog(`createElementWithClass("${className}")`) 62 61 .then(() => checkElementsWithClass(className, 1)) 63 .then(() => {64 if (shouldCheckElement) {65 if (pseudoElementAdded)66 ProtocolTest.pass(`Created ::${pseudoElementAdded.pseudoType} pseudo element`);67 else68 return pseudoElementAddedPromise.then(() => { ProtocolTest.pass(`Created ::${pseudoElementAdded.pseudoType} pseudo element`); });69 }70 })71 62 .catch(handlePromiseReject); 72 63 } 73 64 74 function removeElementWithClass(className , shouldCheckElement) {65 function removeElementWithClass(className) { 75 66 return evaluateWithLog(`removeElementWithClass("${className}")`) 76 67 .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 else82 return pseudoElementRemovedPromise.then(() => { ProtocolTest.expectEqual(pseudoElementRemoved.pseudoElementId, pseudoElementAdded.nodeId, `Removed ::${pseudoElementAdded.pseudoType} pseudo element`); });83 }84 })85 68 .catch(handlePromiseReject); 86 69 } 87 70 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; 90 73 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 }; 91 80 92 81 ProtocolTest.log("Requesting document..."); … … 97 86 98 87 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")) 103 92 .then(() => ProtocolTest.completeTest()) 104 93 .catch(handlePromiseReject); -
trunk/Source/WTF/ChangeLog
r251508 r251514 1 2019-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 1 13 2019-10-23 Myles C. Maxfield <mmaxfield@apple.com> 2 14 -
trunk/Source/WTF/wtf/RunLoop.cpp
r251261 r251514 34 34 35 35 static RunLoop* s_mainRunLoop; 36 #if USE(WEB_THREAD)37 static RunLoop* s_webRunLoop;38 #endif39 36 40 37 // Helper class for ThreadSpecificData. … … 72 69 return *s_mainRunLoop; 73 70 } 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 #endif87 71 88 72 bool RunLoop::isMain() -
trunk/Source/WTF/wtf/RunLoop.h
r251261 r251514 50 50 // can be called from any thread). 51 51 WTF_EXPORT_PRIVATE static void initializeMainRunLoop(); 52 #if USE(WEB_THREAD)53 WTF_EXPORT_PRIVATE static void initializeWebRunLoop();54 #endif55 52 56 53 WTF_EXPORT_PRIVATE static RunLoop& current(); 57 54 WTF_EXPORT_PRIVATE static RunLoop& main(); 58 #if USE(WEB_THREAD)59 WTF_EXPORT_PRIVATE static RunLoop& web();60 #endif61 55 WTF_EXPORT_PRIVATE static bool isMain(); 62 56 ~RunLoop(); … … 185 179 Lock m_loopLock; 186 180 #elif USE(COCOA_EVENT_LOOP) 187 static void performWork( CFMachPortRef, void* msg, CFIndex size, void* info);181 static void performWork(void*); 188 182 RetainPtr<CFRunLoopRef> m_runLoop; 189 183 RetainPtr<CFRunLoopSourceRef> m_runLoopSource; 190 RetainPtr<CFMachPortRef> m_port;191 184 #elif USE(GLIB_EVENT_LOOP) 192 185 GRefPtr<GMainContext> m_mainContext; -
trunk/Source/WTF/wtf/cf/RunLoopCF.cpp
r251261 r251514 29 29 #include <CoreFoundation/CoreFoundation.h> 30 30 #include <dispatch/dispatch.h> 31 #include <mach/mach.h>32 31 #include <wtf/AutodrainedPool.h> 33 32 34 33 namespace WTF { 35 34 36 void RunLoop::performWork( CFMachPortRef, void*, CFIndex, void* info)35 void RunLoop::performWork(void* context) 37 36 { 38 37 AutodrainedPool pool; 39 static_cast<RunLoop*>( info)->performWork();38 static_cast<RunLoop*>(context)->performWork(); 40 39 } 41 40 … … 43 42 : m_runLoop(CFRunLoopGetCurrent()) 44 43 { 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)); 48 46 CFRunLoopAddSource(m_runLoop.get(), m_runLoopSource.get(), kCFRunLoopCommonModes); 49 47 } … … 51 49 RunLoop::~RunLoop() 52 50 { 53 CFMachPortInvalidate(m_port.get());54 51 CFRunLoopSourceInvalidate(m_runLoopSource.get()); 55 52 } … … 62 59 void RunLoop::wakeUp() 63 60 { 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()); 74 63 } 75 64 -
trunk/Source/WTF/wtf/cocoa/MainThreadCocoa.mm
r251261 r251514 37 37 #import <wtf/HashSet.h> 38 38 #import <wtf/RetainPtr.h> 39 #import <wtf/RunLoop.h>40 39 #import <wtf/SchedulePair.h> 41 40 #import <wtf/Threading.h> … … 44 43 #include <wtf/ios/WebCoreThread.h> 45 44 #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 46 58 47 59 #define LOG_CHANNEL_PREFIX Log … … 55 67 #endif 56 68 69 70 static JSWTFMainThreadCaller* staticMainThreadCaller; 57 71 static bool isTimerPosted; // This is only accessed on the main thread. 58 72 … … 71 85 RELEASE_LOG_FAULT(Threading, "WebKit Threading Violation - initial use of WebKit from a secondary thread."); 72 86 ASSERT(pthread_main_np()); 87 88 ASSERT(!staticMainThreadCaller); 89 staticMainThreadCaller = [[JSWTFMainThreadCaller alloc] init]; 73 90 } 74 91 … … 96 113 void scheduleDispatchFunctionsOnMainThread() 97 114 { 115 ASSERT(staticMainThreadCaller); 116 98 117 #if USE(WEB_THREAD) 99 118 if (isWebThread()) { … … 103 122 104 123 if (mainThreadPthread) { 105 RunLoop::web().dispatch([] { 106 WTF::dispatchFunctionsFromMainThread(); 107 }); 124 [staticMainThreadCaller performSelector:@selector(call) onThread:mainThreadNSThread withObject:nil waitUntilDone:NO]; 108 125 return; 109 126 } … … 115 132 #endif 116 133 117 RunLoop::main().dispatch([] { 118 WTF::dispatchFunctionsFromMainThread(); 119 }); 134 [staticMainThreadCaller performSelectorOnMainThread:@selector(call) withObject:nil waitUntilDone:NO]; 120 135 } 121 136 … … 182 197 mainThreadNSThread = [NSThread currentThread]; 183 198 sWebThread = &Thread::current(); 184 RunLoop::initializeWebRunLoop();185 199 }); 186 200 } -
trunk/Tools/ChangeLog
r251500 r251514 1 2019-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 1 13 2019-10-21 Jiewen Tan <jiewen_tan@apple.com> 2 14 -
trunk/Tools/TestWebKitAPI/Tests/WebKit/getUserMedia.html
r251261 r251514 3 3 <head> 4 4 <script> 5 let streamPromise = Promise.resolve(); 5 6 let stream = null; 6 7 7 8 function promptForCapture() 8 9 { 9 streamPromise =navigator.mediaDevices.enumerateDevices().then(() => {10 navigator.mediaDevices.enumerateDevices().then(() => { 10 11 return navigator.mediaDevices.getUserMedia({ audio: false, video: true }) 11 }); 12 13 streamPromise.then((stream) => { 12 }).then((s) => { 14 13 stream = s; 15 14 video.srcObject = stream; … … 20 19 function stop(kind) 21 20 { 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); 35 27 }); 28 29 if (!activeTracks.length) { 30 stream = null; 31 video.srcObject = null; 32 } 36 33 } 37 38 let streamPromiseDidResolve = false;39 34 40 35 function haveStream() 41 36 { 42 // Our caller polls repeatedly until our promise resolves. 43 streamPromise.then((stream) => streamPromiseDidResolve = !!stream); 44 return streamPromiseDidResolve; 37 return stream !== null; 45 38 } 46 39 … … 61 54 function captureAudio() 62 55 { 63 streamPromise = navigator.mediaDevices.getUserMedia({audio: true});56 navigator.mediaDevices.getUserMedia({audio: true}).then(s => stream = s); 64 57 } 65 58 66 59 function captureAudioAndVideo() 67 60 { 68 streamPromise = navigator.mediaDevices.getUserMedia({audio: true, video: true});61 navigator.mediaDevices.getUserMedia({audio: true, video: true}).then(s => stream = s); 69 62 } 70 63 </script>
Note: See TracChangeset
for help on using the changeset viewer.