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

Side by Side Diff: content/public/browser/browser_thread.h

Issue 10007010: Add BrowserThread::PostBlockingTaskAndReply. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Oops 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/browser_thread_impl.cc ('k') | no next file » | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_H_
6 #define CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_H_ 6 #define CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 const tracked_objects::Location& from_here, 147 const tracked_objects::Location& from_here,
148 const T* object) { 148 const T* object) {
149 return GetMessageLoopProxyForThread(identifier)->ReleaseSoon( 149 return GetMessageLoopProxyForThread(identifier)->ReleaseSoon(
150 from_here, object); 150 from_here, object);
151 } 151 }
152 152
153 // Simplified wrappers for posting to the blocking thread pool. Use this 153 // Simplified wrappers for posting to the blocking thread pool. Use this
154 // for doing things like blocking I/O. 154 // for doing things like blocking I/O.
155 // 155 //
156 // The first variant will run the task in the pool with no sequencing 156 // The first variant will run the task in the pool with no sequencing
157 // semantics, so may get run in parallel with other posted tasks. The 157 // semantics, so may get run in parallel with other posted tasks. The second
158 // second variant provides sequencing between tasks with the same 158 // variant will all post a task with no sequencing semantics, and will post a
159 // sequence token name. 159 // reply task to the origin TaskRunner upon completion. The third variant
160 // provides sequencing between tasks with the same sequence token name.
160 // 161 //
161 // These tasks are guaranteed to run before shutdown. 162 // These tasks are guaranteed to run before shutdown.
162 // 163 //
163 // If you need to provide different shutdown semantics (like you have 164 // If you need to provide different shutdown semantics (like you have
164 // something slow and noncritical that doesn't need to block shutdown), 165 // something slow and noncritical that doesn't need to block shutdown),
165 // or you want to manually provide a sequence token (which saves a map 166 // or you want to manually provide a sequence token (which saves a map
166 // lookup and is guaranteed unique without you having to come up with a 167 // lookup and is guaranteed unique without you having to come up with a
167 // unique string), you can access the sequenced worker pool directly via 168 // unique string), you can access the sequenced worker pool directly via
168 // GetBlockingPool(). 169 // GetBlockingPool().
169 static bool PostBlockingPoolTask(const tracked_objects::Location& from_here, 170 static bool PostBlockingPoolTask(const tracked_objects::Location& from_here,
170 const base::Closure& task); 171 const base::Closure& task);
172 static bool PostBlockingPoolTaskAndReply(
173 const tracked_objects::Location& from_here,
174 const base::Closure& task,
175 const base::Closure& reply);
171 static bool PostBlockingPoolSequencedTask( 176 static bool PostBlockingPoolSequencedTask(
172 const std::string& sequence_token_name, 177 const std::string& sequence_token_name,
173 const tracked_objects::Location& from_here, 178 const tracked_objects::Location& from_here,
174 const base::Closure& task); 179 const base::Closure& task);
175 180
176 // Returns the thread pool used for blocking file I/O. Use this object to 181 // Returns the thread pool used for blocking file I/O. Use this object to
177 // perform random blocking operations such as file writes or querying the 182 // perform random blocking operations such as file writes or querying the
178 // Windows registry. 183 // Windows registry.
179 static base::SequencedWorkerPool* GetBlockingPool(); 184 static base::SequencedWorkerPool* GetBlockingPool();
180 185
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 private: 270 private:
266 friend class BrowserThreadImpl; 271 friend class BrowserThreadImpl;
267 272
268 BrowserThread() {} 273 BrowserThread() {}
269 DISALLOW_COPY_AND_ASSIGN(BrowserThread); 274 DISALLOW_COPY_AND_ASSIGN(BrowserThread);
270 }; 275 };
271 276
272 } // namespace content 277 } // namespace content
273 278
274 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_H_ 279 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_H_
OLDNEW
« 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