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

Side by Side Diff: third_party/WebKit/public/platform/scheduler/base/task_queue.h

Issue 2258133002: [scheduler] Implement time-based cpu throttling. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Renamed Enable/Disable to Enable/DisableThrottling. Created 4 years, 3 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 THIRD_PARTY_WEBKIT_PUBLIC_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_H_ 5 #ifndef THIRD_PARTY_WEBKIT_PUBLIC_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_H_
6 #define THIRD_PARTY_WEBKIT_PUBLIC_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_H_ 6 #define THIRD_PARTY_WEBKIT_PUBLIC_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/optional.h"
10 #include "base/single_thread_task_runner.h" 11 #include "base/single_thread_task_runner.h"
12 #include "base/time/time.h"
11 #include "public/platform/WebCommon.h" 13 #include "public/platform/WebCommon.h"
12 14
13 namespace base { 15 namespace base {
14 namespace trace_event { 16 namespace trace_event {
15 class BlameContext; 17 class BlameContext;
16 } 18 }
17 } 19 }
18 20
19 namespace blink { 21 namespace blink {
20 namespace scheduler { 22 namespace scheduler {
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 // Enable or disable task execution for this queue. NOTE this must be called 139 // Enable or disable task execution for this queue. NOTE this must be called
138 // on the thread this TaskQueue was created by. 140 // on the thread this TaskQueue was created by.
139 virtual void SetQueueEnabled(bool enabled) = 0; 141 virtual void SetQueueEnabled(bool enabled) = 0;
140 142
141 // NOTE this must be called on the thread this TaskQueue was created by. 143 // NOTE this must be called on the thread this TaskQueue was created by.
142 virtual bool IsQueueEnabled() const = 0; 144 virtual bool IsQueueEnabled() const = 0;
143 145
144 // Returns true if the queue is completely empty. 146 // Returns true if the queue is completely empty.
145 virtual bool IsEmpty() const = 0; 147 virtual bool IsEmpty() const = 0;
146 148
147 // Returns true if the queue has work that's ready to execute now. NOTE this 149 // Returns true if the queue has work that's ready to execute now.
148 // must be called on the thread this TaskQueue was created by. 150 // NOTE: this must be called on the thread this TaskQueue was created by.
149 virtual bool HasPendingImmediateWork() const = 0; 151 virtual bool HasPendingImmediateWork() const = 0;
150 152
153 // Returns requested run time of next delayed task, which is not ready
154 // to run. If there are no such tasks, returns base::nullopt.
155 // NOTE: this must be called on the thread this TaskQueue was created by.
156 virtual base::Optional<base::TimeTicks> GetNextScheduledWakeUp() = 0;
157
151 // Can be called on any thread. 158 // Can be called on any thread.
152 virtual const char* GetName() const = 0; 159 virtual const char* GetName() const = 0;
153 160
154 // Set the priority of the queue to |priority|. NOTE this must be called on 161 // Set the priority of the queue to |priority|. NOTE this must be called on
155 // the thread this TaskQueue was created by. 162 // the thread this TaskQueue was created by.
156 virtual void SetQueuePriority(QueuePriority priority) = 0; 163 virtual void SetQueuePriority(QueuePriority priority) = 0;
157 164
158 // Returns the current queue priority. 165 // Returns the current queue priority.
159 virtual QueuePriority GetQueuePriority() const = 0; 166 virtual QueuePriority GetQueuePriority() const = 0;
160 167
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 protected: 201 protected:
195 ~TaskQueue() override {} 202 ~TaskQueue() override {}
196 203
197 DISALLOW_COPY_AND_ASSIGN(TaskQueue); 204 DISALLOW_COPY_AND_ASSIGN(TaskQueue);
198 }; 205 };
199 206
200 } // namespace scheduler 207 } // namespace scheduler
201 } // namespace blink 208 } // namespace blink
202 209
203 #endif // THIRD_PARTY_WEBKIT_PUBLIC_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_H_ 210 #endif // THIRD_PARTY_WEBKIT_PUBLIC_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698