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

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: Tiny optimization of MoveHoleDownAndFillWithLeafElement 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 scheduled_time_domain_wakeup() const {
181 return main_thread_only().scheduled_time_domain_wakeup;
182 }
183
184 void set_scheduled_time_domain_wakeup(
185 base::TimeTicks scheduled_time_domain_wakeup) {
186 main_thread_only().scheduled_time_domain_wakeup =
187 scheduled_time_domain_wakeup;
188 }
189
190 size_t heap_index() const { return main_thread_only().heap_index; }
191
192 void set_heap_index(size_t heap_index) {
193 main_thread_only().heap_index = heap_index;
194 }
195
180 private: 196 private:
181 friend class WorkQueue; 197 friend class WorkQueue;
182 friend class WorkQueueTest; 198 friend class WorkQueueTest;
183 199
184 enum class TaskType { 200 enum class TaskType {
185 NORMAL, 201 NORMAL,
186 NON_NESTABLE, 202 NON_NESTABLE,
187 }; 203 };
188 204
189 struct AnyThread { 205 struct AnyThread {
(...skipping 18 matching lines...) Expand all
208 // Another copy of TaskQueueManager and TimeDomain for lock-free access from 224 // Another copy of TaskQueueManager and TimeDomain for lock-free access from
209 // the main thread. See description inside struct AnyThread for details. 225 // the main thread. See description inside struct AnyThread for details.
210 TaskQueueManager* task_queue_manager; 226 TaskQueueManager* task_queue_manager;
211 TimeDomain* time_domain; 227 TimeDomain* time_domain;
212 228
213 std::unique_ptr<WorkQueue> delayed_work_queue; 229 std::unique_ptr<WorkQueue> delayed_work_queue;
214 std::unique_ptr<WorkQueue> immediate_work_queue; 230 std::unique_ptr<WorkQueue> immediate_work_queue;
215 std::priority_queue<Task> delayed_incoming_queue; 231 std::priority_queue<Task> delayed_incoming_queue;
216 base::ObserverList<base::MessageLoop::TaskObserver> task_observers; 232 base::ObserverList<base::MessageLoop::TaskObserver> task_observers;
217 size_t set_index; 233 size_t set_index;
234 size_t heap_index;
218 bool is_enabled; 235 bool is_enabled;
219 base::trace_event::BlameContext* blame_context; // Not owned. 236 base::trace_event::BlameContext* blame_context; // Not owned.
220 EnqueueOrder current_fence; 237 EnqueueOrder current_fence;
238 base::TimeTicks scheduled_time_domain_wakeup;
221 }; 239 };
222 240
223 ~TaskQueueImpl() override; 241 ~TaskQueueImpl() override;
224 242
225 bool PostImmediateTaskImpl(const tracked_objects::Location& from_here, 243 bool PostImmediateTaskImpl(const tracked_objects::Location& from_here,
226 const base::Closure& task, 244 const base::Closure& task,
227 TaskType task_type); 245 TaskType task_type);
228 bool PostDelayedTaskImpl(const tracked_objects::Location& from_here, 246 bool PostDelayedTaskImpl(const tracked_objects::Location& from_here,
229 const base::Closure& task, 247 const base::Closure& task,
230 base::TimeDelta delay, 248 base::TimeDelta delay,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 const bool should_report_when_execution_blocked_; 315 const bool should_report_when_execution_blocked_;
298 316
299 DISALLOW_COPY_AND_ASSIGN(TaskQueueImpl); 317 DISALLOW_COPY_AND_ASSIGN(TaskQueueImpl);
300 }; 318 };
301 319
302 } // namespace internal 320 } // namespace internal
303 } // namespace scheduler 321 } // namespace scheduler
304 } // namespace blink 322 } // namespace blink
305 323
306 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_IMPL_H_ 324 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698