Changeset 224687 in webkit
- Timestamp:
- Nov 10, 2017 9:30:59 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r224681 r224687 1 2017-11-10 Alex Christensen <achristensen@webkit.org> 2 3 REGRESSION(r224267): WebViews scheduled with custom run loop modes don't load 4 https://bugs.webkit.org/show_bug.cgi?id=179515 5 <rdar://problem/35445245> 6 7 Reviewed by Andy Estes. 8 9 * wtf/MainThread.cpp: 10 (WTF::callOnMainThread): 11 * wtf/MainThread.h: 12 (WTF::callOnMainThread): 13 (WTF::scheduleDispatchFunctionsOnMainThread): 14 * wtf/generic/MainThreadGeneric.cpp: 15 (WTF::scheduleDispatchFunctionsOnMainThread): 16 * wtf/mac/MainThreadMac.mm: 17 (WTF::scheduleDispatchFunctionsOnMainThread): 18 * wtf/win/MainThreadWin.cpp: 19 (WTF::scheduleDispatchFunctionsOnMainThread): 20 Add an optional parameter which is an array of run loop mode names to pass to performSelectorOnMainThread. 21 1 22 2017-11-10 Ms2ger <Ms2ger@igalia.com> 2 23 -
trunk/Source/WTF/wtf/MainThread.cpp
r219763 r224687 143 143 } 144 144 145 void callOnMainThread(Function<void ()>&& function)145 void callOnMainThread(Function<void()>&& function, SchedulePairHashSet* pairs) 146 146 { 147 147 ASSERT(function); … … 156 156 157 157 if (needToSchedule) 158 scheduleDispatchFunctionsOnMainThread( );158 scheduleDispatchFunctionsOnMainThread(pairs); 159 159 } 160 160 -
trunk/Source/WTF/wtf/MainThread.h
r220186 r224687 32 32 33 33 #include <stdint.h> 34 #include <wtf/Forward.h> 34 35 #include <wtf/Function.h> 35 36 #include <wtf/Optional.h> … … 39 40 40 41 class PrintStream; 42 class SchedulePair; 43 struct SchedulePairHash; 44 typedef HashSet<RefPtr<SchedulePair>, SchedulePairHash> SchedulePairHashSet; 41 45 42 46 // Must be called from the main thread. 43 47 WTF_EXPORT_PRIVATE void initializeMainThread(); 44 48 45 WTF_EXPORT_PRIVATE void callOnMainThread(Function<void ()>&&);49 WTF_EXPORT_PRIVATE void callOnMainThread(Function<void()>&&, SchedulePairHashSet* = nullptr); 46 50 47 51 #if PLATFORM(COCOA) … … 82 86 // NOTE: these functions are internal to the callOnMainThread implementation. 83 87 void initializeMainThreadPlatform(); 84 void scheduleDispatchFunctionsOnMainThread( );88 void scheduleDispatchFunctionsOnMainThread(SchedulePairHashSet* = nullptr); 85 89 void dispatchFunctionsFromMainThread(); 86 90 -
trunk/Source/WTF/wtf/generic/MainThreadGeneric.cpp
r216274 r224687 68 68 } 69 69 70 void scheduleDispatchFunctionsOnMainThread( )70 void scheduleDispatchFunctionsOnMainThread(SchedulePairHashSet*) 71 71 { 72 72 // Use a RunLoop::Timer instead of RunLoop::dispatch() to be able to use a different priority and -
trunk/Source/WTF/wtf/mac/MainThreadMac.mm
r212878 r224687 36 36 #import <wtf/Assertions.h> 37 37 #import <wtf/HashSet.h> 38 #import <wtf/RetainPtr.h> 39 #import <wtf/SchedulePair.h> 38 40 #import <wtf/Threading.h> 39 41 … … 121 123 } 122 124 123 void scheduleDispatchFunctionsOnMainThread( )125 void scheduleDispatchFunctionsOnMainThread(SchedulePairHashSet* pairs) 124 126 { 125 127 ASSERT(staticMainThreadCaller); … … 130 132 } 131 133 134 RetainPtr<NSArray<NSString *>> modes; 135 if (pairs) { 136 modes = adoptNS([[NSMutableArray alloc] initWithCapacity:pairs->size()]); 137 for (auto& pair : *pairs) 138 [(NSMutableArray *)modes.get() addObject:(NSString *)pair->mode()]; 139 } else 140 modes = @[(NSString *)kCFRunLoopCommonModes]; 141 132 142 if (mainThreadEstablishedAsPthreadMain) { 133 143 ASSERT(!mainThreadNSThread); 134 [staticMainThreadCaller performSelectorOnMainThread:@selector(call) withObject:nil waitUntilDone:NO ];144 [staticMainThreadCaller performSelectorOnMainThread:@selector(call) withObject:nil waitUntilDone:NO modes:modes.get()]; 135 145 return; 136 146 } 137 147 138 148 ASSERT(mainThreadNSThread); 139 [staticMainThreadCaller performSelector:@selector(call) onThread:mainThreadNSThread withObject:nil waitUntilDone:NO ];149 [staticMainThreadCaller performSelector:@selector(call) onThread:mainThreadNSThread withObject:nil waitUntilDone:NO modes:modes.get()]; 140 150 } 141 151 -
trunk/Source/WTF/wtf/win/MainThreadWin.cpp
r219994 r224687 68 68 } 69 69 70 void scheduleDispatchFunctionsOnMainThread( )70 void scheduleDispatchFunctionsOnMainThread(SchedulePairHashSet*) 71 71 { 72 72 ASSERT(threadingWindowHandle); -
trunk/Source/WebCore/ChangeLog
r224686 r224687 1 2017-11-10 Alex Christensen <achristensen@webkit.org> 2 3 REGRESSION(r224267): WebViews scheduled with custom run loop modes don't load 4 https://bugs.webkit.org/show_bug.cgi?id=179515 5 <rdar://problem/35445245> 6 7 Reviewed by Andy Estes. 8 9 Covered by a new API test which would have timed out without this change. 10 11 * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm: 12 (schedulePairHashSet): 13 Collect run loop modes from the NetworkingContext similarly to how we did before https://trac.webkit.org/changeset/224267/webkit#file40 14 (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]): 15 (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveAuthenticationChallenge:]): 16 (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]): 17 (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]): 18 (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveData:lengthReceived:]): 19 (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didSendBodyData:totalBytesWritten:totalBytesExpectedToWrite:]): 20 (-[WebCoreResourceHandleAsOperationQueueDelegate connectionDidFinishLoading:]): 21 (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didFailWithError:]): 22 (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]): 23 1 24 2017-11-10 Chris Dumez <cdumez@apple.com> 2 25 -
trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm
r224522 r224687 44 44 using namespace WebCore; 45 45 46 static SchedulePairHashSet* scheduledRunLoopPairs(ResourceHandle* handle) 47 { 48 if (!handle) 49 return nullptr; 50 if (!handle->context()) 51 return nullptr; 52 return handle->context()->scheduledRunLoopPairs(); 53 } 54 46 55 @implementation WebCoreResourceHandleAsOperationQueueDelegate 47 56 … … 126 135 m_messageQueue->append(std::make_unique<Function<void()>>(WTFMove(work))); 127 136 else 128 callOnMainThread(WTFMove(work) );137 callOnMainThread(WTFMove(work), scheduledRunLoopPairs(m_handle)); 129 138 130 139 dispatch_semaphore_wait(m_semaphore, DISPATCH_TIME_FOREVER); … … 150 159 m_messageQueue->append(std::make_unique<Function<void()>>(WTFMove(work))); 151 160 else 152 callOnMainThread(WTFMove(work) );161 callOnMainThread(WTFMove(work), scheduledRunLoopPairs(m_handle)); 153 162 } 154 163 … … 172 181 m_messageQueue->append(std::make_unique<Function<void()>>(WTFMove(work))); 173 182 else 174 callOnMainThread(WTFMove(work) );183 callOnMainThread(WTFMove(work), scheduledRunLoopPairs(m_handle)); 175 184 176 185 dispatch_semaphore_wait(m_semaphore, DISPATCH_TIME_FOREVER); … … 211 220 m_messageQueue->append(std::make_unique<Function<void()>>(WTFMove(work))); 212 221 else 213 callOnMainThread(WTFMove(work) );222 callOnMainThread(WTFMove(work), scheduledRunLoopPairs(m_handle)); 214 223 215 224 dispatch_semaphore_wait(m_semaphore, DISPATCH_TIME_FOREVER); … … 240 249 m_messageQueue->append(std::make_unique<Function<void()>>(WTFMove(work))); 241 250 else 242 callOnMainThread(WTFMove(work) );251 callOnMainThread(WTFMove(work), scheduledRunLoopPairs(m_handle)); 243 252 } 244 253 … … 260 269 m_messageQueue->append(std::make_unique<Function<void()>>(WTFMove(work))); 261 270 else 262 callOnMainThread(WTFMove(work) );271 callOnMainThread(WTFMove(work), scheduledRunLoopPairs(m_handle)); 263 272 } 264 273 … … 284 293 m_messageQueue->append(std::make_unique<Function<void()>>(WTFMove(work))); 285 294 else 286 callOnMainThread(WTFMove(work) );295 callOnMainThread(WTFMove(work), scheduledRunLoopPairs(m_handle)); 287 296 } 288 297 … … 308 317 m_messageQueue->append(std::make_unique<Function<void()>>(WTFMove(work))); 309 318 else 310 callOnMainThread(WTFMove(work) );319 callOnMainThread(WTFMove(work), scheduledRunLoopPairs(m_handle)); 311 320 } 312 321 … … 332 341 m_messageQueue->append(std::make_unique<Function<void()>>(WTFMove(work))); 333 342 else 334 callOnMainThread(WTFMove(work) );343 callOnMainThread(WTFMove(work), scheduledRunLoopPairs(m_handle)); 335 344 336 345 dispatch_semaphore_wait(m_semaphore, DISPATCH_TIME_FOREVER); -
trunk/Tools/ChangeLog
r224685 r224687 1 2017-11-10 Alex Christensen <achristensen@webkit.org> 2 3 REGRESSION(r224267): WebViews scheduled with custom run loop modes don't load 4 https://bugs.webkit.org/show_bug.cgi?id=179515 5 6 Reviewed by Andy Estes. 7 8 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 9 * TestWebKitAPI/Tests/mac/WebViewScheduleInRunLoop.mm: Added. 10 (-[ScheduleInRunLoopDelegate webView:didFinishLoadForFrame:]): 11 (TestWebKitAPI::TEST): 12 1 13 2017-11-10 Fujii Hironori <Hironori.Fujii@sony.com> 2 14 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r224281 r224687 236 236 5C726D6F1D3EE06E00C5E1A1 /* InstanceMethodSwizzler.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C726D6E1D3EE06800C5E1A1 /* InstanceMethodSwizzler.mm */; }; 237 237 5C7964101EB0278D0075D74C /* EventModifiers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C79640F1EB0269B0075D74C /* EventModifiers.cpp */; }; 238 5C7C74CB1FB529BA002F9ABE /* WebViewScheduleInRunLoop.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C7C74CA1FB528D4002F9ABE /* WebViewScheduleInRunLoop.mm */; }; 238 239 5C838F7F1DB04F900082858F /* LoadInvalidURLRequest.mm in Sources */ = {isa = PBXBuildFile; fileRef = 57901FAE1CAF137100ED64F9 /* LoadInvalidURLRequest.mm */; }; 239 240 5C973F5C1F58EF8B00359C27 /* WebGLPolicy.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C973F5B1F58EF0A00359C27 /* WebGLPolicy.mm */; }; … … 1370 1371 5C726D6E1D3EE06800C5E1A1 /* InstanceMethodSwizzler.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = InstanceMethodSwizzler.mm; path = cocoa/InstanceMethodSwizzler.mm; sourceTree = "<group>"; }; 1371 1372 5C79640F1EB0269B0075D74C /* EventModifiers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventModifiers.cpp; sourceTree = "<group>"; }; 1373 5C7C74CA1FB528D4002F9ABE /* WebViewScheduleInRunLoop.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebViewScheduleInRunLoop.mm; sourceTree = "<group>"; }; 1372 1374 5C973F5B1F58EF0A00359C27 /* WebGLPolicy.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebGLPolicy.mm; sourceTree = "<group>"; }; 1373 1375 5C9E56841DF9143D00C9EE33 /* WebsitePolicies.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebsitePolicies.mm; sourceTree = "<group>"; }; … … 2818 2820 37E38C33169B7D010084C28C /* WebViewDidRemoveFrameFromHierarchy.mm */, 2819 2821 51DB16CD1F085047001FA4C5 /* WebViewIconLoading.mm */, 2822 5C7C74CA1FB528D4002F9ABE /* WebViewScheduleInRunLoop.mm */, 2820 2823 CE32C7C718184C4900CD8C28 /* WillPerformClientRedirectToURLCrash.mm */, 2821 2824 1A7BFC0A171A0BDB00BC5F64 /* WillSendSubmitEvent.mm */, … … 3524 3527 7CCE7ED61A411A7E00447C4C /* WebViewDidRemoveFrameFromHierarchy.mm in Sources */, 3525 3528 51DB16CE1F085137001FA4C5 /* WebViewIconLoading.mm in Sources */, 3529 5C7C74CB1FB529BA002F9ABE /* WebViewScheduleInRunLoop.mm in Sources */, 3526 3530 7CCE7F1B1A411AE600447C4C /* WillLoad.cpp in Sources */, 3527 3531 7CCE7ED71A411A7E00447C4C /* WillPerformClientRedirectToURLCrash.mm in Sources */,
Note: See TracChangeset
for help on using the changeset viewer.