| 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 "base/callback_forward.h" | 8 #include <memory> |
| 9 #include "base/callback.h" |
| 9 #include "public/platform/WebCommon.h" | 10 #include "public/platform/WebCommon.h" |
| 10 #include "public/platform/WebTraceLocation.h" | 11 #include "public/platform/WebTraceLocation.h" |
| 11 #include "wtf/Compiler.h" | 12 #include "wtf/Compiler.h" |
| 12 #include "wtf/Functional.h" | 13 #include "wtf/Functional.h" |
| 13 #include "wtf/RefCounted.h" | 14 #include "wtf/RefCounted.h" |
| 14 #include "wtf/WeakPtr.h" | 15 #include "wtf/WeakPtr.h" |
| 15 #include <memory> | |
| 16 | 16 |
| 17 namespace base { | 17 namespace base { |
| 18 class SingleThreadTaskRunner; | 18 class SingleThreadTaskRunner; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace blink { | 21 namespace blink { |
| 22 | 22 |
| 23 using SingleThreadTaskRunner = base::SingleThreadTaskRunner; | 23 using SingleThreadTaskRunner = base::SingleThreadTaskRunner; |
| 24 | 24 |
| 25 // TaskHandle is associated to a task posted by | 25 // TaskHandle is associated to a task posted by |
| (...skipping 29 matching lines...) Expand all 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 const base::Closure&, | 65 base::Closure, |
| 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 |