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

Unified Diff: Source/core/dom/ExecutionContextTask.h

Issue 374583002: Replace CallClosureTask::create(bind()) with createCrossThreadTask() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Move createCallClosureTask to CrossThreadTask.h Created 6 years, 5 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
Index: Source/core/dom/ExecutionContextTask.h
diff --git a/Source/core/dom/ExecutionContextTask.h b/Source/core/dom/ExecutionContextTask.h
index dbc98d3b69b1666270a45899775ca0b41175a99b..2a74c0ffb2e4975210f1858dd3ae3f1afc6197d6 100644
--- a/Source/core/dom/ExecutionContextTask.h
+++ b/Source/core/dom/ExecutionContextTask.h
@@ -31,6 +31,7 @@
#include "wtf/Functional.h"
#include "wtf/Noncopyable.h"
#include "wtf/PassOwnPtr.h"
+#include "wtf/WeakPtr.h"
namespace WebCore {
@@ -49,15 +50,60 @@ public:
class CallClosureTask FINAL : public ExecutionContextTask {
public:
+ virtual void performTask(ExecutionContext*) OVERRIDE { m_closure(); }
+
+private:
+ // Do not use create other than in createCallClosureTask. http://crbug.com/390851
yhirano 2014/07/10 04:55:42 "Do not use |create| ..." or "Do not use create()
hiroshige 2014/07/10 07:16:32 Done.
static PassOwnPtr<CallClosureTask> create(const Closure& closure)
{
return adoptPtr(new CallClosureTask(closure));
}
- virtual void performTask(ExecutionContext*) OVERRIDE { m_closure(); }
-
-private:
explicit CallClosureTask(const Closure& closure) : m_closure(closure) { }
Closure m_closure;
+
+ // Templates for member function of class C + raw pointer (C*)
+ // which do not use CrossThreadCopier for the raw pointer
+ template<typename R, typename C>
+ friend PassOwnPtr<ExecutionContextTask> createCallClosureTask(R (C::*)(), C*);
tkent 2014/07/10 03:36:14 These |friend|s are ugly and overkill. Keeping th
hiroshige 2014/07/10 07:16:32 Done.
+ template<typename R, typename C, typename P2, typename A2>
+ friend PassOwnPtr<ExecutionContextTask> createCallClosureTask(R (C::*)(P2), C*, const A2&);
+ template<typename R, typename C, typename P2, typename A2, typename P3, typename A3>
+ friend PassOwnPtr<ExecutionContextTask> createCallClosureTask(R (C::*)(P2, P3), C*, const A2&, const A3&);
+ template<typename R, typename C, typename P2, typename A2, typename P3, typename A3, typename P4, typename A4>
+ friend PassOwnPtr<ExecutionContextTask> createCallClosureTask(R (C::*)(P2, P3, P4), C*, const A2&, const A3&, const A4&);
+ template<typename R, typename C, typename P2, typename A2, typename P3, typename A3, typename P4, typename A4, typename P5, typename A5>
+ friend PassOwnPtr<ExecutionContextTask> createCallClosureTask(R (C::*)(P2, P3, P4, P5), C*, const A2&, const A3&, const A4&, const A5&);
+ template<typename R, typename C, typename P2, typename A2, typename P3, typename A3, typename P4, typename A4, typename P5, typename A5, typename P6, typename A6>
+ friend PassOwnPtr<ExecutionContextTask> createCallClosureTask(R (C::*)(P2, P3, P4, P5, P6), C*, const A2&, const A3&, const A4&, const A5&, const A6&);
+ // Templates for member function of class C + weak pointer (const WeakPtr<C>&)
+ // which do not use CrossThreadCopier for the weak pointer
+ template<typename R, typename C>
+ friend PassOwnPtr<ExecutionContextTask> createCallClosureTask(R (C::*)(), const WeakPtr<C>&);
+ template<typename R, typename C, typename P2, typename A2>
+ friend PassOwnPtr<ExecutionContextTask> createCallClosureTask(R (C::*)(P2), const WeakPtr<C>&, const A2&);
+ template<typename R, typename C, typename P2, typename A2, typename P3, typename A3>
+ friend PassOwnPtr<ExecutionContextTask> createCallClosureTask(R (C::*)(P2, P3), const WeakPtr<C>&, const A2&, const A3&);
+ template<typename R, typename C, typename P2, typename A2, typename P3, typename A3, typename P4, typename A4>
+ friend PassOwnPtr<ExecutionContextTask> createCallClosureTask(R (C::*)(P2, P3, P4), const WeakPtr<C>&, const A2&, const A3&, const A4&);
+ template<typename R, typename C, typename P2, typename A2, typename P3, typename A3, typename P4, typename A4, typename P5, typename A5>
+ friend PassOwnPtr<ExecutionContextTask> createCallClosureTask(R (C::*)(P2, P3, P4, P5), const WeakPtr<C>&, const A2&, const A3&, const A4&, const A5&);
+ template<typename R, typename C, typename P2, typename A2, typename P3, typename A3, typename P4, typename A4, typename P5, typename A5, typename P6, typename A6>
+ friend PassOwnPtr<ExecutionContextTask> createCallClosureTask(R (C::*)(P2, P3, P4, P5, P6), const WeakPtr<C>&, const A2&, const A3&, const A4&, const A5&, const A6&);
+ // Other cases; use CrossThreadCopier for all arguments
+ template<typename FunctionType>
+ friend PassOwnPtr<ExecutionContextTask> createCallClosureTask(FunctionType);
+ template<typename FunctionType, typename A1>
+ friend PassOwnPtr<ExecutionContextTask> createCallClosureTask(FunctionType, const A1&);
+ template<typename FunctionType, typename A1, typename A2>
+ friend PassOwnPtr<ExecutionContextTask> createCallClosureTask(FunctionType, const A1&, const A2&);
+ template<typename FunctionType, typename A1, typename A2, typename A3>
+ friend PassOwnPtr<ExecutionContextTask> createCallClosureTask(FunctionType, const A1&, const A2&, const A3&);
+ template<typename FunctionType, typename A1, typename A2, typename A3, typename A4>
+ friend PassOwnPtr<ExecutionContextTask> createCallClosureTask(FunctionType, const A1&, const A2&, const A3&, const A4&);
+ template<typename FunctionType, typename A1, typename A2, typename A3, typename A4, typename A5>
+ friend PassOwnPtr<ExecutionContextTask> createCallClosureTask(FunctionType, const A1&, const A2&, const A3&, const A4&, const A5&);
+ template<typename FunctionType, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6>
+ friend PassOwnPtr<ExecutionContextTask> createCallClosureTask(FunctionType, const A1&, const A2&, const A3&, const A4&, const A5&, const A6&);
};
} // namespace

Powered by Google App Engine
This is Rietveld 408576698