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

Unified Diff: chrome/browser/printing/print_job_manager.cc

Issue 294923005: Add media size capability to PDF printer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Gracefully stop pending print queries upon shutdown. Created 6 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 | chrome/browser/resources/print_preview/data/app_state.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/printing/print_job_manager.cc
diff --git a/chrome/browser/printing/print_job_manager.cc b/chrome/browser/printing/print_job_manager.cc
index 9dc0c85404c17033a4f2a2de15e1febe766fc1d2..e43c052d80e02830ad3f2d1207cde1e809c73107 100644
--- a/chrome/browser/printing/print_job_manager.cc
+++ b/chrome/browser/printing/print_job_manager.cc
@@ -57,9 +57,18 @@ scoped_refptr<PrinterQuery> PrintQueriesQueue::CreatePrinterQuery() {
}
void PrintQueriesQueue::Shutdown() {
- base::AutoLock lock(lock_);
- queued_queries_.clear();
- destination_ = NULL;
+ PrinterQueries queries_to_stop;
+ {
+ base::AutoLock lock(lock_);
+ queued_queries_.swap(queries_to_stop);
+ destination_ = NULL;
+ }
+ for (PrinterQueries::iterator itr = queries_to_stop.begin();
+ itr != queries_to_stop.end(); ++itr) {
Vitaly Buka (NO REVIEWS) 2014/05/29 00:58:34 iterating using for (size_t i = 0) is shorter
+ scoped_refptr<printing::PrinterQuery> query_to_stop(*itr);
Vitaly Buka (NO REVIEWS) 2014/05/29 00:58:34 you don't need temp var query_to_stop
+ query_to_stop->message_loop()->PostTask(
+ FROM_HERE, base::Bind(&PrinterQuery::StopWorker, query_to_stop));
+ }
}
PrintJobManager::PrintJobManager() : is_shutdown_(false) {
« no previous file with comments | « no previous file | chrome/browser/resources/print_preview/data/app_state.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698