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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 | 70 |
71 // Returns true if shutdown has completed (Shutdown() has returned). | 71 // Returns true if shutdown has completed (Shutdown() has returned). |
72 bool IsShutdownComplete() const; | 72 bool IsShutdownComplete() const; |
73 | 73 |
74 // Causes HasShutdownStarted() to return true. Unlike when Shutdown() returns, | 74 // Causes HasShutdownStarted() to return true. Unlike when Shutdown() returns, |
75 // IsShutdownComplete() won't return true after this returns. Shutdown() | 75 // IsShutdownComplete() won't return true after this returns. Shutdown() |
76 // cannot be called after this. | 76 // cannot be called after this. |
77 void SetHasShutdownStartedForTesting(); | 77 void SetHasShutdownStartedForTesting(); |
78 | 78 |
79 protected: | 79 protected: |
80 // Runs |task|. An override is expected to call its parent's implementation | 80 // Runs |task|. |sequence_token| is the token identifying the sequence from |
81 // but is free to perform extra work before and after doing so. | 81 // which |task| was extracted. An override is expected to call its parent's |
82 virtual void PerformRunTask(std::unique_ptr<Task> task); | 82 // implementation but is free to perform extra work before and after doing so. |
| 83 virtual void PerformRunTask(std::unique_ptr<Task> task, |
| 84 const SequenceToken& sequence_token); |
83 | 85 |
84 #if DCHECK_IS_ON() | 86 #if DCHECK_IS_ON() |
85 // Returns true if this context should be exempt from blocking shutdown | 87 // Returns true if this context should be exempt from blocking shutdown |
86 // DCHECKs. | 88 // DCHECKs. |
87 // TODO(robliao): Remove when http://crbug.com/698140 is fixed. | 89 // TODO(robliao): Remove when http://crbug.com/698140 is fixed. |
88 virtual bool IsPostingBlockShutdownTaskAfterShutdownAllowed(); | 90 virtual bool IsPostingBlockShutdownTaskAfterShutdownAllowed(); |
89 #endif | 91 #endif |
90 | 92 |
91 private: | 93 private: |
92 class State; | 94 class State; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 // Number of BLOCK_SHUTDOWN tasks posted during shutdown. | 158 // Number of BLOCK_SHUTDOWN tasks posted during shutdown. |
157 HistogramBase::Sample num_block_shutdown_tasks_posted_during_shutdown_ = 0; | 159 HistogramBase::Sample num_block_shutdown_tasks_posted_during_shutdown_ = 0; |
158 | 160 |
159 DISALLOW_COPY_AND_ASSIGN(TaskTracker); | 161 DISALLOW_COPY_AND_ASSIGN(TaskTracker); |
160 }; | 162 }; |
161 | 163 |
162 } // namespace internal | 164 } // namespace internal |
163 } // namespace base | 165 } // namespace base |
164 | 166 |
165 #endif // BASE_TASK_SCHEDULER_TASK_TRACKER_H_ | 167 #endif // BASE_TASK_SCHEDULER_TASK_TRACKER_H_ |
OLD | NEW |