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

Side by Side Diff: chrome/browser/printing/print_job_manager.cc

Issue 10383254: At browser exit, wait for pending print jobs before starting shutdown. This is to avoid a nested me… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/printing/print_job.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 #include "chrome/browser/printing/print_job_manager.h" 5 #include "chrome/browser/printing/print_job_manager.h"
6 6
7 #include "chrome/browser/prefs/pref_service.h" 7 #include "chrome/browser/prefs/pref_service.h"
8 #include "chrome/browser/printing/print_job.h" 8 #include "chrome/browser/printing/print_job.h"
9 #include "chrome/browser/printing/printer_query.h" 9 #include "chrome/browser/printing/printer_query.h"
10 #include "chrome/common/chrome_notification_types.h" 10 #include "chrome/common/chrome_notification_types.h"
(...skipping 17 matching lines...) Expand all
28 queued_queries_.clear(); 28 queued_queries_.clear();
29 } 29 }
30 30
31 void PrintJobManager::InitOnUIThread(PrefService* prefs) { 31 void PrintJobManager::InitOnUIThread(PrefService* prefs) {
32 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 32 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
33 printing_enabled_.Init(prefs::kPrintingEnabled, prefs, NULL); 33 printing_enabled_.Init(prefs::kPrintingEnabled, prefs, NULL);
34 printing_enabled_.MoveToThread(BrowserThread::IO); 34 printing_enabled_.MoveToThread(BrowserThread::IO);
35 } 35 }
36 36
37 void PrintJobManager::OnQuit() { 37 void PrintJobManager::OnQuit() {
38 #if defined(OS_MACOSX)
39 // OnQuit is too late to try to wait for jobs on the Mac, since the runloop
40 // has already been torn down; instead, StopJobs(true) is called earlier in
41 // the shutdown process, and this is just here in case something sneaks
42 // in after that.
43 StopJobs(false);
44 #else
45 StopJobs(true); 38 StopJobs(true);
46 #endif
47 registrar_.RemoveAll(); 39 registrar_.RemoveAll();
48 } 40 }
49 41
50 void PrintJobManager::StopJobs(bool wait_for_finish) { 42 void PrintJobManager::StopJobs(bool wait_for_finish) {
51 if (current_jobs_.empty()) 43 if (current_jobs_.empty())
52 return; 44 return;
53 { 45 {
54 // Copy the array since it can be modified in transit. 46 // Copy the array since it can be modified in transit.
55 PrintJobs current_jobs(current_jobs_); 47 PrintJobs current_jobs(current_jobs_);
56 // Wait for each job to finish. 48 // Wait for each job to finish.
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 break; 156 break;
165 } 157 }
166 } 158 }
167 } 159 }
168 160
169 bool PrintJobManager::printing_enabled() const { 161 bool PrintJobManager::printing_enabled() const {
170 return *printing_enabled_; 162 return *printing_enabled_;
171 } 163 }
172 164
173 } // namespace printing 165 } // namespace printing
OLDNEW
« no previous file with comments | « chrome/browser/printing/print_job.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698