OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef WebTaskRunner_h |
| 6 #define WebTaskRunner_h |
| 7 |
| 8 #include "WebCommon.h" |
| 9 |
| 10 namespace blink { |
| 11 |
| 12 class WebTraceLocation; |
| 13 |
| 14 // The blink representation of a chromium SingleThreadTaskRunner. |
| 15 class BLINK_PLATFORM_EXPORT WebTaskRunner { |
| 16 public: |
| 17 virtual ~WebTaskRunner() {} |
| 18 |
| 19 class BLINK_PLATFORM_EXPORT Task { |
| 20 public: |
| 21 virtual ~Task() { } |
| 22 virtual void run() = 0; |
| 23 }; |
| 24 |
| 25 // Schedule a task to be run on the the associated WebThread. |
| 26 // Takes ownership of |Task|. Can be called from any thread. |
| 27 virtual void postTask(const WebTraceLocation&, Task*) {} |
| 28 |
| 29 // Schedule a task to be run after |delayMs| on the the associated WebThread
. |
| 30 // Takes ownership of |Task|. Can be called from any thread. |
| 31 // TODO(alexclarke): Remove this when possible. |
| 32 virtual void postDelayedTask(const WebTraceLocation&, Task*, long long delay
Ms) {} |
| 33 |
| 34 // Schedule a task to be run after |delayMs| on the the associated WebThread
. |
| 35 // Takes ownership of |Task|. Can be called from any thread. |
| 36 virtual void postDelayedTask(const WebTraceLocation&, Task*, double delayMs)
{} |
| 37 |
| 38 // TODO(alexclarke): Add helpers for posting bound functions as tasks. |
| 39 }; |
| 40 |
| 41 } // namespace blink |
| 42 |
| 43 #endif // WebTaskRunner_h |
OLD | NEW |