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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/threading/thread_restrictions.h" | 10 #include "base/threading/thread_restrictions.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 settings_(), | 37 settings_(), |
38 is_job_pending_(false), | 38 is_job_pending_(false), |
39 is_canceling_(false), | 39 is_canceling_(false), |
40 is_stopping_(false), | 40 is_stopping_(false), |
41 is_stopped_(false), | 41 is_stopped_(false), |
42 quit_factory_(this), | 42 quit_factory_(this), |
43 weak_ptr_factory_(this) { | 43 weak_ptr_factory_(this) { |
44 DCHECK(ui_message_loop_); | 44 DCHECK(ui_message_loop_); |
45 // This is normally a UI message loop, but in unit tests, the message loop is | 45 // This is normally a UI message loop, but in unit tests, the message loop is |
46 // of the 'default' type. | 46 // of the 'default' type. |
47 DCHECK(ui_message_loop_->type() == base::MessageLoop::TYPE_UI || | 47 DCHECK(base::MessageLoopForUI::IsCurrent() || |
48 ui_message_loop_->type() == base::MessageLoop::TYPE_DEFAULT); | 48 ui_message_loop_->type() == base::MessageLoop::TYPE_DEFAULT); |
49 ui_message_loop_->AddDestructionObserver(this); | 49 ui_message_loop_->AddDestructionObserver(this); |
50 } | 50 } |
51 | 51 |
52 PrintJob::~PrintJob() { | 52 PrintJob::~PrintJob() { |
53 ui_message_loop_->RemoveDestructionObserver(this); | 53 ui_message_loop_->RemoveDestructionObserver(this); |
54 // The job should be finished (or at least canceled) when it is destroyed. | 54 // The job should be finished (or at least canceled) when it is destroyed. |
55 DCHECK(!is_job_pending_); | 55 DCHECK(!is_job_pending_); |
56 DCHECK(!is_canceling_); | 56 DCHECK(!is_canceling_); |
57 if (worker_.get()) | 57 if (worker_.get()) |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 } | 390 } |
391 | 391 |
392 JobEventDetails::~JobEventDetails() { | 392 JobEventDetails::~JobEventDetails() { |
393 } | 393 } |
394 | 394 |
395 PrintedDocument* JobEventDetails::document() const { return document_.get(); } | 395 PrintedDocument* JobEventDetails::document() const { return document_.get(); } |
396 | 396 |
397 PrintedPage* JobEventDetails::page() const { return page_.get(); } | 397 PrintedPage* JobEventDetails::page() const { return page_.get(); } |
398 | 398 |
399 } // namespace printing | 399 } // namespace printing |
OLD | NEW |