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 | |
97 private: | 93 private: |
98 class State; | 94 class State; |
99 | 95 |
100 void PerformShutdown(); | 96 void PerformShutdown(); |
101 | 97 |
102 // Called before WillPostTask() informs the tracing system that a task has | 98 // Called before WillPostTask() informs the tracing system that a task has |
103 // been posted. Updates |num_tasks_blocking_shutdown_| if necessary and | 99 // been posted. Updates |num_tasks_blocking_shutdown_| if necessary and |
104 // returns true if the current shutdown state allows the task to be posted. | 100 // returns true if the current shutdown state allows the task to be posted. |
105 bool BeforePostTask(TaskShutdownBehavior shutdown_behavior); | 101 bool BeforePostTask(TaskShutdownBehavior shutdown_behavior); |
106 | 102 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 // Number of BLOCK_SHUTDOWN tasks posted during shutdown. | 158 // Number of BLOCK_SHUTDOWN tasks posted during shutdown. |
163 HistogramBase::Sample num_block_shutdown_tasks_posted_during_shutdown_ = 0; | 159 HistogramBase::Sample num_block_shutdown_tasks_posted_during_shutdown_ = 0; |
164 | 160 |
165 DISALLOW_COPY_AND_ASSIGN(TaskTracker); | 161 DISALLOW_COPY_AND_ASSIGN(TaskTracker); |
166 }; | 162 }; |
167 | 163 |
168 } // namespace internal | 164 } // namespace internal |
169 } // namespace base | 165 } // namespace base |
170 | 166 |
171 #endif // BASE_TASK_SCHEDULER_TASK_TRACKER_H_ | 167 #endif // BASE_TASK_SCHEDULER_TASK_TRACKER_H_ |
OLD | NEW |