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

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

Issue 524543002: Removed IDC_PRINT_TO_DESTINATION. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fri Aug 29 14:26:26 PDT 2014 Created 6 years, 3 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
« no previous file with comments | « chrome/browser/printing/print_job_manager.h ('k') | chrome/browser/printing/print_job_worker.h » ('j') | 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/chrome_notification_types.h" 7 #include "chrome/browser/chrome_notification_types.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 "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
11 #include "content/public/browser/notification_service.h" 11 #include "content/public/browser/notification_service.h"
12 #include "printing/printed_document.h" 12 #include "printing/printed_document.h"
13 #include "printing/printed_page.h" 13 #include "printing/printed_page.h"
14 14
15 namespace printing { 15 namespace printing {
16 16
17 PrintQueriesQueue::PrintQueriesQueue() { 17 PrintQueriesQueue::PrintQueriesQueue() {
18 } 18 }
19 19
20 PrintQueriesQueue::~PrintQueriesQueue() { 20 PrintQueriesQueue::~PrintQueriesQueue() {
21 base::AutoLock lock(lock_); 21 base::AutoLock lock(lock_);
22 queued_queries_.clear(); 22 queued_queries_.clear();
23 } 23 }
24 24
25 void PrintQueriesQueue::SetDestination(PrintDestinationInterface* destination) {
26 base::AutoLock lock(lock_);
27 destination_ = destination;
28 }
29
30 void PrintQueriesQueue::QueuePrinterQuery(PrinterQuery* job) { 25 void PrintQueriesQueue::QueuePrinterQuery(PrinterQuery* job) {
31 base::AutoLock lock(lock_); 26 base::AutoLock lock(lock_);
32 DCHECK(job); 27 DCHECK(job);
33 queued_queries_.push_back(make_scoped_refptr(job)); 28 queued_queries_.push_back(make_scoped_refptr(job));
34 DCHECK(job->is_valid()); 29 DCHECK(job->is_valid());
35 } 30 }
36 31
37 scoped_refptr<PrinterQuery> PrintQueriesQueue::PopPrinterQuery( 32 scoped_refptr<PrinterQuery> PrintQueriesQueue::PopPrinterQuery(
38 int document_cookie) { 33 int document_cookie) {
39 base::AutoLock lock(lock_); 34 base::AutoLock lock(lock_);
40 for (PrinterQueries::iterator itr = queued_queries_.begin(); 35 for (PrinterQueries::iterator itr = queued_queries_.begin();
41 itr != queued_queries_.end(); ++itr) { 36 itr != queued_queries_.end(); ++itr) {
42 if ((*itr)->cookie() == document_cookie && !(*itr)->is_callback_pending()) { 37 if ((*itr)->cookie() == document_cookie && !(*itr)->is_callback_pending()) {
43 scoped_refptr<printing::PrinterQuery> current_query(*itr); 38 scoped_refptr<printing::PrinterQuery> current_query(*itr);
44 queued_queries_.erase(itr); 39 queued_queries_.erase(itr);
45 DCHECK(current_query->is_valid()); 40 DCHECK(current_query->is_valid());
46 return current_query; 41 return current_query;
47 } 42 }
48 } 43 }
49 return NULL; 44 return NULL;
50 } 45 }
51 46
52 scoped_refptr<PrinterQuery> PrintQueriesQueue::CreatePrinterQuery( 47 scoped_refptr<PrinterQuery> PrintQueriesQueue::CreatePrinterQuery(
53 int render_process_id, 48 int render_process_id,
54 int render_view_id) { 49 int render_view_id) {
55 scoped_refptr<PrinterQuery> job = 50 scoped_refptr<PrinterQuery> job =
56 new printing::PrinterQuery(render_process_id, render_view_id); 51 new printing::PrinterQuery(render_process_id, render_view_id);
57 base::AutoLock lock(lock_);
58 job->SetWorkerDestination(destination_.get());
59 return job; 52 return job;
60 } 53 }
61 54
62 void PrintQueriesQueue::Shutdown() { 55 void PrintQueriesQueue::Shutdown() {
63 PrinterQueries queries_to_stop; 56 PrinterQueries queries_to_stop;
64 { 57 {
65 base::AutoLock lock(lock_); 58 base::AutoLock lock(lock_);
66 queued_queries_.swap(queries_to_stop); 59 queued_queries_.swap(queries_to_stop);
67 destination_ = NULL;
68 } 60 }
69 // Stop all pending queries, requests to generate print preview do not have 61 // Stop all pending queries, requests to generate print preview do not have
70 // corresponding PrintJob, so any pending preview requests are not covered 62 // corresponding PrintJob, so any pending preview requests are not covered
71 // by PrintJobManager::StopJobs and should be stopped explicitly. 63 // by PrintJobManager::StopJobs and should be stopped explicitly.
72 for (PrinterQueries::iterator itr = queries_to_stop.begin(); 64 for (PrinterQueries::iterator itr = queries_to_stop.begin();
73 itr != queries_to_stop.end(); ++itr) { 65 itr != queries_to_stop.end(); ++itr) {
74 (*itr)->PostTask(FROM_HERE, base::Bind(&PrinterQuery::StopWorker, *itr)); 66 (*itr)->PostTask(FROM_HERE, base::Bind(&PrinterQuery::StopWorker, *itr));
75 } 67 }
76 } 68 }
77 69
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 break; 155 break;
164 } 156 }
165 default: { 157 default: {
166 NOTREACHED(); 158 NOTREACHED();
167 break; 159 break;
168 } 160 }
169 } 161 }
170 } 162 }
171 163
172 } // namespace printing 164 } // namespace printing
OLDNEW
« no previous file with comments | « chrome/browser/printing/print_job_manager.h ('k') | chrome/browser/printing/print_job_worker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698