Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef WebTaskRunner_h | 5 #ifndef WebTaskRunner_h |
| 6 #define WebTaskRunner_h | 6 #define WebTaskRunner_h |
| 7 | 7 |
| 8 #include "WebCommon.h" | 8 #include "WebCommon.h" |
| 9 | 9 |
| 10 #ifdef INSIDE_BLINK | 10 #ifdef INSIDE_BLINK |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 32 // Takes ownership of |Task|. Can be called from any thread. | 32 // Takes ownership of |Task|. Can be called from any thread. |
| 33 virtual void postTask(const WebTraceLocation&, Task*) = 0; | 33 virtual void postTask(const WebTraceLocation&, Task*) = 0; |
| 34 | 34 |
| 35 // Schedule a task to be run after |delayMs| on the the associated WebThread . | 35 // Schedule a task to be run after |delayMs| on the the associated WebThread . |
| 36 // Takes ownership of |Task|. Can be called from any thread. | 36 // Takes ownership of |Task|. Can be called from any thread. |
| 37 virtual void postDelayedTask(const WebTraceLocation&, Task*, double delayMs) = 0; | 37 virtual void postDelayedTask(const WebTraceLocation&, Task*, double delayMs) = 0; |
| 38 | 38 |
| 39 // Returns a clone of the WebTaskRunner. | 39 // Returns a clone of the WebTaskRunner. |
| 40 virtual WebTaskRunner* clone() = 0; | 40 virtual WebTaskRunner* clone() = 0; |
| 41 | 41 |
| 42 // Returns true if a posted task runs on the current thread. | |
| 43 // Can be called from any thread. | |
|
kinuko
2016/07/05 14:09:19
This description sounds like a runner is always ti
tzik
2016/07/05 15:22:40
Borrowed it from base...
| |
| 44 virtual bool runsTasksOnCurrentThread() = 0; | |
| 45 | |
| 42 // --- | 46 // --- |
| 43 | 47 |
| 44 // Headless Chrome virtualises time for determinism and performance (fast fo rwarding | 48 // Headless Chrome virtualises time for determinism and performance (fast fo rwarding |
| 45 // of timers). To make this work some parts of blink (e.g. Timers) need to u se virtual | 49 // of timers). To make this work some parts of blink (e.g. Timers) need to u se virtual |
| 46 // time, however by default new code should use the normal non-virtual time APIs. | 50 // time, however by default new code should use the normal non-virtual time APIs. |
| 47 | 51 |
| 48 // Returns a double which is the number of seconds since epoch (Jan 1, 1970) . | 52 // Returns a double which is the number of seconds since epoch (Jan 1, 1970) . |
| 49 // This may represent either the real time, or a virtual time depending on | 53 // This may represent either the real time, or a virtual time depending on |
| 50 // whether or not the WebTaskRunner is associated with a virtual time domain or a | 54 // whether or not the WebTaskRunner is associated with a virtual time domain or a |
| 51 // real time domain. | 55 // real time domain. |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 71 std::unique_ptr<WebTaskRunner> adoptClone() | 75 std::unique_ptr<WebTaskRunner> adoptClone() |
| 72 { | 76 { |
| 73 return wrapUnique(clone()); | 77 return wrapUnique(clone()); |
| 74 } | 78 } |
| 75 #endif | 79 #endif |
| 76 }; | 80 }; |
| 77 | 81 |
| 78 } // namespace blink | 82 } // namespace blink |
| 79 | 83 |
| 80 #endif // WebTaskRunner_h | 84 #endif // WebTaskRunner_h |
| OLD | NEW |