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

Side by Side Diff: base/threading/worker_pool.h

Issue 7879006: Delete Tracked, and move Location to its own file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 9 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « base/test/thread_test_helper.cc ('k') | base/threading/worker_pool_posix.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_WORKER_POOL_H_ 5 #ifndef BASE_THREADING_WORKER_POOL_H_
6 #define BASE_THREADING_WORKER_POOL_H_ 6 #define BASE_THREADING_WORKER_POOL_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/base_export.h" 9 #include "base/base_export.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/tracked.h"
12 11
13 class Task; 12 class Task;
14 13
14 namespace tracked_objects {
15 class Location;
16 } // namespace tracked_objects
17
15 namespace base { 18 namespace base {
16 19
17 // This is a facility that runs tasks that don't require a specific thread or 20 // This is a facility that runs tasks that don't require a specific thread or
18 // a message loop. 21 // a message loop.
19 // 22 //
20 // WARNING: This shouldn't be used unless absolutely necessary. We don't wait 23 // WARNING: This shouldn't be used unless absolutely necessary. We don't wait
21 // for the worker pool threads to finish on shutdown, so the tasks running 24 // for the worker pool threads to finish on shutdown, so the tasks running
22 // inside the pool must be extremely careful about other objects they access 25 // inside the pool must be extremely careful about other objects they access
23 // (MessageLoops, Singletons, etc). During shutdown these object may no longer 26 // (MessageLoops, Singletons, etc). During shutdown these object may no longer
24 // exist. 27 // exist.
25 class BASE_EXPORT WorkerPool { 28 class BASE_EXPORT WorkerPool {
26 public: 29 public:
27 // This function posts |task| to run on a worker thread. |task_is_slow| 30 // This function posts |task| to run on a worker thread. |task_is_slow|
28 // should be used for tasks that will take a long time to execute. Returns 31 // should be used for tasks that will take a long time to execute. Returns
29 // false if |task| could not be posted to a worker thread. Regardless of 32 // false if |task| could not be posted to a worker thread. Regardless of
30 // return value, ownership of |task| is transferred to the worker pool. 33 // return value, ownership of |task| is transferred to the worker pool.
31 // 34 //
32 // TODO(ajwong): Remove the Task* based overload once we've finishsed the 35 // TODO(ajwong): Remove the Task* based overload once we've finishsed the
33 // Task -> Closure migration. 36 // Task -> Closure migration.
34 static bool PostTask(const tracked_objects::Location& from_here, 37 static bool PostTask(const tracked_objects::Location& from_here,
35 Task* task, bool task_is_slow); 38 Task* task, bool task_is_slow);
36 static bool PostTask(const tracked_objects::Location& from_here, 39 static bool PostTask(const tracked_objects::Location& from_here,
37 const base::Closure& task, bool task_is_slow); 40 const base::Closure& task, bool task_is_slow);
38 }; 41 };
39 42
40 } // namespace base 43 } // namespace base
41 44
42 #endif // BASE_THREADING_WORKER_POOL_H_ 45 #endif // BASE_THREADING_WORKER_POOL_H_
OLDNEW
« no previous file with comments | « base/test/thread_test_helper.cc ('k') | base/threading/worker_pool_posix.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698