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 28 matching lines...) Expand all Loading... |
39 | 39 |
40 // Informs this TaskTracker that |task| is about to be posted. Returns true if | 40 // Informs this TaskTracker that |task| is about to be posted. Returns true if |
41 // this operation is allowed (|task| should be posted if-and-only-if it is). | 41 // this operation is allowed (|task| should be posted if-and-only-if it is). |
42 bool WillPostTask(const Task* task); | 42 bool WillPostTask(const Task* task); |
43 | 43 |
44 // Runs the next Task in |sequence| unless the current shutdown state prevents | 44 // Runs the next Task in |sequence| unless the current shutdown state prevents |
45 // that. WillPostTask() must have allowed the Task to be posted. | 45 // that. WillPostTask() must have allowed the Task to be posted. |
46 void RunNextTaskInSequence(const Sequence* sequence); | 46 void RunNextTaskInSequence(const Sequence* sequence); |
47 | 47 |
48 // Returns true once shutdown has started (Shutdown() has been called but | 48 // Returns true once shutdown has started (Shutdown() has been called but |
49 // might not have returned). | 49 // might not have returned). Note: sequential consistency with the thread |
| 50 // calling Shutdown() (or SetHasShutdownStartedForTesting()) isn't guaranteed |
| 51 // by this call. |
50 bool HasShutdownStarted() const; | 52 bool HasShutdownStarted() const; |
51 | 53 |
52 // Returns true if shutdown has completed (Shutdown() has returned). | 54 // Returns true if shutdown has completed (Shutdown() has returned). |
53 bool IsShutdownComplete() const; | 55 bool IsShutdownComplete() const; |
54 | 56 |
55 // Causes HasShutdownStarted() to return true. Unlike when Shutdown() returns, | 57 // Causes HasShutdownStarted() to return true. Unlike when Shutdown() returns, |
56 // IsShutdownComplete() won't return true after this returns. Shutdown() | 58 // IsShutdownComplete() won't return true after this returns. Shutdown() |
57 // cannot be called after this. | 59 // cannot be called after this. |
58 void SetHasShutdownStartedForTesting(); | 60 void SetHasShutdownStartedForTesting(); |
59 | 61 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 // Number of BLOCK_SHUTDOWN tasks posted during shutdown. | 95 // Number of BLOCK_SHUTDOWN tasks posted during shutdown. |
94 HistogramBase::Sample num_block_shutdown_tasks_posted_during_shutdown_ = 0; | 96 HistogramBase::Sample num_block_shutdown_tasks_posted_during_shutdown_ = 0; |
95 | 97 |
96 DISALLOW_COPY_AND_ASSIGN(TaskTracker); | 98 DISALLOW_COPY_AND_ASSIGN(TaskTracker); |
97 }; | 99 }; |
98 | 100 |
99 } // namespace internal | 101 } // namespace internal |
100 } // namespace base | 102 } // namespace base |
101 | 103 |
102 #endif // BASE_TASK_SCHEDULER_TASK_TRACKER_H_ | 104 #endif // BASE_TASK_SCHEDULER_TASK_TRACKER_H_ |
OLD | NEW |