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

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

Issue 2823103003: Introduce TaskRunner::RunsTasksInCurrentSequence() (Closed)
Patch Set: fixed build error and commments Created 3 years, 8 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 <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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::OnceClosure, 65 base::OnceClosure,
66 double delay_ms) = 0; 66 double delay_ms) = 0;
67 67
68 // Returns true if the current thread is a thread on which a task may be run. 68 // Drepecated: favor RunsTasksInCurrentSequence().
69 // Can be called from any thread. 69 // TODO(http://crbug.com/665062): mass redirect callers and remove this.
70 virtual bool RunsTasksOnCurrentThread() = 0; 70 bool RunsTasksOnCurrentThread();
71
72 // Returns true if tasks posted to this TaskRunner are sequenced
73 // with this call.
74 virtual bool RunsTasksInCurrentSequence() = 0;
71 75
72 // --- 76 // ---
73 77
74 // Headless Chrome virtualises time for determinism and performance (fast 78 // Headless Chrome virtualises time for determinism and performance (fast
75 // forwarding of timers). To make this work some parts of blink (e.g. Timers) 79 // forwarding of timers). To make this work some parts of blink (e.g. Timers)
76 // need to use virtual time, however by default new code should use the normal 80 // need to use virtual time, however by default new code should use the normal
77 // non-virtual time APIs. 81 // non-virtual time APIs.
78 82
79 // Returns a double which is the number of seconds since epoch (Jan 1, 1970). 83 // Returns a double which is the number of seconds since epoch (Jan 1, 1970).
80 // This may represent either the real time, or a virtual time depending on 84 // This may represent either the real time, or a virtual time depending on
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 WebTaskRunner() = default; 123 WebTaskRunner() = default;
120 virtual ~WebTaskRunner(); 124 virtual ~WebTaskRunner();
121 125
122 private: 126 private:
123 DISALLOW_COPY_AND_ASSIGN(WebTaskRunner); 127 DISALLOW_COPY_AND_ASSIGN(WebTaskRunner);
124 }; 128 };
125 129
126 } // namespace blink 130 } // namespace blink
127 131
128 #endif // WebTaskRunner_h 132 #endif // WebTaskRunner_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698