From c3dec709ab360d4942cb72d557b5a414710b50e1 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Mon, 18 Dec 2017 13:36:07 +1100 Subject: [PATCH] PrintedPageSource has been removed --- chromium_src/chrome/browser/printing/print_job.cc | 15 +++------------ chromium_src/chrome/browser/printing/print_job.h | 12 ++---------- .../browser/printing/print_view_manager_base.cc | 3 +-- .../browser/printing/print_view_manager_base.h | 4 +--- 4 files changed, 7 insertions(+), 27 deletions(-) diff --git a/chromium_src/chrome/browser/printing/print_job.cc b/chromium_src/chrome/browser/printing/print_job.cc index 1c07453c7d..ed44cde8e6 100644 --- a/chromium_src/chrome/browser/printing/print_job.cc +++ b/chromium_src/chrome/browser/printing/print_job.cc @@ -45,8 +45,7 @@ void HoldRefCallback(const scoped_refptr& owner, } // namespace PrintJob::PrintJob() - : source_(nullptr), - is_job_pending_(false), + : is_job_pending_(false), is_canceling_(false), quit_factory_(this) { // This is normally a UI message loop, but in unit tests, the message loop is @@ -65,19 +64,17 @@ PrintJob::~PrintJob() { } void PrintJob::Initialize(PrintJobWorkerOwner* job, - PrintedPagesSource* source, + const base::string16& name, int page_count) { - DCHECK(!source_); DCHECK(!worker_); DCHECK(!is_job_pending_); DCHECK(!is_canceling_); DCHECK(!document_.get()); - source_ = source; worker_ = job->DetachWorker(this); settings_ = job->settings(); PrintedDocument* new_doc = - new PrintedDocument(settings_, source_, job->cookie()); + new PrintedDocument(settings_, name, job->cookie()); new_doc->set_page_count(page_count); UpdatePrintedDocument(new_doc); @@ -204,12 +201,6 @@ bool PrintJob::FlushJob(base::TimeDelta timeout) { return true; } -void PrintJob::DisconnectSource() { - source_ = nullptr; - if (document_.get()) - document_->DisconnectSource(); -} - bool PrintJob::is_job_pending() const { return is_job_pending_; } diff --git a/chromium_src/chrome/browser/printing/print_job.h b/chromium_src/chrome/browser/printing/print_job.h index bca518f6fc..28fc372ffd 100644 --- a/chromium_src/chrome/browser/printing/print_job.h +++ b/chromium_src/chrome/browser/printing/print_job.h @@ -27,7 +27,6 @@ class PdfToEmfConverter; class PrintJobWorker; class PrintedDocument; class PrintedPage; -class PrintedPagesSource; class PrinterQuery; // Manages the print work for a specific document. Talks to the printer through @@ -45,7 +44,8 @@ class PrintJob : public PrintJobWorkerOwner, // Grabs the ownership of the PrintJobWorker from another job, which is // usually a PrinterQuery. Set the expected page count of the print job. - void Initialize(PrintJobWorkerOwner* job, PrintedPagesSource* source, + void Initialize(PrintJobWorkerOwner* job, + const base::string16& name, int page_count); // content::NotificationObserver implementation. @@ -80,10 +80,6 @@ class PrintJob : public PrintJobWorkerOwner, // our data. bool FlushJob(base::TimeDelta timeout); - // Disconnects the PrintedPage source (PrintedPagesSource). It is done when - // the source is being destroyed. - void DisconnectSource(); - // Returns true if the print job is pending, i.e. between a StartPrinting() // and the end of the spooling. bool is_job_pending() const; @@ -140,10 +136,6 @@ class PrintJob : public PrintJobWorkerOwner, content::NotificationRegistrar registrar_; - // Source that generates the PrintedPage's (i.e. a WebContents). It will be - // set back to NULL if the source is deleted before this object. - PrintedPagesSource* source_; - // All the UI is done in a worker thread because many Win32 print functions // are blocking and enters a message loop without your consent. There is one // worker thread per print job. diff --git a/chromium_src/chrome/browser/printing/print_view_manager_base.cc b/chromium_src/chrome/browser/printing/print_view_manager_base.cc index e3dcbe063e..85ae2022b7 100644 --- a/chromium_src/chrome/browser/printing/print_view_manager_base.cc +++ b/chromium_src/chrome/browser/printing/print_view_manager_base.cc @@ -349,7 +349,7 @@ bool PrintViewManagerBase::CreateNewPrintJob(PrintJobWorkerOwner* job) { return false; print_job_ = new PrintJob(); - print_job_->Initialize(job, this, number_pages_); + print_job_->Initialize(job, RenderSourceName(), number_pages_); registrar_.Add(this, chrome::NOTIFICATION_PRINT_JOB_EVENT, content::Source(print_job_.get())); printing_succeeded_ = false; @@ -414,7 +414,6 @@ void PrintViewManagerBase::ReleasePrintJob() { registrar_.Remove(this, chrome::NOTIFICATION_PRINT_JOB_EVENT, content::Source(print_job_.get())); - print_job_->DisconnectSource(); // Don't close the worker thread. print_job_ = NULL; } diff --git a/chromium_src/chrome/browser/printing/print_view_manager_base.h b/chromium_src/chrome/browser/printing/print_view_manager_base.h index 6950feb766..ff0a1f38fe 100644 --- a/chromium_src/chrome/browser/printing/print_view_manager_base.h +++ b/chromium_src/chrome/browser/printing/print_view_manager_base.h @@ -15,7 +15,6 @@ #include "content/public/browser/notification_registrar.h" #include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_user_data.h" -#include "printing/printed_pages_source.h" struct PrintHostMsg_DidPrintPage_Params; @@ -33,7 +32,6 @@ class PrintQueriesQueue; // Base class for managing the print commands for a WebContents. class PrintViewManagerBase : public content::NotificationObserver, - public PrintedPagesSource, public content::WebContentsObserver { public: virtual ~PrintViewManagerBase(); @@ -48,7 +46,7 @@ class PrintViewManagerBase : public content::NotificationObserver, #endif // !DISABLE_BASIC_PRINTING // PrintedPagesSource implementation. - virtual base::string16 RenderSourceName() override; + base::string16 RenderSourceName(); void SetCallback(const base::Callback& cb) { callback = cb;