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 |
11 #include "wtf/Functional.h" | 11 #include "wtf/Functional.h" |
12 #include "wtf/PtrUtil.h" | |
13 #include <memory> | |
14 #endif | 12 #endif |
15 | 13 |
16 namespace blink { | 14 namespace blink { |
17 | 15 |
18 class WebTraceLocation; | 16 class WebTraceLocation; |
19 | 17 |
20 // The blink representation of a chromium SingleThreadTaskRunner. | 18 // The blink representation of a chromium SingleThreadTaskRunner. |
21 class BLINK_PLATFORM_EXPORT WebTaskRunner { | 19 class BLINK_PLATFORM_EXPORT WebTaskRunner { |
22 public: | 20 public: |
23 virtual ~WebTaskRunner() {} | 21 virtual ~WebTaskRunner() {} |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 // Helpers for posting bound functions as tasks. | 59 // Helpers for posting bound functions as tasks. |
62 | 60 |
63 // For cross-thread posting. Can be called from any thread. | 61 // For cross-thread posting. Can be called from any thread. |
64 void postTask(const WebTraceLocation&, std::unique_ptr<CrossThreadClosure>); | 62 void postTask(const WebTraceLocation&, std::unique_ptr<CrossThreadClosure>); |
65 void postDelayedTask(const WebTraceLocation&, std::unique_ptr<CrossThreadClo
sure>, long long delayMs); | 63 void postDelayedTask(const WebTraceLocation&, std::unique_ptr<CrossThreadClo
sure>, long long delayMs); |
66 | 64 |
67 // For same-thread posting. Must be called from the associated WebThread. | 65 // For same-thread posting. Must be called from the associated WebThread. |
68 void postTask(const WebTraceLocation&, std::unique_ptr<SameThreadClosure>); | 66 void postTask(const WebTraceLocation&, std::unique_ptr<SameThreadClosure>); |
69 void postDelayedTask(const WebTraceLocation&, std::unique_ptr<SameThreadClos
ure>, long long delayMs); | 67 void postDelayedTask(const WebTraceLocation&, std::unique_ptr<SameThreadClos
ure>, long long delayMs); |
70 | 68 |
71 std::unique_ptr<WebTaskRunner> adoptClone() | 69 PassOwnPtr<WebTaskRunner> adoptClone() |
72 { | 70 { |
73 return wrapUnique(clone()); | 71 return adoptPtr(clone()); |
74 } | 72 } |
75 #endif | 73 #endif |
76 }; | 74 }; |
77 | 75 |
78 } // namespace blink | 76 } // namespace blink |
79 | 77 |
80 #endif // WebTaskRunner_h | 78 #endif // WebTaskRunner_h |
OLD | NEW |