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

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: Add a comment to the new query stopping code. 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
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..da0e91f03356cb318a27c93b2843ebd0b709011b 100644
--- a/chrome/browser/printing/print_job_manager.cc
+++ b/chrome/browser/printing/print_job_manager.cc
@@ -57,9 +57,20 @@ 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;
+ }
+ // Stop all pending queries, requests to generate print preview do not have
+ // corresponding PrintJob, so any pending preview requests are not covered
+ // by PrintJobManager::StopJobs and should be stopped explicitly.
+ for (PrinterQueries::iterator itr = queries_to_stop.begin();
+ itr != queries_to_stop.end(); ++itr) {
+ (*itr)->message_loop()->PostTask(
+ FROM_HERE, base::Bind(&PrinterQuery::StopWorker, *itr));
+ }
}
PrintJobManager::PrintJobManager() : is_shutdown_(false) {

Powered by Google App Engine
This is Rietveld 408576698