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 19 matching lines...) Expand all Loading... | |
30 // Takes ownership of |Task|. Can be called from any thread. | 30 // Takes ownership of |Task|. Can be called from any thread. |
31 virtual void postTask(const WebTraceLocation&, Task*) = 0; | 31 virtual void postTask(const WebTraceLocation&, Task*) = 0; |
32 | 32 |
33 // Schedule a task to be run after |delayMs| on the the associated WebThread . | 33 // Schedule a task to be run after |delayMs| on the the associated WebThread . |
34 // Takes ownership of |Task|. Can be called from any thread. | 34 // Takes ownership of |Task|. Can be called from any thread. |
35 virtual void postDelayedTask(const WebTraceLocation&, Task*, double delayMs) = 0; | 35 virtual void postDelayedTask(const WebTraceLocation&, Task*, double delayMs) = 0; |
36 | 36 |
37 // Returns a clone of the WebTaskRunner. | 37 // Returns a clone of the WebTaskRunner. |
38 virtual WebTaskRunner* clone() = 0; | 38 virtual WebTaskRunner* clone() = 0; |
39 | 39 |
40 // --- | |
41 | |
42 // Headless Chrome virtualises time for determinism and performance (fast fo rwarding | |
43 // of timers). To make this work some parts of blink (e.g. Timers) need to u se virtual | |
44 // time, however by default new code should use the normal non-virtual time APIs. | |
45 | |
46 // Returns a double which is the number of seconds since epoch (Jan 1, 1970) . | |
47 // This may represent either the real time, or a virtual time depending on | |
Sami
2016/02/09 21:00:28
These two functions no longer depend on whether we
alex clarke (OOO till 29th)
2016/02/10 14:58:07
Done.
| |
48 // whether or not the system is currently running a task associated with a | |
49 // virtual time domain or real time domain. | |
50 virtual double virtualTimeSeconds() const = 0; | |
51 | |
52 // Returns a microsecond resolution platform dependant time source. | |
53 // This may represent either the real time, or a virtual time depending on | |
54 // whether or not the system is currently running a task associated with a | |
55 // virtual time domain or real time domain. | |
56 virtual double monotonicallyIncreasingVirtualTimeSeconds() const = 0; | |
57 | |
40 #ifdef INSIDE_BLINK | 58 #ifdef INSIDE_BLINK |
41 // Helpers for posting bound functions as tasks. | 59 // Helpers for posting bound functions as tasks. |
42 typedef Function<void()> ClosureTask; | 60 typedef Function<void()> ClosureTask; |
43 | 61 |
44 void postTask(const WebTraceLocation&, PassOwnPtr<ClosureTask>); | 62 void postTask(const WebTraceLocation&, PassOwnPtr<ClosureTask>); |
45 // TODO(alexclarke): Remove this when possible. | 63 // TODO(alexclarke): Remove this when possible. |
46 void postDelayedTask(const WebTraceLocation&, PassOwnPtr<ClosureTask>, long long delayMs); | 64 void postDelayedTask(const WebTraceLocation&, PassOwnPtr<ClosureTask>, long long delayMs); |
47 void postDelayedTask(const WebTraceLocation&, PassOwnPtr<ClosureTask>, doubl e delayMs); | 65 void postDelayedTask(const WebTraceLocation&, PassOwnPtr<ClosureTask>, doubl e delayMs); |
48 | 66 |
49 PassOwnPtr<WebTaskRunner> adoptClone() | 67 PassOwnPtr<WebTaskRunner> adoptClone() |
50 { | 68 { |
51 return adoptPtr(clone()); | 69 return adoptPtr(clone()); |
52 } | 70 } |
53 #endif | 71 #endif |
54 }; | 72 }; |
55 | 73 |
56 } // namespace blink | 74 } // namespace blink |
57 | 75 |
58 #endif // WebTaskRunner_h | 76 #endif // WebTaskRunner_h |
OLD | NEW |