Index: third_party/WebKit/Source/platform/Task.h |
diff --git a/third_party/WebKit/Source/platform/Task.h b/third_party/WebKit/Source/platform/Task.h |
index 64b656c7374f14261d098c250be6bdc7c1f009db..e404408db018e93220302972fef2c06df968bac3 100644 |
--- a/third_party/WebKit/Source/platform/Task.h |
+++ b/third_party/WebKit/Source/platform/Task.h |
@@ -40,11 +40,34 @@ |
namespace blink { |
-class Task : public WebTaskRunner::Task { |
- USING_FAST_MALLOC(Task); |
- WTF_MAKE_NONCOPYABLE(Task); |
+// Please use WTF::SameThreadClosure or WTF::CrossThreadClosure directly, |
+// instead of wrapping them by blink::SameThreadTask/CrossThreadTask here. |
+ |
+// TODO(hiroshige): Make these classes internal to |
+// Source/platform/WebTaskRunner.cpp. |
+class SameThreadTask : public WebTaskRunner::Task { |
+ USING_FAST_MALLOC(SameThreadTask); |
+ WTF_MAKE_NONCOPYABLE(SameThreadTask); |
+public: |
+ explicit SameThreadTask(PassOwnPtr<SameThreadClosure> closure) |
+ : m_closure(std::move(closure)) |
+ { |
+ } |
+ |
+ void run() override |
+ { |
+ (*m_closure)(); |
+ } |
+ |
+private: |
+ OwnPtr<SameThreadClosure> m_closure; |
+}; |
+ |
+class CrossThreadTask : public WebTaskRunner::Task { |
+ USING_FAST_MALLOC(CrossThreadTask); |
+ WTF_MAKE_NONCOPYABLE(CrossThreadTask); |
public: |
- explicit Task(PassOwnPtr<Closure> closure) |
+ explicit CrossThreadTask(PassOwnPtr<CrossThreadClosure> closure) |
: m_closure(std::move(closure)) |
{ |
} |
@@ -55,7 +78,7 @@ public: |
} |
private: |
- OwnPtr<Closure> m_closure; |
+ OwnPtr<CrossThreadClosure> m_closure; |
}; |
} // namespace blink |