OLD | NEW |
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/printing/print_job.h" | 7 #include "chrome/browser/printing/print_job.h" |
8 #include "chrome/browser/printing/printer_query.h" | 8 #include "chrome/browser/printing/printer_query.h" |
9 #include "chrome/common/chrome_notification_types.h" | 9 #include "chrome/common/chrome_notification_types.h" |
10 #include "content/public/browser/notification_service.h" | 10 #include "content/public/browser/notification_service.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 queued_queries_.push_back(make_scoped_refptr(job)); | 53 queued_queries_.push_back(make_scoped_refptr(job)); |
54 DCHECK(job->is_valid()); | 54 DCHECK(job->is_valid()); |
55 } | 55 } |
56 | 56 |
57 void PrintJobManager::PopPrinterQuery(int document_cookie, | 57 void PrintJobManager::PopPrinterQuery(int document_cookie, |
58 scoped_refptr<PrinterQuery>* job) { | 58 scoped_refptr<PrinterQuery>* job) { |
59 base::AutoLock lock(lock_); | 59 base::AutoLock lock(lock_); |
60 for (PrinterQueries::iterator itr = queued_queries_.begin(); | 60 for (PrinterQueries::iterator itr = queued_queries_.begin(); |
61 itr != queued_queries_.end(); | 61 itr != queued_queries_.end(); |
62 ++itr) { | 62 ++itr) { |
63 PrinterQuery* current_query = *itr; | 63 PrinterQuery* current_query = itr->get(); |
64 if (current_query->cookie() == document_cookie && | 64 if (current_query->cookie() == document_cookie && |
65 !current_query->is_callback_pending()) { | 65 !current_query->is_callback_pending()) { |
66 *job = current_query; | 66 *job = current_query; |
67 queued_queries_.erase(itr); | 67 queued_queries_.erase(itr); |
68 DCHECK(current_query->is_valid()); | 68 DCHECK(current_query->is_valid()); |
69 return; | 69 return; |
70 } | 70 } |
71 } | 71 } |
72 } | 72 } |
73 | 73 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 break; | 117 break; |
118 } | 118 } |
119 default: { | 119 default: { |
120 NOTREACHED(); | 120 NOTREACHED(); |
121 break; | 121 break; |
122 } | 122 } |
123 } | 123 } |
124 } | 124 } |
125 | 125 |
126 } // namespace printing | 126 } // namespace printing |
OLD | NEW |