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

Unified Diff: third_party/WebKit/Source/platform/WebTaskRunner.cpp

Issue 1977773002: Make SameThreadTask/CrossThreadTask internal and remove platform/Task.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Shironeko_3
Patch Set: Rebase. Use DCHECK. 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 | « third_party/WebKit/Source/platform/Task.h ('k') | third_party/WebKit/Source/platform/blink_platform.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/WebTaskRunner.cpp
diff --git a/third_party/WebKit/Source/platform/WebTaskRunner.cpp b/third_party/WebKit/Source/platform/WebTaskRunner.cpp
index 439963d501f44ebafdfc82663050e5fa11047a30..67a38bef8af6f8d0d56c9b1638266eb8293e68aa 100644
--- a/third_party/WebKit/Source/platform/WebTaskRunner.cpp
+++ b/third_party/WebKit/Source/platform/WebTaskRunner.cpp
@@ -4,10 +4,44 @@
#include "public/platform/WebTaskRunner.h"
-#include "platform/Task.h"
-
namespace blink {
+class SameThreadTask : public WebTaskRunner::Task {
+ USING_FAST_MALLOC(SameThreadTask);
+ WTF_MAKE_NONCOPYABLE(SameThreadTask);
+public:
+ explicit SameThreadTask(std::unique_ptr<SameThreadClosure> closure)
+ : m_closure(std::move(closure))
+ {
+ }
+
+ void run() override
+ {
+ (*m_closure)();
+ }
+
+private:
+ std::unique_ptr<SameThreadClosure> m_closure;
+};
+
+class CrossThreadTask : public WebTaskRunner::Task {
+ USING_FAST_MALLOC(CrossThreadTask);
+ WTF_MAKE_NONCOPYABLE(CrossThreadTask);
+public:
+ explicit CrossThreadTask(std::unique_ptr<CrossThreadClosure> closure)
+ : m_closure(std::move(closure))
+ {
+ }
+
+ void run() override
+ {
+ (*m_closure)();
+ }
+
+private:
+ std::unique_ptr<CrossThreadClosure> m_closure;
+};
+
void WebTaskRunner::postTask(const WebTraceLocation& location, std::unique_ptr<CrossThreadClosure> task)
{
postTask(location, new CrossThreadTask(std::move(task)));
« no previous file with comments | « third_party/WebKit/Source/platform/Task.h ('k') | third_party/WebKit/Source/platform/blink_platform.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698