Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: third_party/WebKit/Source/core/dom/CrossThreadTask.h

Issue 1770553002: Simplify createCrossThreadTask() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Kuroneko_EC5_CleanupCrossThreadAccess
Patch Set: Rebase Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/ExecutionContextTask.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/CrossThreadTask.h
diff --git a/third_party/WebKit/Source/core/dom/CrossThreadTask.h b/third_party/WebKit/Source/core/dom/CrossThreadTask.h
index a583340aa52492cb88b4dbd2251eb68772906cfc..5c9a094cd5da37410f440976398449f52eaf6350 100644
--- a/third_party/WebKit/Source/core/dom/CrossThreadTask.h
+++ b/third_party/WebKit/Source/core/dom/CrossThreadTask.h
@@ -85,32 +85,18 @@ namespace blink {
// RETTYPE, PS, and MPS are added as template parameters to circumvent MSVC 18.00.21005.1 (VS 2013) issues.
-template<typename... P, typename... MP,
- typename RETTYPE = std::unique_ptr<ExecutionContextTask>, size_t PS = sizeof...(P), size_t MPS = sizeof...(MP)>
-typename std::enable_if<PS + 1 == MPS, RETTYPE>::type createCrossThreadTask(void (*function)(MP...), P&&... parameters)
+template<typename FunctionType, typename... P,
+ typename RETTYPE = std::unique_ptr<ExecutionContextTask>, size_t PS = sizeof...(P), size_t MPS = WTF::FunctionWrapper<FunctionType>::numberOfArguments>
+typename std::enable_if<PS + 1 == MPS, RETTYPE>::type createCrossThreadTask(FunctionType function, P&&... parameters)
{
- return internal::CallClosureWithExecutionContextTask<WTF::CrossThreadAffinity>::create(threadSafeBind<ExecutionContext*>(function, std::forward<P>(parameters)...));
+ return internal::createCallClosureTask(threadSafeBind<ExecutionContext*>(function, std::forward<P>(parameters)...));
}
-template<typename... P, typename... MP,
- typename RETTYPE = std::unique_ptr<ExecutionContextTask>, size_t PS = sizeof...(P), size_t MPS = sizeof...(MP)>
-typename std::enable_if<PS == MPS, RETTYPE>::type createCrossThreadTask(void (*function)(MP...), P&&... parameters)
+template<typename FunctionType, typename... P,
+ typename RETTYPE = std::unique_ptr<ExecutionContextTask>, size_t PS = sizeof...(P), size_t MPS = WTF::FunctionWrapper<FunctionType>::numberOfArguments>
+typename std::enable_if<PS == MPS, RETTYPE>::type createCrossThreadTask(FunctionType function, P&&... parameters)
{
- return internal::CallClosureTask<WTF::CrossThreadAffinity>::create(threadSafeBind(function, std::forward<P>(parameters)...));
-}
-
-template<typename C, typename... P, typename... MP,
- typename RETTYPE = std::unique_ptr<ExecutionContextTask>, size_t PS = sizeof...(P), size_t MPS = sizeof...(MP)>
-typename std::enable_if<PS == MPS, RETTYPE>::type createCrossThreadTask(void (C::*function)(MP...), P&&... parameters)
-{
- return internal::CallClosureWithExecutionContextTask<WTF::CrossThreadAffinity>::create(threadSafeBind<ExecutionContext*>(function, std::forward<P>(parameters)...));
-}
-
-template<typename C, typename... P, typename... MP,
- typename RETTYPE = std::unique_ptr<ExecutionContextTask>, size_t PS = sizeof...(P), size_t MPS = sizeof...(MP)>
-typename std::enable_if<PS == MPS + 1, RETTYPE>::type createCrossThreadTask(void (C::*function)(MP...), P&&... parameters)
-{
- return internal::CallClosureTask<WTF::CrossThreadAffinity>::create(threadSafeBind(function, std::forward<P>(parameters)...));
+ return internal::createCallClosureTask(threadSafeBind(function, std::forward<P>(parameters)...));
}
} // namespace blink
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/ExecutionContextTask.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698