Changeset 201496 in webkit
- Timestamp:
- May 29, 2016, 9:30:22 PM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 7 edited
-
ChangeLog (modified) (1 diff)
-
bindings/js/JSDOMGlobalObjectTask.cpp (modified) (1 diff)
-
dom/Document.cpp (modified) (1 diff)
-
dom/Document.h (modified) (1 diff)
-
dom/ScriptExecutionContext.h (modified) (5 diffs)
-
workers/WorkerGlobalScope.cpp (modified) (1 diff)
-
workers/WorkerGlobalScope.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r201493 r201496 1 2016-05-29 Brady Eidson <beidson@apple.com> 2 3 Make ScriptExecutionContext::Task work in terms of wtf::NoncopyableFunction instead of std::function. 4 https://bugs.webkit.org/show_bug.cgi?id=158187 5 6 Reviewed by Chris Dumez. 7 8 No new tests (Refactor, no behavior change). 9 10 Also make postTask take an rvalue reference. 11 12 * bindings/js/JSDOMGlobalObjectTask.cpp: 13 (WebCore::JSGlobalObjectTask::JSGlobalObjectTask): 14 15 * dom/Document.cpp: 16 (WebCore::Document::postTask): 17 * dom/Document.h: 18 19 * dom/ScriptExecutionContext.h: 20 (WebCore::ScriptExecutionContext::Task::Task): 21 22 * workers/WorkerGlobalScope.cpp: 23 (WebCore::WorkerGlobalScope::postTask): 24 * workers/WorkerGlobalScope.h: 25 1 26 2016-05-28 Chris Dumez <cdumez@apple.com> 2 27 -
trunk/Source/WebCore/bindings/js/JSDOMGlobalObjectTask.cpp
r201253 r201496 81 81 82 82 JSGlobalObjectTask::JSGlobalObjectTask(JSDOMGlobalObject* globalObject, Ref<Microtask>&& task) 83 : ScriptExecutionContext::Task( nullptr)83 : ScriptExecutionContext::Task({ }) 84 84 { 85 85 RefPtr<JSGlobalObjectCallback> callback = JSGlobalObjectCallback::create(globalObject, WTFMove(task)); -
trunk/Source/WebCore/dom/Document.cpp
r201482 r201496 5385 5385 } 5386 5386 5387 void Document::postTask(Task task)5387 void Document::postTask(Task&& task) 5388 5388 { 5389 5389 callOnMainThread([documentReference = m_weakFactory.createWeakPtr(), task = WTFMove(task)]() mutable { -
trunk/Source/WebCore/dom/Document.h
r201471 r201496 976 976 void parseDNSPrefetchControlHeader(const String&); 977 977 978 void postTask(Task ) final; // Executes the task on context's thread asynchronously.978 void postTask(Task&&) final; // Executes the task on context's thread asynchronously. 979 979 980 980 #if ENABLE(REQUEST_ANIMATION_FRAME) -
trunk/Source/WebCore/dom/ScriptExecutionContext.h
r200503 r201496 36 36 #include <runtime/ConsoleTypes.h> 37 37 #include <wtf/HashSet.h> 38 #include <wtf/NoncopyableFunction.h> 38 39 39 40 namespace JSC { … … 133 134 enum CleanupTaskTag { CleanupTask }; 134 135 135 template<typename T, typename = typename std::enable_if<!std::is_base_of<Task, T>::value && std::is_convertible<T, std::function<void (ScriptExecutionContext&)>>::value>::type>136 template<typename T, typename = typename std::enable_if<!std::is_base_of<Task, T>::value && std::is_convertible<T, NoncopyableFunction<void (ScriptExecutionContext&)>>::value>::type> 136 137 Task(T task) 137 138 : m_task(WTFMove(task)) … … 140 141 } 141 142 142 Task(std::function<void ()> task)143 Task(std::function<void ()> task) 143 144 : m_task([task](ScriptExecutionContext&) { task(); }) 144 145 , m_isCleanupTask(false) … … 146 147 } 147 148 148 template<typename T, typename = typename std::enable_if<std::is_convertible<T, std::function<void (ScriptExecutionContext&)>>::value>::type>149 template<typename T, typename = typename std::enable_if<std::is_convertible<T, NoncopyableFunction<void (ScriptExecutionContext&)>>::value>::type> 149 150 Task(CleanupTaskTag, T task) 150 151 : m_task(WTFMove(task)) … … 163 164 164 165 protected: 165 std::function<void (ScriptExecutionContext&)> m_task;166 NoncopyableFunction<void (ScriptExecutionContext&)> m_task; 166 167 bool m_isCleanupTask; 167 168 }; 168 169 169 virtual void postTask(Task ) = 0; // Executes the task on context's thread asynchronously.170 virtual void postTask(Task&&) = 0; // Executes the task on context's thread asynchronously. 170 171 171 172 template<typename... Arguments> -
trunk/Source/WebCore/workers/WorkerGlobalScope.cpp
r201390 r201496 174 174 } 175 175 176 void WorkerGlobalScope::postTask(Task task)176 void WorkerGlobalScope::postTask(Task&& task) 177 177 { 178 178 thread().runLoop().postTask(WTFMove(task)); -
trunk/Source/WebCore/workers/WorkerGlobalScope.h
r201390 r201496 89 89 using ScriptExecutionContext::hasPendingActivity; 90 90 91 void postTask(Task ) override; // Executes the task on context's thread asynchronously.91 void postTask(Task&&) final; // Executes the task on context's thread asynchronously. 92 92 93 93 // WorkerGlobalScope
Note:
See TracChangeset
for help on using the changeset viewer.