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/base_export.h" | 10 #include "base/base_export.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
42 | 42 |
43 // Runs |task| unless the current shutdown state prevents that. WillPostTask() | 43 // Runs |task| unless the current shutdown state prevents that. WillPostTask() |
44 // must have allowed |task| to be posted. | 44 // must have allowed |task| to be posted. |
45 void RunTask(const Task* task); | 45 void RunTask(const Task* task); |
46 | 46 |
47 // Returns true if shutdown has completed. | 47 // Returns true if shutdown has completed. |
48 bool IsShutdownComplete() const; | 48 bool IsShutdownComplete() const; |
49 | 49 |
50 // Returns true while shutdown is in progress (i.e. Shutdown() has been called | 50 // Returns true while shutdown is in progress (i.e. Shutdown() has been called |
51 // but hasn't returned). | 51 // but hasn't returned). |
52 bool IsShuttingDownForTesting() const; | 52 bool IsShutdownInProgress() const; |
53 | |
54 // Causes IsShutdownInProgress() to return true. Shutdown() cannot be called | |
55 // after this. | |
robliao
2016/07/19 22:41:28
Comment why one would call this instead of Shutdow
fdoray
2016/07/20 18:22:21
Done.
| |
56 void SetIsShutdownInProgressForTesting(); | |
53 | 57 |
54 private: | 58 private: |
55 class State; | 59 class State; |
56 | 60 |
57 // Called before WillPostTask() informs the tracing system that a task has | 61 // Called before WillPostTask() informs the tracing system that a task has |
58 // been posted. Updates |num_tasks_blocking_shutdown_| if necessary and | 62 // been posted. Updates |num_tasks_blocking_shutdown_| if necessary and |
59 // returns true if the current shutdown state allows the task to be posted. | 63 // returns true if the current shutdown state allows the task to be posted. |
60 bool BeforePostTask(TaskShutdownBehavior shutdown_behavior); | 64 bool BeforePostTask(TaskShutdownBehavior shutdown_behavior); |
61 | 65 |
62 // Called before a task with |shutdown_behavior| is run by RunTask(). Updates | 66 // Called before a task with |shutdown_behavior| is run by RunTask(). Updates |
(...skipping 24 matching lines...) Expand all Loading... | |
87 // Number of BLOCK_SHUTDOWN tasks posted during shutdown. | 91 // Number of BLOCK_SHUTDOWN tasks posted during shutdown. |
88 HistogramBase::Sample num_block_shutdown_tasks_posted_during_shutdown_ = 0; | 92 HistogramBase::Sample num_block_shutdown_tasks_posted_during_shutdown_ = 0; |
89 | 93 |
90 DISALLOW_COPY_AND_ASSIGN(TaskTracker); | 94 DISALLOW_COPY_AND_ASSIGN(TaskTracker); |
91 }; | 95 }; |
92 | 96 |
93 } // namespace internal | 97 } // namespace internal |
94 } // namespace base | 98 } // namespace base |
95 | 99 |
96 #endif // BASE_TASK_SCHEDULER_TASK_TRACKER_H_ | 100 #endif // BASE_TASK_SCHEDULER_TASK_TRACKER_H_ |
OLD | NEW |