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 base::TimeTicks now, | 77 LazyNow* lazy_now, |
78 base::TimeDelta delay); | 78 base::TimeTicks run_time); |
79 | |
80 // Cancels a delayed task to process work at |run_time|, previously requested | |
81 // with MaybeScheduleDelayedWork. | |
82 void CancelDelayedWork(base::TimeTicks run_time); | |
Sami
2017/01/27 12:36:25
What if one time domain accidentally cancels the w
alex clarke (OOO till 29th)
2017/01/30 18:24:01
As discussed offline I've added some code to track
| |
79 | 83 |
80 // Set the number of tasks executed in a single invocation of the task queue | 84 // Set the number of tasks executed in a single invocation of the task queue |
81 // manager. Increasing the batch size can reduce the overhead of yielding | 85 // manager. Increasing the batch size can reduce the overhead of yielding |
82 // back to the main message loop -- at the cost of potentially delaying other | 86 // back to the main message loop -- at the cost of potentially delaying other |
83 // tasks posted to the main loop. The batch size is 1 by default. | 87 // tasks posted to the main loop. The batch size is 1 by default. |
84 void SetWorkBatchSize(int work_batch_size); | 88 void SetWorkBatchSize(int work_batch_size); |
85 | 89 |
86 // These functions can only be called on the same thread that the task queue | 90 // These functions can only be called on the same thread that the task queue |
87 // manager executes its tasks on. | 91 // manager executes its tasks on. |
88 void AddTaskObserver(base::MessageLoop::TaskObserver* task_observer); | 92 void AddTaskObserver(base::MessageLoop::TaskObserver* task_observer); |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
314 scoped_refptr<DeletionSentinel> deletion_sentinel_; | 318 scoped_refptr<DeletionSentinel> deletion_sentinel_; |
315 base::WeakPtrFactory<TaskQueueManager> weak_factory_; | 319 base::WeakPtrFactory<TaskQueueManager> weak_factory_; |
316 | 320 |
317 DISALLOW_COPY_AND_ASSIGN(TaskQueueManager); | 321 DISALLOW_COPY_AND_ASSIGN(TaskQueueManager); |
318 }; | 322 }; |
319 | 323 |
320 } // namespace scheduler | 324 } // namespace scheduler |
321 } // namespace blink | 325 } // namespace blink |
322 | 326 |
323 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_MANAGER_ H_ | 327 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_MANAGER_ H_ |
OLD | NEW |