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.h" | 5 #include "chrome/browser/printing/print_job.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 content::NotificationService::current()->Notify( | 143 content::NotificationService::current()->Notify( |
144 chrome::NOTIFICATION_PRINT_JOB_EVENT, | 144 chrome::NOTIFICATION_PRINT_JOB_EVENT, |
145 content::Source<PrintJob>(this), | 145 content::Source<PrintJob>(this), |
146 content::Details<JobEventDetails>(details.get())); | 146 content::Details<JobEventDetails>(details.get())); |
147 } | 147 } |
148 | 148 |
149 void PrintJob::Stop() { | 149 void PrintJob::Stop() { |
150 DCHECK(RunsTasksOnCurrentThread()); | 150 DCHECK(RunsTasksOnCurrentThread()); |
151 | 151 |
152 if (quit_factory_.HasWeakPtrs()) { | 152 if (quit_factory_.HasWeakPtrs()) { |
153 // In case we're running a nested message loop to wait for a job to finish, | 153 // In case we're running a nested run loop to wait for a job to finish, |
154 // and we finished before the timeout, quit the nested loop right away. | 154 // and we finished before the timeout, quit the nested loop right away. |
155 Quit(); | 155 Quit(); |
156 quit_factory_.InvalidateWeakPtrs(); | 156 quit_factory_.InvalidateWeakPtrs(); |
157 } | 157 } |
158 | 158 |
159 // Be sure to live long enough. | 159 // Be sure to live long enough. |
160 scoped_refptr<PrintJob> handle(this); | 160 scoped_refptr<PrintJob> handle(this); |
161 | 161 |
162 if (worker_->IsRunning()) { | 162 if (worker_->IsRunning()) { |
163 ControlledWorkerShutdown(); | 163 ControlledWorkerShutdown(); |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 : document_(document), page_(page), type_(type), job_id_(job_id) {} | 479 : document_(document), page_(page), type_(type), job_id_(job_id) {} |
480 | 480 |
481 JobEventDetails::~JobEventDetails() { | 481 JobEventDetails::~JobEventDetails() { |
482 } | 482 } |
483 | 483 |
484 PrintedDocument* JobEventDetails::document() const { return document_.get(); } | 484 PrintedDocument* JobEventDetails::document() const { return document_.get(); } |
485 | 485 |
486 PrintedPage* JobEventDetails::page() const { return page_.get(); } | 486 PrintedPage* JobEventDetails::page() const { return page_.get(); } |
487 | 487 |
488 } // namespace printing | 488 } // namespace printing |
OLD | NEW |