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

Unified Diff: content/public/browser/browser_thread.h

Issue 9065009: Hook up the SequencedWorkerPool to the browser thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 8 years, 12 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 | « content/browser/browser_thread_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/browser/browser_thread.h
===================================================================
--- content/public/browser/browser_thread.h (revision 116282)
+++ content/public/browser/browser_thread.h (working copy)
@@ -21,6 +21,7 @@
class MessageLoop;
namespace base {
+class SequencedWorkerPool;
class Thread;
}
@@ -157,6 +158,34 @@
from_here, object);
}
+ // Simplified wrappers for posting to the blocking thread pool. Use this
+ // for doing things like blocking I/O.
+ //
+ // The first variant will run the task in the pool with no sequencing
+ // semantics, so may get run in parallel with other posted tasks. The
+ // second variant provides sequencing between tasks with the same
+ // sequence token name.
+ //
+ // These tasks are guaranteed to run before shutdown.
+ //
+ // If you need to provide different shutdown semantics (like you have
+ // something slow and noncritical that doesn't need to block shutdown),
+ // or you want to manually provide a sequence token (which saves a map
+ // lookup and is guaranteed unique without you having to come up with a
+ // unique string), you can access the sequenced worker pool directly via
+ // GetBlockingPool().
+ static bool PostBlockingPoolTask(const tracked_objects::Location& from_here,
+ const base::Closure& task);
+ static bool PostBlockingPoolSequencedTask(
+ const std::string& sequence_token_name,
+ const tracked_objects::Location& from_here,
+ const base::Closure& task);
+
+ // Returns the thread pool used for blocking file I/O. Use this object to
+ // perform random blocking operations such as file writes or querying the
+ // Windows registry.
+ static base::SequencedWorkerPool* GetBlockingPool();
+
// Callable on any thread. Returns whether the given ID corresponds to a well
// known thread.
static bool IsWellKnownThread(ID identifier);
« no previous file with comments | « content/browser/browser_thread_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698