Changeset 224983 in webkit
- Timestamp:
- Nov 17, 2017, 1:35:30 PM (7 years ago)
- Location:
- trunk/Source/WTF
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r224907 r224983 1 2017-11-17 Alex Christensen <achristensen@webkit.org> 2 3 Clean up after r224952 4 https://bugs.webkit.org/show_bug.cgi?id=179809 5 6 Reviewed by Brady Eidson. 7 8 * wtf/MainThread.cpp: 9 (WTF::dispatchFunctionsFromMainThread): 10 (WTF::callOnMainThread): 11 * wtf/MainThread.h: 12 * wtf/generic/MainThreadGeneric.cpp: 13 (WTF::scheduleDispatchFunctionsOnMainThread): 14 (WTF::currentRunLoopInCommonMode): Deleted. 15 * wtf/mac/MainThreadMac.mm: 16 (WTF::scheduleDispatchFunctionsOnMainThread): 17 (WTF::currentRunLoopInCommonMode): Deleted. 18 * wtf/win/MainThreadWin.cpp: 19 (WTF::scheduleDispatchFunctionsOnMainThread): 20 (WTF::currentRunLoopInCommonMode): Deleted. 21 1 22 2017-11-15 Alex Christensen <achristensen@webkit.org> 2 23 -
trunk/Source/WTF/wtf/MainThread.cpp
r224896 r224983 136 136 // This code has effect only in case the scheduleDispatchFunctionsOnMainThread() is implemented in a way that 137 137 // allows input events to be processed before we are back here. 138 if (MonotonicTime::now() - startTime > maxRunLoopSuspensionTime && currentRunLoopInCommonMode()) {138 if (MonotonicTime::now() - startTime > maxRunLoopSuspensionTime) { 139 139 scheduleDispatchFunctionsOnMainThread(); 140 140 break; … … 143 143 } 144 144 145 void callOnMainThread(Function<void()>&& function , SchedulePairHashSet* pairs)145 void callOnMainThread(Function<void()>&& function) 146 146 { 147 147 ASSERT(function); … … 156 156 157 157 if (needToSchedule) 158 scheduleDispatchFunctionsOnMainThread( pairs);158 scheduleDispatchFunctionsOnMainThread(); 159 159 } 160 160 -
trunk/Source/WTF/wtf/MainThread.h
r224896 r224983 40 40 41 41 class PrintStream; 42 class SchedulePair;43 struct SchedulePairHash;44 typedef HashSet<RefPtr<SchedulePair>, SchedulePairHash> SchedulePairHashSet;45 42 46 43 // Must be called from the main thread. 47 44 WTF_EXPORT_PRIVATE void initializeMainThread(); 48 45 49 WTF_EXPORT_PRIVATE void callOnMainThread(Function<void()>&& , SchedulePairHashSet* = nullptr);46 WTF_EXPORT_PRIVATE void callOnMainThread(Function<void()>&&); 50 47 51 48 #if PLATFORM(COCOA) … … 86 83 // NOTE: these functions are internal to the callOnMainThread implementation. 87 84 void initializeMainThreadPlatform(); 88 void scheduleDispatchFunctionsOnMainThread( SchedulePairHashSet* = nullptr);85 void scheduleDispatchFunctionsOnMainThread(); 89 86 void dispatchFunctionsFromMainThread(); 90 bool currentRunLoopInCommonMode();91 87 92 88 #if OS(DARWIN) && !USE(GLIB) -
trunk/Source/WTF/wtf/generic/MainThreadGeneric.cpp
r224896 r224983 68 68 } 69 69 70 bool currentRunLoopInCommonMode() 71 { 72 return true; 73 } 74 75 void scheduleDispatchFunctionsOnMainThread(SchedulePairHashSet*) 70 void scheduleDispatchFunctionsOnMainThread() 76 71 { 77 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
r224907 r224983 123 123 } 124 124 125 bool currentRunLoopInCommonMode() 126 { 127 NSString *currentMode = [[NSRunLoop currentRunLoop] currentMode]; 128 return currentMode == (NSString *)kCFRunLoopCommonModes 129 || currentMode == (NSString *)kCFRunLoopDefaultMode; 130 } 131 132 void scheduleDispatchFunctionsOnMainThread(SchedulePairHashSet* pairs) 125 void scheduleDispatchFunctionsOnMainThread() 133 126 { 134 127 ASSERT(staticMainThreadCaller); … … 138 131 return; 139 132 } 140 141 RetainPtr<NSArray<NSString *>> modes;142 if (pairs) {143 modes = adoptNS([[NSMutableArray alloc] initWithCapacity:pairs->size()]);144 for (auto& pair : *pairs)145 [(NSMutableArray *)modes.get() addObject:(NSString *)pair->mode()];146 } else147 modes = @[(NSString *)kCFRunLoopCommonModes];148 133 149 134 if (mainThreadEstablishedAsPthreadMain) { 150 135 ASSERT(!mainThreadNSThread); 151 [staticMainThreadCaller performSelectorOnMainThread:@selector(call) withObject:nil waitUntilDone:NO modes:modes.get()];136 [staticMainThreadCaller performSelectorOnMainThread:@selector(call) withObject:nil waitUntilDone:NO]; 152 137 return; 153 138 } 154 139 155 140 ASSERT(mainThreadNSThread); 156 [staticMainThreadCaller performSelector:@selector(call) onThread:mainThreadNSThread withObject:nil waitUntilDone:NO modes:modes.get()];141 [staticMainThreadCaller performSelector:@selector(call) onThread:mainThreadNSThread withObject:nil waitUntilDone:NO]; 157 142 } 158 143 -
trunk/Source/WTF/wtf/win/MainThreadWin.cpp
r224896 r224983 50 50 } 51 51 52 bool currentRunLoopInCommonMode()53 {54 return true;55 }56 57 52 void initializeMainThreadPlatform() 58 53 { … … 73 68 } 74 69 75 void scheduleDispatchFunctionsOnMainThread( SchedulePairHashSet*)70 void scheduleDispatchFunctionsOnMainThread() 76 71 { 77 72 ASSERT(threadingWindowHandle);
Note:
See TracChangeset
for help on using the changeset viewer.