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

Unified Diff: public/platform/WebTaskRunner.h

Issue 1325073002: Introduce WebTaskRunner Patch 1/5 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix comment Created 5 years, 3 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 | « public/platform/WebScheduler.h ('k') | public/platform/WebThread.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: public/platform/WebTaskRunner.h
diff --git a/public/platform/WebTaskRunner.h b/public/platform/WebTaskRunner.h
new file mode 100644
index 0000000000000000000000000000000000000000..edaf128538fa1863a020463761b034dfba17ff03
--- /dev/null
+++ b/public/platform/WebTaskRunner.h
@@ -0,0 +1,43 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WebTaskRunner_h
+#define WebTaskRunner_h
+
+#include "WebCommon.h"
+
+namespace blink {
+
+class WebTraceLocation;
+
+// The blink representation of a chromium SingleThreadTaskRunner.
+class BLINK_PLATFORM_EXPORT WebTaskRunner {
+public:
+ virtual ~WebTaskRunner() {}
+
+ class BLINK_PLATFORM_EXPORT Task {
+ public:
+ virtual ~Task() { }
+ virtual void run() = 0;
+ };
+
+ // Schedule a task to be run on the the associated WebThread.
+ // Takes ownership of |Task|. Can be called from any thread.
+ virtual void postTask(const WebTraceLocation&, Task*) {}
+
+ // Schedule a task to be run after |delayMs| on the the associated WebThread.
+ // Takes ownership of |Task|. Can be called from any thread.
+ // TODO(alexclarke): Remove this when possible.
+ virtual void postDelayedTask(const WebTraceLocation&, Task*, long long delayMs) {}
+
+ // Schedule a task to be run after |delayMs| on the the associated WebThread.
+ // Takes ownership of |Task|. Can be called from any thread.
+ virtual void postDelayedTask(const WebTraceLocation&, Task*, double delayMs) {}
+
+ // TODO(alexclarke): Add helpers for posting bound functions as tasks.
+};
+
+} // namespace blink
+
+#endif // WebTaskRunner_h
« no previous file with comments | « public/platform/WebScheduler.h ('k') | public/platform/WebThread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698