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

Unified Diff: base/threading/worker_pool.h

Issue 10220001: Add TaskRunner wrapper for WorkerPool. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comment fix Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/threading/worker_pool.cc » ('j') | base/threading/worker_pool.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/threading/worker_pool.h
diff --git a/base/threading/worker_pool.h b/base/threading/worker_pool.h
index 6694830e7d7a560612bf48b5b6ed279737fa3964..02c5c99944f117eb62e0bd92b6c3b9ed617a762d 100644
--- a/base/threading/worker_pool.h
+++ b/base/threading/worker_pool.h
@@ -8,6 +8,7 @@
#include "base/base_export.h"
#include "base/callback_forward.h"
+#include "base/memory/ref_counted.h"
class Task;
@@ -17,6 +18,8 @@ class Location;
namespace base {
+class TaskRunner;
+
// This is a facility that runs tasks that don't require a specific thread or
// a message loop.
//
@@ -41,6 +44,16 @@ class BASE_EXPORT WorkerPool {
const Closure& task,
const Closure& reply,
bool task_is_slow);
+
+ // Return true if the current thread is one that this WorkerPool runs tasks
+ // on. (Note that if the Windows worker pool is used without going through
+ // this WorkerPool interface, RunsTasksOnCurrentThread would return false on
+ // those threads.)
+ static bool RunsTasksOnCurrentThread();
+
+ // Get a TaskRunner wrapper which posts to the WorkerPool using the given
+ // |task_is_slow| behavior.
+ static scoped_refptr<TaskRunner> GetTaskRunner(bool task_is_slow);
willchan no longer on Chromium 2012/04/24 23:41:50 How about you also store a leaky LazyInstance for
mattm 2012/04/25 00:57:35 Done. Had to make a holder class to initialize th
};
} // namespace base
« no previous file with comments | « no previous file | base/threading/worker_pool.cc » ('j') | base/threading/worker_pool.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698