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