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

Unified Diff: ios/web/public/web_thread.h

Issue 2915583002: Revert of Remove unused blocking pool methods from web::WebThread. (Closed)
Patch Set: Rebase on http://crrev.com/2912073002. Created 3 years, 7 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 | ios/web/web_thread_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/public/web_thread.h
diff --git a/ios/web/public/web_thread.h b/ios/web/public/web_thread.h
index 0ab786caa664456a5f132e6249cadadd10488b5a..be41b3080b58b14866953e8ab4464abf0c93c1da 100644
--- a/ios/web/public/web_thread.h
+++ b/ios/web/public/web_thread.h
@@ -139,6 +139,38 @@ class WebThread {
return GetTaskRunnerForThread(identifier)->DeleteSoon(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 will all post a task with no sequencing semantics, and will post a
+ // reply task to the origin TaskRunner upon completion. The third 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().
+ //
+ // If you need to PostTaskAndReplyWithResult, use
+ // base::PostTaskAndReplyWithResult() with GetBlockingPool() as the task
+ // runner.
+ static bool PostBlockingPoolTask(const tracked_objects::Location& from_here,
+ base::OnceClosure task);
+ static bool PostBlockingPoolTaskAndReply(
+ const tracked_objects::Location& from_here,
+ base::OnceClosure task,
+ base::OnceClosure reply);
+ static bool PostBlockingPoolSequencedTask(
+ const std::string& sequence_token_name,
+ const tracked_objects::Location& from_here,
+ base::OnceClosure task);
+
// Returns the thread pool used for blocking file I/O. Use this object to
// perform random blocking operations such as file writes.
static base::SequencedWorkerPool* GetBlockingPool() WARN_UNUSED_RESULT;
« no previous file with comments | « no previous file | ios/web/web_thread_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698