Chromium Code Reviews| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 bool HasShutdownStarted() const; | 66 bool HasShutdownStarted() const; |
| 67 | 67 |
| 68 // Returns true if shutdown has completed (Shutdown() has returned). | 68 // Returns true if shutdown has completed (Shutdown() has returned). |
| 69 bool IsShutdownComplete() const; | 69 bool IsShutdownComplete() const; |
| 70 | 70 |
| 71 // Causes HasShutdownStarted() to return true. Unlike when Shutdown() returns, | 71 // Causes HasShutdownStarted() to return true. Unlike when Shutdown() returns, |
| 72 // IsShutdownComplete() won't return true after this returns. Shutdown() | 72 // IsShutdownComplete() won't return true after this returns. Shutdown() |
| 73 // cannot be called after this. | 73 // cannot be called after this. |
| 74 void SetHasShutdownStartedForTesting(); | 74 void SetHasShutdownStartedForTesting(); |
| 75 | 75 |
| 76 protected: | |
| 77 // Runs |task|. An override should perform work before running the task, | |
| 78 // invoke the base class implementation to run the task and perform work after | |
| 79 // running the task. | |
|
gab
2016/10/21 16:10:48
An override doesn't "have to" perform work IMO, ho
fdoray
2016/10/27 13:06:50
Done.
| |
| 80 virtual void PerformRunTask(std::unique_ptr<Task> task); | |
| 81 | |
| 76 private: | 82 private: |
| 77 class State; | 83 class State; |
| 78 | 84 |
| 79 void PerformShutdown(); | 85 void PerformShutdown(); |
| 80 | 86 |
| 81 // Called before WillPostTask() informs the tracing system that a task has | 87 // Called before WillPostTask() informs the tracing system that a task has |
| 82 // been posted. Updates |num_tasks_blocking_shutdown_| if necessary and | 88 // been posted. Updates |num_tasks_blocking_shutdown_| if necessary and |
| 83 // returns true if the current shutdown state allows the task to be posted. | 89 // returns true if the current shutdown state allows the task to be posted. |
| 84 bool BeforePostTask(TaskShutdownBehavior shutdown_behavior); | 90 bool BeforePostTask(TaskShutdownBehavior shutdown_behavior); |
| 85 | 91 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 131 // Number of BLOCK_SHUTDOWN tasks posted during shutdown. | 137 // Number of BLOCK_SHUTDOWN tasks posted during shutdown. |
| 132 HistogramBase::Sample num_block_shutdown_tasks_posted_during_shutdown_ = 0; | 138 HistogramBase::Sample num_block_shutdown_tasks_posted_during_shutdown_ = 0; |
| 133 | 139 |
| 134 DISALLOW_COPY_AND_ASSIGN(TaskTracker); | 140 DISALLOW_COPY_AND_ASSIGN(TaskTracker); |
| 135 }; | 141 }; |
| 136 | 142 |
| 137 } // namespace internal | 143 } // namespace internal |
| 138 } // namespace base | 144 } // namespace base |
| 139 | 145 |
| 140 #endif // BASE_TASK_SCHEDULER_TASK_TRACKER_H_ | 146 #endif // BASE_TASK_SCHEDULER_TASK_TRACKER_H_ |
| OLD | NEW |