OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 BASE_TASK_SCHEDULER_TASK_TRACKER_H_ | 5 #ifndef BASE_TASK_SCHEDULER_TASK_TRACKER_H_ |
6 #define BASE_TASK_SCHEDULER_TASK_TRACKER_H_ | 6 #define BASE_TASK_SCHEDULER_TASK_TRACKER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/atomicops.h" | 10 #include "base/atomicops.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 virtual void PerformRunTask(std::unique_ptr<Task> task, | 83 virtual void PerformRunTask(std::unique_ptr<Task> task, |
84 const SequenceToken& sequence_token); | 84 const SequenceToken& sequence_token); |
85 | 85 |
86 #if DCHECK_IS_ON() | 86 #if DCHECK_IS_ON() |
87 // Returns true if this context should be exempt from blocking shutdown | 87 // Returns true if this context should be exempt from blocking shutdown |
88 // DCHECKs. | 88 // DCHECKs. |
89 // TODO(robliao): Remove when http://crbug.com/698140 is fixed. | 89 // TODO(robliao): Remove when http://crbug.com/698140 is fixed. |
90 virtual bool IsPostingBlockShutdownTaskAfterShutdownAllowed(); | 90 virtual bool IsPostingBlockShutdownTaskAfterShutdownAllowed(); |
91 #endif | 91 #endif |
92 | 92 |
| 93 // Returns the number of undelayed tasks that haven't completed their |
| 94 // execution. |
| 95 int GetNumPendingUndelayedTasksForTesting() const; |
| 96 |
93 private: | 97 private: |
94 class State; | 98 class State; |
95 | 99 |
96 void PerformShutdown(); | 100 void PerformShutdown(); |
97 | 101 |
98 // Called before WillPostTask() informs the tracing system that a task has | 102 // Called before WillPostTask() informs the tracing system that a task has |
99 // been posted. Updates |num_tasks_blocking_shutdown_| if necessary and | 103 // been posted. Updates |num_tasks_blocking_shutdown_| if necessary and |
100 // returns true if the current shutdown state allows the task to be posted. | 104 // returns true if the current shutdown state allows the task to be posted. |
101 bool BeforePostTask(TaskShutdownBehavior shutdown_behavior); | 105 bool BeforePostTask(TaskShutdownBehavior shutdown_behavior); |
102 | 106 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 // Number of BLOCK_SHUTDOWN tasks posted during shutdown. | 162 // Number of BLOCK_SHUTDOWN tasks posted during shutdown. |
159 HistogramBase::Sample num_block_shutdown_tasks_posted_during_shutdown_ = 0; | 163 HistogramBase::Sample num_block_shutdown_tasks_posted_during_shutdown_ = 0; |
160 | 164 |
161 DISALLOW_COPY_AND_ASSIGN(TaskTracker); | 165 DISALLOW_COPY_AND_ASSIGN(TaskTracker); |
162 }; | 166 }; |
163 | 167 |
164 } // namespace internal | 168 } // namespace internal |
165 } // namespace base | 169 } // namespace base |
166 | 170 |
167 #endif // BASE_TASK_SCHEDULER_TASK_TRACKER_H_ | 171 #endif // BASE_TASK_SCHEDULER_TASK_TRACKER_H_ |
OLD | NEW |