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 "platform/wtf/Compiler.h" | 10 #include "platform/wtf/Compiler.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 friend class WebTaskRunner; | 53 friend class WebTaskRunner; |
54 | 54 |
55 explicit TaskHandle(RefPtr<Runner>); | 55 explicit TaskHandle(RefPtr<Runner>); |
56 RefPtr<Runner> runner_; | 56 RefPtr<Runner> runner_; |
57 }; | 57 }; |
58 | 58 |
59 // The blink representation of a chromium SingleThreadTaskRunner. | 59 // The blink representation of a chromium SingleThreadTaskRunner. |
60 class BLINK_PLATFORM_EXPORT WebTaskRunner | 60 class BLINK_PLATFORM_EXPORT WebTaskRunner |
61 : public ThreadSafeRefCounted<WebTaskRunner> { | 61 : public ThreadSafeRefCounted<WebTaskRunner> { |
62 public: | 62 public: |
63 // Drepecated: favor RunsTasksInCurrentSequence(). | |
64 // TODO(http://crbug.com/665062): mass redirect callers and remove this. | |
65 bool RunsTasksOnCurrentThread(); | |
66 | |
67 // Returns true if tasks posted to this TaskRunner are sequenced | 63 // Returns true if tasks posted to this TaskRunner are sequenced |
68 // with this call. | 64 // with this call. |
69 virtual bool RunsTasksInCurrentSequence() = 0; | 65 virtual bool RunsTasksInCurrentSequence() = 0; |
70 | 66 |
71 // --- | 67 // --- |
72 | 68 |
73 // Headless Chrome virtualises time for determinism and performance (fast | 69 // Headless Chrome virtualises time for determinism and performance (fast |
74 // forwarding of timers). To make this work some parts of blink (e.g. Timers) | 70 // forwarding of timers). To make this work some parts of blink (e.g. Timers) |
75 // need to use virtual time, however by default new code should use the normal | 71 // need to use virtual time, however by default new code should use the normal |
76 // non-virtual time APIs. | 72 // non-virtual time APIs. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 WebTaskRunner() = default; | 114 WebTaskRunner() = default; |
119 virtual ~WebTaskRunner(); | 115 virtual ~WebTaskRunner(); |
120 | 116 |
121 private: | 117 private: |
122 DISALLOW_COPY_AND_ASSIGN(WebTaskRunner); | 118 DISALLOW_COPY_AND_ASSIGN(WebTaskRunner); |
123 }; | 119 }; |
124 | 120 |
125 } // namespace blink | 121 } // namespace blink |
126 | 122 |
127 #endif // WebTaskRunner_h | 123 #endif // WebTaskRunner_h |
OLD | NEW |