| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/threading/thread_restrictions.h" | 8 #include "base/threading/thread_restrictions.h" |
| 9 #include "base/timer.h" | 9 #include "base/timer.h" |
| 10 #include "chrome/browser/printing/print_job_worker.h" | 10 #include "chrome/browser/printing/print_job_worker.h" |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 176 |
| 177 bool PrintJob::FlushJob(int timeout_ms) { | 177 bool PrintJob::FlushJob(int timeout_ms) { |
| 178 // Make sure the object outlive this message loop. | 178 // Make sure the object outlive this message loop. |
| 179 scoped_refptr<PrintJob> handle(this); | 179 scoped_refptr<PrintJob> handle(this); |
| 180 | 180 |
| 181 // Stop() will eventually be called, which will get out of the inner message | 181 // Stop() will eventually be called, which will get out of the inner message |
| 182 // loop. But, don't take it for granted and set a timer in case something goes | 182 // loop. But, don't take it for granted and set a timer in case something goes |
| 183 // wrong. | 183 // wrong. |
| 184 base::OneShotTimer<MessageLoop> quit_task; | 184 base::OneShotTimer<MessageLoop> quit_task; |
| 185 if (timeout_ms) { | 185 if (timeout_ms) { |
| 186 quit_task.Start(FROM_HERE, TimeDelta::FromMilliseconds(timeout_ms), | 186 quit_task.Start(TimeDelta::FromMilliseconds(timeout_ms), |
| 187 MessageLoop::current(), &MessageLoop::Quit); | 187 MessageLoop::current(), &MessageLoop::Quit); |
| 188 } | 188 } |
| 189 | 189 |
| 190 bool old_state = MessageLoop::current()->NestableTasksAllowed(); | 190 bool old_state = MessageLoop::current()->NestableTasksAllowed(); |
| 191 MessageLoop::current()->SetNestableTasksAllowed(true); | 191 MessageLoop::current()->SetNestableTasksAllowed(true); |
| 192 MessageLoop::current()->Run(); | 192 MessageLoop::current()->Run(); |
| 193 // Restore task state. | 193 // Restore task state. |
| 194 MessageLoop::current()->SetNestableTasksAllowed(old_state); | 194 MessageLoop::current()->SetNestableTasksAllowed(old_state); |
| 195 | 195 |
| 196 return true; | 196 return true; |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 | 347 |
| 348 PrintedDocument* JobEventDetails::document() const { | 348 PrintedDocument* JobEventDetails::document() const { |
| 349 return document_; | 349 return document_; |
| 350 } | 350 } |
| 351 | 351 |
| 352 PrintedPage* JobEventDetails::page() const { | 352 PrintedPage* JobEventDetails::page() const { |
| 353 return page_; | 353 return page_; |
| 354 } | 354 } |
| 355 | 355 |
| 356 } // namespace printing | 356 } // namespace printing |
| OLD | NEW |