| 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 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 // thread is not processing messages, a deadlock occurs. | 410 // thread is not processing messages, a deadlock occurs. |
| 411 // | 411 // |
| 412 // This function ensures that the dialog box will be destroyed in a timely | 412 // This function ensures that the dialog box will be destroyed in a timely |
| 413 // manner by the mere fact that the thread will terminate. So the potential | 413 // manner by the mere fact that the thread will terminate. So the potential |
| 414 // deadlock is eliminated. | 414 // deadlock is eliminated. |
| 415 worker_->StopSoon(); | 415 worker_->StopSoon(); |
| 416 | 416 |
| 417 // Delay shutdown until the worker terminates. We want this code path | 417 // Delay shutdown until the worker terminates. We want this code path |
| 418 // to wait on the thread to quit before continuing. | 418 // to wait on the thread to quit before continuing. |
| 419 if (worker_->IsRunning()) { | 419 if (worker_->IsRunning()) { |
| 420 base::MessageLoop::current()->PostDelayedTask( | 420 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 421 FROM_HERE, | 421 FROM_HERE, base::Bind(&PrintJob::ControlledWorkerShutdown, this), |
| 422 base::Bind(&PrintJob::ControlledWorkerShutdown, this), | |
| 423 base::TimeDelta::FromMilliseconds(100)); | 422 base::TimeDelta::FromMilliseconds(100)); |
| 424 return; | 423 return; |
| 425 } | 424 } |
| 426 #endif | 425 #endif |
| 427 | 426 |
| 428 | 427 |
| 429 // Now make sure the thread object is cleaned up. Do this on a worker | 428 // Now make sure the thread object is cleaned up. Do this on a worker |
| 430 // thread because it may block. | 429 // thread because it may block. |
| 431 base::WorkerPool::PostTaskAndReply( | 430 base::WorkerPool::PostTaskAndReply( |
| 432 FROM_HERE, | 431 FROM_HERE, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 456 } | 455 } |
| 457 | 456 |
| 458 JobEventDetails::~JobEventDetails() { | 457 JobEventDetails::~JobEventDetails() { |
| 459 } | 458 } |
| 460 | 459 |
| 461 PrintedDocument* JobEventDetails::document() const { return document_.get(); } | 460 PrintedDocument* JobEventDetails::document() const { return document_.get(); } |
| 462 | 461 |
| 463 PrintedPage* JobEventDetails::page() const { return page_.get(); } | 462 PrintedPage* JobEventDetails::page() const { return page_.get(); } |
| 464 | 463 |
| 465 } // namespace printing | 464 } // namespace printing |
| OLD | NEW |