Index: third_party/WebKit/Source/platform/scheduler/CancellableTaskFactory.h |
diff --git a/third_party/WebKit/Source/platform/scheduler/CancellableTaskFactory.h b/third_party/WebKit/Source/platform/scheduler/CancellableTaskFactory.h |
index e37af101b2859ab6c5bfc2b7009360ec4f14d345..19111dd19aeb8b5a5e930ca9ea6eb90026daccff 100644 |
--- a/third_party/WebKit/Source/platform/scheduler/CancellableTaskFactory.h |
+++ b/third_party/WebKit/Source/platform/scheduler/CancellableTaskFactory.h |
@@ -16,6 +16,26 @@ |
#include <memory> |
#include <type_traits> |
+// WebTaskRunner::postCancellableTask will replace CancellableTaskFactory. |
+// Use postCancellableTask in new code. |
+// Example: For |task_runner| and |foo| below. |
+// WebTaskRunner* task_runner; |
+// Foo* foo; |
+// |
+// CancellableTaskFactory factory(foo, &Foo::bar); |
+// task_runner->postTask(BLINK_FROM_HERE, factory.cancelAndCreate()); |
+// factory.cancel(); |
+// |
+// Above is equivalent to below: |
+// |
+// std::unique_ptr<WTF::Closure> task = |
+// WTF::bind(wrapPersistent(foo), &Foo::bar); |
+// RefPtr<TaskHandle> handle = |
+// task_runner->postCancellableTask(BLINK_FROM_HERE, std::move(task)); |
+// handle->cancel(); |
+// |
+// Note that the task is not automatically cancelled on TaskHandle scope out. |
Sami
2016/10/26 12:32:51
Is the last sentence still accurate?
tzik
2016/10/27 06:38:53
Yes, it's mostly still valid. Added a comment to m
|
+ |
namespace blink { |
class TraceLocation; |