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

Side by Side Diff: third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h

Issue 2419793002: [Reland] Optimize blink scheduler with an intrusive heap (Closed)
Patch Set: Fix bug in MoveHoleDown Created 4 years, 2 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_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_IMPL_H_ 5 #ifndef THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_IMPL_H_
6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_IMPL_H_ 6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_IMPL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 170
171 bool should_report_when_execution_blocked() const { 171 bool should_report_when_execution_blocked() const {
172 return should_report_when_execution_blocked_; 172 return should_report_when_execution_blocked_;
173 } 173 }
174 174
175 // Enqueues any delayed tasks which should be run now on the 175 // Enqueues any delayed tasks which should be run now on the
176 // |delayed_work_queue|. It also schedules the next wake up with the 176 // |delayed_work_queue|. It also schedules the next wake up with the
177 // TimeDomain. Must be called from the main thread. 177 // TimeDomain. Must be called from the main thread.
178 void WakeUpForDelayedWork(LazyNow* lazy_now); 178 void WakeUpForDelayedWork(LazyNow* lazy_now);
179 179
180 base::TimeTicks time_domain_wakeup() const {
181 return main_thread_only().time_domain_wakeup;
182 }
183
184 void set_time_domain_wakeup(base::TimeTicks time_domain_wakeup) {
185 main_thread_only().time_domain_wakeup = time_domain_wakeup;
186 }
187
188 size_t heap_index() const { return main_thread_only().heap_index; }
189
190 void set_heap_index(size_t heap_index) {
191 main_thread_only().heap_index = heap_index;
192 }
193
180 private: 194 private:
181 friend class WorkQueue; 195 friend class WorkQueue;
182 friend class WorkQueueTest; 196 friend class WorkQueueTest;
183 197
184 enum class TaskType { 198 enum class TaskType {
185 NORMAL, 199 NORMAL,
186 NON_NESTABLE, 200 NON_NESTABLE,
187 }; 201 };
188 202
189 struct AnyThread { 203 struct AnyThread {
(...skipping 18 matching lines...) Expand all
208 // Another copy of TaskQueueManager and TimeDomain for lock-free access from 222 // Another copy of TaskQueueManager and TimeDomain for lock-free access from
209 // the main thread. See description inside struct AnyThread for details. 223 // the main thread. See description inside struct AnyThread for details.
210 TaskQueueManager* task_queue_manager; 224 TaskQueueManager* task_queue_manager;
211 TimeDomain* time_domain; 225 TimeDomain* time_domain;
212 226
213 std::unique_ptr<WorkQueue> delayed_work_queue; 227 std::unique_ptr<WorkQueue> delayed_work_queue;
214 std::unique_ptr<WorkQueue> immediate_work_queue; 228 std::unique_ptr<WorkQueue> immediate_work_queue;
215 std::priority_queue<Task> delayed_incoming_queue; 229 std::priority_queue<Task> delayed_incoming_queue;
216 base::ObserverList<base::MessageLoop::TaskObserver> task_observers; 230 base::ObserverList<base::MessageLoop::TaskObserver> task_observers;
217 size_t set_index; 231 size_t set_index;
232 size_t heap_index;
218 bool is_enabled; 233 bool is_enabled;
219 base::trace_event::BlameContext* blame_context; // Not owned. 234 base::trace_event::BlameContext* blame_context; // Not owned.
220 EnqueueOrder current_fence; 235 EnqueueOrder current_fence;
236 base::TimeTicks time_domain_wakeup;
Sami 2016/10/14 07:26:16 It's a bit unclear what this is. |scheduled_time_d
alex clarke (OOO till 29th) 2016/10/14 13:55:35 Done.
221 }; 237 };
222 238
223 ~TaskQueueImpl() override; 239 ~TaskQueueImpl() override;
224 240
225 bool PostImmediateTaskImpl(const tracked_objects::Location& from_here, 241 bool PostImmediateTaskImpl(const tracked_objects::Location& from_here,
226 const base::Closure& task, 242 const base::Closure& task,
227 TaskType task_type); 243 TaskType task_type);
228 bool PostDelayedTaskImpl(const tracked_objects::Location& from_here, 244 bool PostDelayedTaskImpl(const tracked_objects::Location& from_here,
229 const base::Closure& task, 245 const base::Closure& task,
230 base::TimeDelta delay, 246 base::TimeDelta delay,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 const bool should_report_when_execution_blocked_; 313 const bool should_report_when_execution_blocked_;
298 314
299 DISALLOW_COPY_AND_ASSIGN(TaskQueueImpl); 315 DISALLOW_COPY_AND_ASSIGN(TaskQueueImpl);
300 }; 316 };
301 317
302 } // namespace internal 318 } // namespace internal
303 } // namespace scheduler 319 } // namespace scheduler
304 } // namespace blink 320 } // namespace blink
305 321
306 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_IMPL_H_ 322 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698