| 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 #include "public/platform/WebTraceLocation.h" | 9 #include "public/platform/WebTraceLocation.h" |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 // Takes ownership of |Task|. Can be called from any thread. | 31 // Takes ownership of |Task|. Can be called from any thread. |
| 32 virtual void postTask(const WebTraceLocation&, Task*) = 0; | 32 virtual void postTask(const WebTraceLocation&, Task*) = 0; |
| 33 | 33 |
| 34 // Schedule a task to be run after |delayMs| on the the associated WebThread
. | 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. | 35 // Takes ownership of |Task|. Can be called from any thread. |
| 36 virtual void postDelayedTask(const WebTraceLocation&, Task*, double delayMs)
= 0; | 36 virtual void postDelayedTask(const WebTraceLocation&, Task*, double delayMs)
= 0; |
| 37 | 37 |
| 38 // Returns a clone of the WebTaskRunner. | 38 // Returns a clone of the WebTaskRunner. |
| 39 virtual WebTaskRunner* clone() = 0; | 39 virtual WebTaskRunner* clone() = 0; |
| 40 | 40 |
| 41 // Returns true if the current thread is a thread on which a task may be run
. |
| 42 // Can be called from any thread. |
| 43 virtual bool runsTasksOnCurrentThread() = 0; |
| 44 |
| 41 // --- | 45 // --- |
| 42 | 46 |
| 43 // Headless Chrome virtualises time for determinism and performance (fast fo
rwarding | 47 // Headless Chrome virtualises time for determinism and performance (fast fo
rwarding |
| 44 // of timers). To make this work some parts of blink (e.g. Timers) need to u
se virtual | 48 // of timers). To make this work some parts of blink (e.g. Timers) need to u
se virtual |
| 45 // time, however by default new code should use the normal non-virtual time
APIs. | 49 // time, however by default new code should use the normal non-virtual time
APIs. |
| 46 | 50 |
| 47 // Returns a double which is the number of seconds since epoch (Jan 1, 1970)
. | 51 // Returns a double which is the number of seconds since epoch (Jan 1, 1970)
. |
| 48 // This may represent either the real time, or a virtual time depending on | 52 // This may represent either the real time, or a virtual time depending on |
| 49 // whether or not the WebTaskRunner is associated with a virtual time domain
or a | 53 // whether or not the WebTaskRunner is associated with a virtual time domain
or a |
| 50 // real time domain. | 54 // real time domain. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 70 std::unique_ptr<WebTaskRunner> adoptClone() | 74 std::unique_ptr<WebTaskRunner> adoptClone() |
| 71 { | 75 { |
| 72 return wrapUnique(clone()); | 76 return wrapUnique(clone()); |
| 73 } | 77 } |
| 74 #endif | 78 #endif |
| 75 }; | 79 }; |
| 76 | 80 |
| 77 } // namespace blink | 81 } // namespace blink |
| 78 | 82 |
| 79 #endif // WebTaskRunner_h | 83 #endif // WebTaskRunner_h |
| OLD | NEW |