| OLD | NEW |
| 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 #ifndef BASE_THREADING_SEQUENCED_WORKER_POOL_H_ | 5 #ifndef BASE_THREADING_SEQUENCED_WORKER_POOL_H_ |
| 6 #define BASE_THREADING_SEQUENCED_WORKER_POOL_H_ | 6 #define BASE_THREADING_SEQUENCED_WORKER_POOL_H_ |
| 7 | 7 |
| 8 #include <cstddef> | 8 #include <cstddef> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/base_export.h" | 11 #include "base/base_export.h" |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/callback_forward.h" | 13 #include "base/callback_forward.h" |
| 14 #include "base/location.h" |
| 14 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/single_thread_task_runner.h" |
| 16 #include "base/task_runner.h" | 18 #include "base/task_runner.h" |
| 17 | 19 |
| 18 namespace tracked_objects { | 20 namespace tracked_objects { |
| 19 class Location; | 21 class Location; |
| 20 } // namespace tracked_objects | 22 } // namespace tracked_objects |
| 21 | 23 |
| 22 namespace base { | 24 namespace base { |
| 23 | 25 |
| 24 class MessageLoopProxy; | 26 class SingleThreadTaskRunner; |
| 25 | 27 |
| 26 template <class T> class DeleteHelper; | 28 template <class T> class DeleteHelper; |
| 27 | 29 |
| 28 class SequencedTaskRunner; | 30 class SequencedTaskRunner; |
| 29 | 31 |
| 30 // A worker thread pool that enforces ordering between sets of tasks. It also | 32 // A worker thread pool that enforces ordering between sets of tasks. It also |
| 31 // allows you to specify what should happen to your tasks on shutdown. | 33 // allows you to specify what should happen to your tasks on shutdown. |
| 32 // | 34 // |
| 33 // To enforce ordering, get a unique sequence token from the pool and post all | 35 // To enforce ordering, get a unique sequence token from the pool and post all |
| 34 // tasks you want to order with the token. All tasks with the same token are | 36 // tasks you want to order with the token. All tasks with the same token are |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 | 340 |
| 339 void OnDestruct() const override; | 341 void OnDestruct() const override; |
| 340 | 342 |
| 341 private: | 343 private: |
| 342 friend class RefCountedThreadSafe<SequencedWorkerPool>; | 344 friend class RefCountedThreadSafe<SequencedWorkerPool>; |
| 343 friend class DeleteHelper<SequencedWorkerPool>; | 345 friend class DeleteHelper<SequencedWorkerPool>; |
| 344 | 346 |
| 345 class Inner; | 347 class Inner; |
| 346 class Worker; | 348 class Worker; |
| 347 | 349 |
| 348 const scoped_refptr<MessageLoopProxy> constructor_message_loop_; | 350 const scoped_refptr<SingleThreadTaskRunner> constructor_task_runner_; |
| 349 | 351 |
| 350 // Avoid pulling in too many headers by putting (almost) everything | 352 // Avoid pulling in too many headers by putting (almost) everything |
| 351 // into |inner_|. | 353 // into |inner_|. |
| 352 const scoped_ptr<Inner> inner_; | 354 const scoped_ptr<Inner> inner_; |
| 353 | 355 |
| 354 DISALLOW_COPY_AND_ASSIGN(SequencedWorkerPool); | 356 DISALLOW_COPY_AND_ASSIGN(SequencedWorkerPool); |
| 355 }; | 357 }; |
| 356 | 358 |
| 357 } // namespace base | 359 } // namespace base |
| 358 | 360 |
| 359 #endif // BASE_THREADING_SEQUENCED_WORKER_POOL_H_ | 361 #endif // BASE_THREADING_SEQUENCED_WORKER_POOL_H_ |
| OLD | NEW |