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

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

Issue 9086002: base::Bind: Remove Task. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Style fix. Created 8 years, 11 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/threading/thread_unittest.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_forward.h" 10 #include "base/callback_forward.h"
(...skipping 13 matching lines...) Expand all
24 // 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
25 // 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
26 // (MessageLoops, Singletons, etc). During shutdown these object may no longer 26 // (MessageLoops, Singletons, etc). During shutdown these object may no longer
27 // exist. 27 // exist.
28 class BASE_EXPORT WorkerPool { 28 class BASE_EXPORT WorkerPool {
29 public: 29 public:
30 // 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|
31 // 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
32 // 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
33 // return value, ownership of |task| is transferred to the worker pool. 33 // return value, ownership of |task| is transferred to the worker pool.
34 //
35 // TODO(ajwong): Remove the Task* based overload once we've finished the
36 // Task -> Closure migration.
37 static bool PostTask(const tracked_objects::Location& from_here,
38 Task* task, bool task_is_slow);
39 static bool PostTask(const tracked_objects::Location& from_here, 34 static bool PostTask(const tracked_objects::Location& from_here,
40 const base::Closure& task, bool task_is_slow); 35 const base::Closure& task, bool task_is_slow);
41 36
42 // Just like MessageLoopProxy::PostTaskAndReply, except the destination 37 // Just like MessageLoopProxy::PostTaskAndReply, except the destination
43 // for |task| is a worker thread and you can specify |task_is_slow| just 38 // for |task| is a worker thread and you can specify |task_is_slow| just
44 // like you can for PostTask above. 39 // like you can for PostTask above.
45 static bool PostTaskAndReply(const tracked_objects::Location& from_here, 40 static bool PostTaskAndReply(const tracked_objects::Location& from_here,
46 const Closure& task, 41 const Closure& task,
47 const Closure& reply, 42 const Closure& reply,
48 bool task_is_slow); 43 bool task_is_slow);
49 }; 44 };
50 45
51 } // namespace base 46 } // namespace base
52 47
53 #endif // BASE_THREADING_WORKER_POOL_H_ 48 #endif // BASE_THREADING_WORKER_POOL_H_
OLDNEW
« no previous file with comments | « base/threading/thread_unittest.cc ('k') | base/threading/worker_pool_posix.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698