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 30 matching lines...) Expand all Loading... |
41 void Shutdown(); | 41 void Shutdown(); |
42 | 42 |
43 // Informs this TaskTracker that |task| is about to be posted. Returns true if | 43 // Informs this TaskTracker that |task| is about to be posted. Returns true if |
44 // this operation is allowed (|task| should be posted if-and-only-if it is). | 44 // this operation is allowed (|task| should be posted if-and-only-if it is). |
45 bool WillPostTask(const Task* task); | 45 bool WillPostTask(const Task* task); |
46 | 46 |
47 // Runs |task| unless the current shutdown state prevents that. | 47 // Runs |task| unless the current shutdown state prevents that. |
48 // |sequence_token| is the token identifying the sequence from which |task| | 48 // |sequence_token| is the token identifying the sequence from which |task| |
49 // was extracted. Returns true if |task| ran. WillPostTask() must have allowed | 49 // was extracted. Returns true if |task| ran. WillPostTask() must have allowed |
50 // |task| to be posted before this is called. | 50 // |task| to be posted before this is called. |
51 bool RunTask(const Task* task, const SequenceToken& sequence_token); | 51 bool RunTask(Task* task, const SequenceToken& sequence_token); |
52 | 52 |
53 // Returns true once shutdown has started (Shutdown() has been called but | 53 // Returns true once shutdown has started (Shutdown() has been called but |
54 // might not have returned). Note: sequential consistency with the thread | 54 // might not have returned). Note: sequential consistency with the thread |
55 // calling Shutdown() (or SetHasShutdownStartedForTesting()) isn't guaranteed | 55 // calling Shutdown() (or SetHasShutdownStartedForTesting()) isn't guaranteed |
56 // by this call. | 56 // by this call. |
57 bool HasShutdownStarted() const; | 57 bool HasShutdownStarted() const; |
58 | 58 |
59 // Returns true if shutdown has completed (Shutdown() has returned). | 59 // Returns true if shutdown has completed (Shutdown() has returned). |
60 bool IsShutdownComplete() const; | 60 bool IsShutdownComplete() const; |
61 | 61 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 // Number of BLOCK_SHUTDOWN tasks posted during shutdown. | 100 // Number of BLOCK_SHUTDOWN tasks posted during shutdown. |
101 HistogramBase::Sample num_block_shutdown_tasks_posted_during_shutdown_ = 0; | 101 HistogramBase::Sample num_block_shutdown_tasks_posted_during_shutdown_ = 0; |
102 | 102 |
103 DISALLOW_COPY_AND_ASSIGN(TaskTracker); | 103 DISALLOW_COPY_AND_ASSIGN(TaskTracker); |
104 }; | 104 }; |
105 | 105 |
106 } // namespace internal | 106 } // namespace internal |
107 } // namespace base | 107 } // namespace base |
108 | 108 |
109 #endif // BASE_TASK_SCHEDULER_TASK_TRACKER_H_ | 109 #endif // BASE_TASK_SCHEDULER_TASK_TRACKER_H_ |
OLD | NEW |