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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 void Flush(); | 50 void Flush(); |
51 | 51 |
52 // Informs this TaskTracker that |task| is about to be posted. Returns true if | 52 // Informs this TaskTracker that |task| is about to be posted. Returns true if |
53 // this operation is allowed (|task| should be posted if-and-only-if it is). | 53 // this operation is allowed (|task| should be posted if-and-only-if it is). |
54 bool WillPostTask(const Task* task); | 54 bool WillPostTask(const Task* task); |
55 | 55 |
56 // Runs |task| unless the current shutdown state prevents that. | 56 // Runs |task| unless the current shutdown state prevents that. |
57 // |sequence_token| is the token identifying the sequence from which |task| | 57 // |sequence_token| is the token identifying the sequence from which |task| |
58 // was extracted. Returns true if |task| ran. WillPostTask() must have allowed | 58 // was extracted. Returns true if |task| ran. WillPostTask() must have allowed |
59 // |task| to be posted before this is called. | 59 // |task| to be posted before this is called. |
60 bool RunTask(const Task* task, const SequenceToken& sequence_token); | 60 bool RunTask(std::unique_ptr<Task> task, const SequenceToken& sequence_token); |
61 | 61 |
62 // Returns true once shutdown has started (Shutdown() has been called but | 62 // Returns true once shutdown has started (Shutdown() has been called but |
63 // might not have returned). Note: sequential consistency with the thread | 63 // might not have returned). Note: sequential consistency with the thread |
64 // calling Shutdown() (or SetHasShutdownStartedForTesting()) isn't guaranteed | 64 // calling Shutdown() (or SetHasShutdownStartedForTesting()) isn't guaranteed |
65 // by this call. | 65 // by this call. |
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 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 // Number of BLOCK_SHUTDOWN tasks posted during shutdown. | 131 // Number of BLOCK_SHUTDOWN tasks posted during shutdown. |
132 HistogramBase::Sample num_block_shutdown_tasks_posted_during_shutdown_ = 0; | 132 HistogramBase::Sample num_block_shutdown_tasks_posted_during_shutdown_ = 0; |
133 | 133 |
134 DISALLOW_COPY_AND_ASSIGN(TaskTracker); | 134 DISALLOW_COPY_AND_ASSIGN(TaskTracker); |
135 }; | 135 }; |
136 | 136 |
137 } // namespace internal | 137 } // namespace internal |
138 } // namespace base | 138 } // namespace base |
139 | 139 |
140 #endif // BASE_TASK_SCHEDULER_TASK_TRACKER_H_ | 140 #endif // BASE_TASK_SCHEDULER_TASK_TRACKER_H_ |
OLD | NEW |