| OLD | NEW |
| 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> |
| 11 #include <set> | 11 #include <set> |
| 12 | 12 |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/pending_task.h" | 14 #include "base/pending_task.h" |
| 15 #include "base/threading/thread_checker.h" | 15 #include "base/threading/thread_checker.h" |
| 16 #include "base/trace_event/trace_event.h" | 16 #include "base/trace_event/trace_event.h" |
| 17 #include "base/trace_event/trace_event_argument.h" | 17 #include "base/trace_event/trace_event_argument.h" |
| 18 #include "platform/scheduler/base/enqueue_order.h" | 18 #include "platform/scheduler/base/enqueue_order.h" |
| 19 #include "platform/scheduler/base/intrusive_heap.h" | 19 #include "platform/scheduler/base/intrusive_heap.h" |
| 20 #include "public/platform/scheduler/base/task_queue.h" | 20 #include "public/platform/scheduler/base/task_queue.h" |
| 21 #include "wtf/Deque.h" |
| 21 | 22 |
| 22 namespace blink { | 23 namespace blink { |
| 23 namespace scheduler { | 24 namespace scheduler { |
| 24 class LazyNow; | 25 class LazyNow; |
| 25 class TimeDomain; | 26 class TimeDomain; |
| 26 class TaskQueueManager; | 27 class TaskQueueManager; |
| 27 | 28 |
| 28 namespace internal { | 29 namespace internal { |
| 29 class WorkQueue; | 30 class WorkQueue; |
| 30 class WorkQueueSets; | 31 class WorkQueueSets; |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 struct AnyThread { | 224 struct AnyThread { |
| 224 AnyThread(TaskQueueManager* task_queue_manager, TimeDomain* time_domain); | 225 AnyThread(TaskQueueManager* task_queue_manager, TimeDomain* time_domain); |
| 225 ~AnyThread(); | 226 ~AnyThread(); |
| 226 | 227 |
| 227 // TaskQueueManager and TimeDomain are maintained in two copies: | 228 // TaskQueueManager and TimeDomain are maintained in two copies: |
| 228 // inside AnyThread and inside MainThreadOnly. They can be changed only from | 229 // inside AnyThread and inside MainThreadOnly. They can be changed only from |
| 229 // main thread, so it should be locked before accessing from other threads. | 230 // main thread, so it should be locked before accessing from other threads. |
| 230 TaskQueueManager* task_queue_manager; | 231 TaskQueueManager* task_queue_manager; |
| 231 TimeDomain* time_domain; | 232 TimeDomain* time_domain; |
| 232 | 233 |
| 233 std::queue<Task> immediate_incoming_queue; | 234 WTF::Deque<Task> immediate_incoming_queue; |
| 234 }; | 235 }; |
| 235 | 236 |
| 236 struct MainThreadOnly { | 237 struct MainThreadOnly { |
| 237 MainThreadOnly(TaskQueueManager* task_queue_manager, | 238 MainThreadOnly(TaskQueueManager* task_queue_manager, |
| 238 TaskQueueImpl* task_queue, | 239 TaskQueueImpl* task_queue, |
| 239 TimeDomain* time_domain); | 240 TimeDomain* time_domain); |
| 240 ~MainThreadOnly(); | 241 ~MainThreadOnly(); |
| 241 | 242 |
| 242 // Another copy of TaskQueueManager and TimeDomain for lock-free access from | 243 // Another copy of TaskQueueManager and TimeDomain for lock-free access from |
| 243 // the main thread. See description inside struct AnyThread for details. | 244 // the main thread. See description inside struct AnyThread for details. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 const tracked_objects::Location& posted_from, | 288 const tracked_objects::Location& posted_from, |
| 288 const base::Closure& task, | 289 const base::Closure& task, |
| 289 base::TimeTicks desired_run_time, | 290 base::TimeTicks desired_run_time, |
| 290 EnqueueOrder sequence_number, | 291 EnqueueOrder sequence_number, |
| 291 bool nestable); | 292 bool nestable); |
| 292 | 293 |
| 293 // As BlockedByFence but safe to be called while locked. | 294 // As BlockedByFence but safe to be called while locked. |
| 294 bool BlockedByFenceLocked() const; | 295 bool BlockedByFenceLocked() const; |
| 295 | 296 |
| 296 void TraceQueueSize(bool is_locked) const; | 297 void TraceQueueSize(bool is_locked) const; |
| 297 static void QueueAsValueInto(const std::queue<Task>& queue, | 298 static void QueueAsValueInto(const WTF::Deque<Task>& queue, |
| 298 base::trace_event::TracedValue* state); | 299 base::trace_event::TracedValue* state); |
| 299 static void QueueAsValueInto(const std::priority_queue<Task>& queue, | 300 static void QueueAsValueInto(const std::priority_queue<Task>& queue, |
| 300 base::trace_event::TracedValue* state); | 301 base::trace_event::TracedValue* state); |
| 301 static void TaskAsValueInto(const Task& task, | 302 static void TaskAsValueInto(const Task& task, |
| 302 base::trace_event::TracedValue* state); | 303 base::trace_event::TracedValue* state); |
| 303 | 304 |
| 304 void RemoveQueueEnabledVoter(const QueueEnabledVoterImpl* voter); | 305 void RemoveQueueEnabledVoter(const QueueEnabledVoterImpl* voter); |
| 305 void OnQueueEnabledVoteChanged(bool enabled); | 306 void OnQueueEnabledVoteChanged(bool enabled); |
| 306 void EnableOrDisableWithSelector(bool enable); | 307 void EnableOrDisableWithSelector(bool enable); |
| 307 | 308 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 const bool should_report_when_execution_blocked_; | 340 const bool should_report_when_execution_blocked_; |
| 340 | 341 |
| 341 DISALLOW_COPY_AND_ASSIGN(TaskQueueImpl); | 342 DISALLOW_COPY_AND_ASSIGN(TaskQueueImpl); |
| 342 }; | 343 }; |
| 343 | 344 |
| 344 } // namespace internal | 345 } // namespace internal |
| 345 } // namespace scheduler | 346 } // namespace scheduler |
| 346 } // namespace blink | 347 } // namespace blink |
| 347 | 348 |
| 348 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_IMPL_H_ | 349 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_IMPL_H_ |
| OLD | NEW |