Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(276)

Side by Side Diff: third_party/WebKit/public/platform/WebTaskRunner.h

Issue 2118903002: scheduler: Move the Blink scheduler into Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Another GYP fix Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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" 12 #include "wtf/PtrUtil.h"
13 #include <memory> 13 #include <memory>
14 #endif 14 #endif
15 15
16 namespace base {
17 class SingleThreadTaskRunner;
18 }
19
16 namespace blink { 20 namespace blink {
17 21
18 class WebTraceLocation; 22 class WebTraceLocation;
19 23
20 // The blink representation of a chromium SingleThreadTaskRunner. 24 // The blink representation of a chromium SingleThreadTaskRunner.
21 class BLINK_PLATFORM_EXPORT WebTaskRunner { 25 class BLINK_PLATFORM_EXPORT WebTaskRunner {
22 public: 26 public:
23 virtual ~WebTaskRunner() {} 27 virtual ~WebTaskRunner() {}
24 28
25 class BLINK_PLATFORM_EXPORT Task { 29 class BLINK_PLATFORM_EXPORT Task {
(...skipping 24 matching lines...) Expand all
50 // whether or not the WebTaskRunner is associated with a virtual time domain or a 54 // whether or not the WebTaskRunner is associated with a virtual time domain or a
51 // real time domain. 55 // real time domain.
52 virtual double virtualTimeSeconds() const = 0; 56 virtual double virtualTimeSeconds() const = 0;
53 57
54 // Returns a microsecond resolution platform dependant time source. 58 // Returns a microsecond resolution platform dependant time source.
55 // This may represent either the real time, or a virtual time depending on 59 // This may represent either the real time, or a virtual time depending on
56 // whether or not the WebTaskRunner is associated with a virtual time domain or a 60 // whether or not the WebTaskRunner is associated with a virtual time domain or a
57 // real time domain. 61 // real time domain.
58 virtual double monotonicallyIncreasingVirtualTimeSeconds() const = 0; 62 virtual double monotonicallyIncreasingVirtualTimeSeconds() const = 0;
59 63
64 // Returns the underlying task runner object.
65 virtual scoped_refptr<base::SingleThreadTaskRunner> taskRunner() = 0;
66
60 #ifdef INSIDE_BLINK 67 #ifdef INSIDE_BLINK
61 // Helpers for posting bound functions as tasks. 68 // Helpers for posting bound functions as tasks.
62 69
63 // For cross-thread posting. Can be called from any thread. 70 // For cross-thread posting. Can be called from any thread.
64 void postTask(const WebTraceLocation&, std::unique_ptr<CrossThreadClosure>); 71 void postTask(const WebTraceLocation&, std::unique_ptr<CrossThreadClosure>);
65 void postDelayedTask(const WebTraceLocation&, std::unique_ptr<CrossThreadClo sure>, long long delayMs); 72 void postDelayedTask(const WebTraceLocation&, std::unique_ptr<CrossThreadClo sure>, long long delayMs);
66 73
67 // For same-thread posting. Must be called from the associated WebThread. 74 // For same-thread posting. Must be called from the associated WebThread.
68 void postTask(const WebTraceLocation&, std::unique_ptr<WTF::Closure>); 75 void postTask(const WebTraceLocation&, std::unique_ptr<WTF::Closure>);
69 void postDelayedTask(const WebTraceLocation&, std::unique_ptr<WTF::Closure>, long long delayMs); 76 void postDelayedTask(const WebTraceLocation&, std::unique_ptr<WTF::Closure>, long long delayMs);
70 77
71 std::unique_ptr<WebTaskRunner> adoptClone() 78 std::unique_ptr<WebTaskRunner> adoptClone()
72 { 79 {
73 return wrapUnique(clone()); 80 return wrapUnique(clone());
74 } 81 }
75 #endif 82 #endif
76 }; 83 };
77 84
78 } // namespace blink 85 } // namespace blink
79 86
80 #endif // WebTaskRunner_h 87 #endif // WebTaskRunner_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698