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