| 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 is expected to call its parent's implementation |
| 78 // but is free to perform extra work before and after doing so. |
| 79 virtual void PerformRunTask(std::unique_ptr<Task> task); |
| 80 |
| 76 private: | 81 private: |
| 77 class State; | 82 class State; |
| 78 | 83 |
| 79 void PerformShutdown(); | 84 void PerformShutdown(); |
| 80 | 85 |
| 81 // Called before WillPostTask() informs the tracing system that a task has | 86 // Called before WillPostTask() informs the tracing system that a task has |
| 82 // been posted. Updates |num_tasks_blocking_shutdown_| if necessary and | 87 // been posted. Updates |num_tasks_blocking_shutdown_| if necessary and |
| 83 // returns true if the current shutdown state allows the task to be posted. | 88 // returns true if the current shutdown state allows the task to be posted. |
| 84 bool BeforePostTask(TaskShutdownBehavior shutdown_behavior); | 89 bool BeforePostTask(TaskShutdownBehavior shutdown_behavior); |
| 85 | 90 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 // Number of BLOCK_SHUTDOWN tasks posted during shutdown. | 136 // Number of BLOCK_SHUTDOWN tasks posted during shutdown. |
| 132 HistogramBase::Sample num_block_shutdown_tasks_posted_during_shutdown_ = 0; | 137 HistogramBase::Sample num_block_shutdown_tasks_posted_during_shutdown_ = 0; |
| 133 | 138 |
| 134 DISALLOW_COPY_AND_ASSIGN(TaskTracker); | 139 DISALLOW_COPY_AND_ASSIGN(TaskTracker); |
| 135 }; | 140 }; |
| 136 | 141 |
| 137 } // namespace internal | 142 } // namespace internal |
| 138 } // namespace base | 143 } // namespace base |
| 139 | 144 |
| 140 #endif // BASE_TASK_SCHEDULER_TASK_TRACKER_H_ | 145 #endif // BASE_TASK_SCHEDULER_TASK_TRACKER_H_ |
| OLD | NEW |