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 <memory> | 8 #include <memory> |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "public/platform/WebCommon.h" | 10 #include "public/platform/WebCommon.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 RefPtr<Runner> m_runner; | 55 RefPtr<Runner> m_runner; |
56 }; | 56 }; |
57 | 57 |
58 // The blink representation of a chromium SingleThreadTaskRunner. | 58 // The blink representation of a chromium SingleThreadTaskRunner. |
59 class BLINK_PLATFORM_EXPORT WebTaskRunner | 59 class BLINK_PLATFORM_EXPORT WebTaskRunner |
60 : public ThreadSafeRefCounted<WebTaskRunner> { | 60 : public ThreadSafeRefCounted<WebTaskRunner> { |
61 public: | 61 public: |
62 // Schedule a task to be run after |delayMs| on the the associated WebThread. | 62 // Schedule a task to be run after |delayMs| on the the associated WebThread. |
63 // Can be called from any thread. | 63 // Can be called from any thread. |
64 virtual void postDelayedTask(const WebTraceLocation&, | 64 virtual void postDelayedTask(const WebTraceLocation&, |
65 base::Closure, | 65 base::OnceClosure, |
66 double delayMs) = 0; | 66 double delayMs) = 0; |
67 | 67 |
68 // Returns true if the current thread is a thread on which a task may be run. | 68 // Returns true if the current thread is a thread on which a task may be run. |
69 // Can be called from any thread. | 69 // Can be called from any thread. |
70 virtual bool runsTasksOnCurrentThread() = 0; | 70 virtual bool runsTasksOnCurrentThread() = 0; |
71 | 71 |
72 // --- | 72 // --- |
73 | 73 |
74 // Headless Chrome virtualises time for determinism and performance (fast | 74 // Headless Chrome virtualises time for determinism and performance (fast |
75 // forwarding of timers). To make this work some parts of blink (e.g. Timers) | 75 // forwarding of timers). To make this work some parts of blink (e.g. Timers) |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 WebTaskRunner() = default; | 119 WebTaskRunner() = default; |
120 virtual ~WebTaskRunner(); | 120 virtual ~WebTaskRunner(); |
121 | 121 |
122 private: | 122 private: |
123 DISALLOW_COPY_AND_ASSIGN(WebTaskRunner); | 123 DISALLOW_COPY_AND_ASSIGN(WebTaskRunner); |
124 }; | 124 }; |
125 | 125 |
126 } // namespace blink | 126 } // namespace blink |
127 | 127 |
128 #endif // WebTaskRunner_h | 128 #endif // WebTaskRunner_h |
OLD | NEW |