OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_MANAGER_H_ | 5 #ifndef THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_MANAGER_H_ |
6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_MANAGER_H_ | 6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/atomic_sequence_num.h" | 10 #include "base/atomic_sequence_num.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 // Requests that a task to process work is posted on the main task runner. | 67 // Requests that a task to process work is posted on the main task runner. |
68 // These tasks are de-duplicated in two buckets: main-thread and all other | 68 // These tasks are de-duplicated in two buckets: main-thread and all other |
69 // threads. This distinction is done to reduce the overehead from locks, we | 69 // threads. This distinction is done to reduce the overehead from locks, we |
70 // assume the main-thread path will be hot. | 70 // assume the main-thread path will be hot. |
71 void MaybeScheduleImmediateWork(const tracked_objects::Location& from_here); | 71 void MaybeScheduleImmediateWork(const tracked_objects::Location& from_here); |
72 | 72 |
73 // Requests that a delayed task to process work is posted on the main task | 73 // Requests that a delayed task to process work is posted on the main task |
74 // runner. These delayed tasks are de-duplicated. Must be called on the thread | 74 // runner. These delayed tasks are de-duplicated. Must be called on the thread |
75 // this class was created on. | 75 // this class was created on. |
76 void MaybeScheduleDelayedWork(const tracked_objects::Location& from_here, | 76 void MaybeScheduleDelayedWork(const tracked_objects::Location& from_here, |
77 LazyNow* lazy_now, | 77 base::TimeTicks now, |
78 base::TimeTicks run_time); | 78 base::TimeDelta delay); |
79 | |
80 // Cancels a delayed task to process work at |run_time|, previously requested | |
81 // with MaybeScheduleDelayedWork. | |
82 void CancelDelayedWork(base::TimeTicks run_time); | |
83 | 79 |
84 // Set the number of tasks executed in a single invocation of the task queue | 80 // Set the number of tasks executed in a single invocation of the task queue |
85 // manager. Increasing the batch size can reduce the overhead of yielding | 81 // manager. Increasing the batch size can reduce the overhead of yielding |
86 // back to the main message loop -- at the cost of potentially delaying other | 82 // back to the main message loop -- at the cost of potentially delaying other |
87 // tasks posted to the main loop. The batch size is 1 by default. | 83 // tasks posted to the main loop. The batch size is 1 by default. |
88 void SetWorkBatchSize(int work_batch_size); | 84 void SetWorkBatchSize(int work_batch_size); |
89 | 85 |
90 // These functions can only be called on the same thread that the task queue | 86 // These functions can only be called on the same thread that the task queue |
91 // manager executes its tasks on. | 87 // manager executes its tasks on. |
92 void AddTaskObserver(base::MessageLoop::TaskObserver* task_observer); | 88 void AddTaskObserver(base::MessageLoop::TaskObserver* task_observer); |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 scoped_refptr<DeletionSentinel> deletion_sentinel_; | 294 scoped_refptr<DeletionSentinel> deletion_sentinel_; |
299 base::WeakPtrFactory<TaskQueueManager> weak_factory_; | 295 base::WeakPtrFactory<TaskQueueManager> weak_factory_; |
300 | 296 |
301 DISALLOW_COPY_AND_ASSIGN(TaskQueueManager); | 297 DISALLOW_COPY_AND_ASSIGN(TaskQueueManager); |
302 }; | 298 }; |
303 | 299 |
304 } // namespace scheduler | 300 } // namespace scheduler |
305 } // namespace blink | 301 } // namespace blink |
306 | 302 |
307 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_MANAGER_
H_ | 303 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_MANAGER_
H_ |
OLD | NEW |