Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(408)

Side by Side Diff: base/threading/sequenced_worker_pool.cc

Issue 668783004: Standardize usage of virtual/override/final in base/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Formatted Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/threading/sequenced_worker_pool.h ('k') | base/threading/simple_thread.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "base/threading/sequenced_worker_pool.h" 5 #include "base/threading/sequenced_worker_pool.h"
6 6
7 #include <list> 7 #include <list>
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // fixed ShutdownBehavior. 91 // fixed ShutdownBehavior.
92 // 92 //
93 // Note that this class is RefCountedThreadSafe (inherited from TaskRunner). 93 // Note that this class is RefCountedThreadSafe (inherited from TaskRunner).
94 class SequencedWorkerPoolTaskRunner : public TaskRunner { 94 class SequencedWorkerPoolTaskRunner : public TaskRunner {
95 public: 95 public:
96 SequencedWorkerPoolTaskRunner( 96 SequencedWorkerPoolTaskRunner(
97 const scoped_refptr<SequencedWorkerPool>& pool, 97 const scoped_refptr<SequencedWorkerPool>& pool,
98 SequencedWorkerPool::WorkerShutdown shutdown_behavior); 98 SequencedWorkerPool::WorkerShutdown shutdown_behavior);
99 99
100 // TaskRunner implementation 100 // TaskRunner implementation
101 virtual bool PostDelayedTask(const tracked_objects::Location& from_here, 101 bool PostDelayedTask(const tracked_objects::Location& from_here,
102 const Closure& task, 102 const Closure& task,
103 TimeDelta delay) override; 103 TimeDelta delay) override;
104 virtual bool RunsTasksOnCurrentThread() const override; 104 bool RunsTasksOnCurrentThread() const override;
105 105
106 private: 106 private:
107 virtual ~SequencedWorkerPoolTaskRunner(); 107 ~SequencedWorkerPoolTaskRunner() override;
108 108
109 const scoped_refptr<SequencedWorkerPool> pool_; 109 const scoped_refptr<SequencedWorkerPool> pool_;
110 110
111 const SequencedWorkerPool::WorkerShutdown shutdown_behavior_; 111 const SequencedWorkerPool::WorkerShutdown shutdown_behavior_;
112 112
113 DISALLOW_COPY_AND_ASSIGN(SequencedWorkerPoolTaskRunner); 113 DISALLOW_COPY_AND_ASSIGN(SequencedWorkerPoolTaskRunner);
114 }; 114 };
115 115
116 SequencedWorkerPoolTaskRunner::SequencedWorkerPoolTaskRunner( 116 SequencedWorkerPoolTaskRunner::SequencedWorkerPoolTaskRunner(
117 const scoped_refptr<SequencedWorkerPool>& pool, 117 const scoped_refptr<SequencedWorkerPool>& pool,
(...skipping 26 matching lines...) Expand all
144 // 144 //
145 // Note that this class is RefCountedThreadSafe (inherited from TaskRunner). 145 // Note that this class is RefCountedThreadSafe (inherited from TaskRunner).
146 class SequencedWorkerPoolSequencedTaskRunner : public SequencedTaskRunner { 146 class SequencedWorkerPoolSequencedTaskRunner : public SequencedTaskRunner {
147 public: 147 public:
148 SequencedWorkerPoolSequencedTaskRunner( 148 SequencedWorkerPoolSequencedTaskRunner(
149 const scoped_refptr<SequencedWorkerPool>& pool, 149 const scoped_refptr<SequencedWorkerPool>& pool,
150 SequencedWorkerPool::SequenceToken token, 150 SequencedWorkerPool::SequenceToken token,
151 SequencedWorkerPool::WorkerShutdown shutdown_behavior); 151 SequencedWorkerPool::WorkerShutdown shutdown_behavior);
152 152
153 // TaskRunner implementation 153 // TaskRunner implementation
154 virtual bool PostDelayedTask(const tracked_objects::Location& from_here, 154 bool PostDelayedTask(const tracked_objects::Location& from_here,
155 const Closure& task, 155 const Closure& task,
156 TimeDelta delay) override; 156 TimeDelta delay) override;
157 virtual bool RunsTasksOnCurrentThread() const override; 157 bool RunsTasksOnCurrentThread() const override;
158 158
159 // SequencedTaskRunner implementation 159 // SequencedTaskRunner implementation
160 virtual bool PostNonNestableDelayedTask( 160 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here,
161 const tracked_objects::Location& from_here, 161 const Closure& task,
162 const Closure& task, 162 TimeDelta delay) override;
163 TimeDelta delay) override;
164 163
165 private: 164 private:
166 virtual ~SequencedWorkerPoolSequencedTaskRunner(); 165 ~SequencedWorkerPoolSequencedTaskRunner() override;
167 166
168 const scoped_refptr<SequencedWorkerPool> pool_; 167 const scoped_refptr<SequencedWorkerPool> pool_;
169 168
170 const SequencedWorkerPool::SequenceToken token_; 169 const SequencedWorkerPool::SequenceToken token_;
171 170
172 const SequencedWorkerPool::WorkerShutdown shutdown_behavior_; 171 const SequencedWorkerPool::WorkerShutdown shutdown_behavior_;
173 172
174 DISALLOW_COPY_AND_ASSIGN(SequencedWorkerPoolSequencedTaskRunner); 173 DISALLOW_COPY_AND_ASSIGN(SequencedWorkerPoolSequencedTaskRunner);
175 }; 174 };
176 175
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 227
229 // Worker --------------------------------------------------------------------- 228 // Worker ---------------------------------------------------------------------
230 229
231 class SequencedWorkerPool::Worker : public SimpleThread { 230 class SequencedWorkerPool::Worker : public SimpleThread {
232 public: 231 public:
233 // Hold a (cyclic) ref to |worker_pool|, since we want to keep it 232 // Hold a (cyclic) ref to |worker_pool|, since we want to keep it
234 // around as long as we are running. 233 // around as long as we are running.
235 Worker(const scoped_refptr<SequencedWorkerPool>& worker_pool, 234 Worker(const scoped_refptr<SequencedWorkerPool>& worker_pool,
236 int thread_number, 235 int thread_number,
237 const std::string& thread_name_prefix); 236 const std::string& thread_name_prefix);
238 virtual ~Worker(); 237 ~Worker() override;
239 238
240 // SimpleThread implementation. This actually runs the background thread. 239 // SimpleThread implementation. This actually runs the background thread.
241 virtual void Run() override; 240 void Run() override;
242 241
243 void set_running_task_info(SequenceToken token, 242 void set_running_task_info(SequenceToken token,
244 WorkerShutdown shutdown_behavior) { 243 WorkerShutdown shutdown_behavior) {
245 running_sequence_ = token; 244 running_sequence_ = token;
246 running_shutdown_behavior_ = shutdown_behavior; 245 running_shutdown_behavior_ = shutdown_behavior;
247 } 246 }
248 247
249 SequenceToken running_sequence() const { 248 SequenceToken running_sequence() const {
250 return running_sequence_; 249 return running_sequence_;
251 } 250 }
(...skipping 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after
1273 void SequencedWorkerPool::Shutdown(int max_new_blocking_tasks_after_shutdown) { 1272 void SequencedWorkerPool::Shutdown(int max_new_blocking_tasks_after_shutdown) {
1274 DCHECK(constructor_message_loop_->BelongsToCurrentThread()); 1273 DCHECK(constructor_message_loop_->BelongsToCurrentThread());
1275 inner_->Shutdown(max_new_blocking_tasks_after_shutdown); 1274 inner_->Shutdown(max_new_blocking_tasks_after_shutdown);
1276 } 1275 }
1277 1276
1278 bool SequencedWorkerPool::IsShutdownInProgress() { 1277 bool SequencedWorkerPool::IsShutdownInProgress() {
1279 return inner_->IsShutdownInProgress(); 1278 return inner_->IsShutdownInProgress();
1280 } 1279 }
1281 1280
1282 } // namespace base 1281 } // namespace base
OLDNEW
« no previous file with comments | « base/threading/sequenced_worker_pool.h ('k') | base/threading/simple_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698