diff options
author | senorblanco@chromium.org <senorblanco@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-28 19:21:41 +0000 |
---|---|---|
committer | senorblanco@chromium.org <senorblanco@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-28 19:21:41 +0000 |
commit | 359e88bc6b5c70a789b0f5bea155954f0660a232 (patch) | |
tree | 8c2114ff268739901f213e2a052bb50e04da8272 /chrome/browser/printing | |
parent | 27b51d38027a9927cdc8bc0c8d7eef1d1bcb7108 (diff) | |
download | chromium_src-359e88bc6b5c70a789b0f5bea155954f0660a232.zip chromium_src-359e88bc6b5c70a789b0f5bea155954f0660a232.tar.gz chromium_src-359e88bc6b5c70a789b0f5bea155954f0660a232.tar.bz2 |
Reverting 27379, in hopes of fixing browser_tests.
TBR=darin
Review URL: http://codereview.chromium.org/248021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27389 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/printing')
-rw-r--r-- | chrome/browser/printing/print_job.h | 11 | ||||
-rw-r--r-- | chrome/browser/printing/print_job_unittest.cc | 10 | ||||
-rw-r--r-- | chrome/browser/printing/print_job_worker.cc | 3 | ||||
-rw-r--r-- | chrome/browser/printing/print_job_worker.h | 1 | ||||
-rw-r--r-- | chrome/browser/printing/print_job_worker_owner.h | 6 | ||||
-rw-r--r-- | chrome/browser/printing/printer_query.h | 10 |
6 files changed, 34 insertions, 7 deletions
diff --git a/chrome/browser/printing/print_job.h b/chrome/browser/printing/print_job.h index cf4badc..45d5d12 100644 --- a/chrome/browser/printing/print_job.h +++ b/chrome/browser/printing/print_job.h @@ -8,6 +8,7 @@ #include "base/basictypes.h" #include "base/gfx/native_widget_types.h" #include "base/message_loop.h" +#include "base/ref_counted.h" #include "chrome/browser/printing/print_job_worker_owner.h" #include "chrome/common/notification_registrar.h" @@ -31,8 +32,9 @@ class PrinterQuery; // any state change. While printing, the PrintJobManager instance keeps a // reference to the job to be sure it is kept alive. All the code in this class // runs in the UI thread. -class PrintJob : public PrintJobWorkerOwner, +class PrintJob : public base::RefCountedThreadSafe<PrintJob>, public NotificationObserver, + public PrintJobWorkerOwner, public MessageLoop::DestructionObserver { public: // Create a empty PrintJob. When initializing with this constructor, @@ -50,6 +52,13 @@ class PrintJob : public PrintJobWorkerOwner, const NotificationDetails& details); // PrintJobWorkerOwner + virtual void AddRef() { + return base::RefCountedThreadSafe<PrintJob>::AddRef(); + } + virtual void Release() { + return base::RefCountedThreadSafe<PrintJob>::Release(); + } + virtual void GetSettingsDone(const PrintSettings& new_settings, PrintingContext::Result result); virtual PrintJobWorker* DetachWorker(PrintJobWorkerOwner* new_owner); diff --git a/chrome/browser/printing/print_job_unittest.cc b/chrome/browser/printing/print_job_unittest.cc index 3ef795c..fe98964 100644 --- a/chrome/browser/printing/print_job_unittest.cc +++ b/chrome/browser/printing/print_job_unittest.cc @@ -33,6 +33,12 @@ class TestPrintJobWorker : public printing::PrintJobWorker { class TestOwner : public printing::PrintJobWorkerOwner { public: + virtual void AddRef() { + EXPECT_FALSE(true); + } + virtual void Release() { + EXPECT_FALSE(true); + } virtual void GetSettingsDone(const printing::PrintSettings& new_settings, printing::PrintingContext::Result result) { EXPECT_FALSE(true); @@ -98,9 +104,9 @@ TEST(PrintJobTest, SimplePrint) { volatile bool check = false; scoped_refptr<printing::PrintJob> job(new TestPrintJob(&check)); EXPECT_EQ(MessageLoop::current(), job->message_loop()); - scoped_refptr<TestOwner> owner(new TestOwner); + TestOwner owner; TestSource source; - job->Initialize(owner, &source); + job->Initialize(&owner, &source); job->Stop(); job = NULL; EXPECT_TRUE(check); diff --git a/chrome/browser/printing/print_job_worker.cc b/chrome/browser/printing/print_job_worker.cc index 375c2407..caf5ad3 100644 --- a/chrome/browser/printing/print_job_worker.cc +++ b/chrome/browser/printing/print_job_worker.cc @@ -275,6 +275,9 @@ void PrintJobWorker::OnFailure() { } // namespace printing +RunnableMethodTraits<printing::PrintJobWorker>::RunnableMethodTraits() { +} + void RunnableMethodTraits<printing::PrintJobWorker>::RetainCallee( printing::PrintJobWorker* obj) { DCHECK(!owner_.get()); diff --git a/chrome/browser/printing/print_job_worker.h b/chrome/browser/printing/print_job_worker.h index fce8912..9ad2c39 100644 --- a/chrome/browser/printing/print_job_worker.h +++ b/chrome/browser/printing/print_job_worker.h @@ -98,6 +98,7 @@ class PrintJobWorker : public base::Thread { template <> struct RunnableMethodTraits<printing::PrintJobWorker> { + RunnableMethodTraits(); void RetainCallee(printing::PrintJobWorker* obj); void ReleaseCallee(printing::PrintJobWorker* obj); private: diff --git a/chrome/browser/printing/print_job_worker_owner.h b/chrome/browser/printing/print_job_worker_owner.h index e1ba719..1810eca 100644 --- a/chrome/browser/printing/print_job_worker_owner.h +++ b/chrome/browser/printing/print_job_worker_owner.h @@ -5,7 +5,6 @@ #ifndef CHROME_BROWSER_PRINTING_PRINT_JOB_WORKER_OWNER_H__ #define CHROME_BROWSER_PRINTING_PRINT_JOB_WORKER_OWNER_H__ -#include "base/ref_counted.h" #include "printing/printing_context.h" class MessageLoop; @@ -15,11 +14,12 @@ namespace printing { class PrintJobWorker; class PrintSettings; -class PrintJobWorkerOwner : - public base::RefCountedThreadSafe<PrintJobWorkerOwner> { +class PrintJobWorkerOwner { public: virtual ~PrintJobWorkerOwner() { } + virtual void AddRef() = 0; + virtual void Release() = 0; // Finishes the initialization began by PrintJobWorker::Init(). Creates a // new PrintedDocument if necessary. Solely meant to be called by diff --git a/chrome/browser/printing/printer_query.h b/chrome/browser/printing/printer_query.h index b0502c8..6d6fd88 100644 --- a/chrome/browser/printing/printer_query.h +++ b/chrome/browser/printing/printer_query.h @@ -6,6 +6,7 @@ #define CHROME_BROWSER_PRINTING_PRINTER_QUERY_H_ #include "base/scoped_ptr.h" +#include "base/ref_counted.h" #include "chrome/browser/printing/print_job_worker_owner.h" class CancelableTask; @@ -20,7 +21,8 @@ namespace printing { class PrintJobWorker; // Query the printer for settings. -class PrinterQuery : public PrintJobWorkerOwner { +class PrinterQuery : public base::RefCountedThreadSafe<PrinterQuery>, + public PrintJobWorkerOwner { public: // GetSettings() UI parameter. enum GetSettingsAskParam { @@ -32,6 +34,12 @@ class PrinterQuery : public PrintJobWorkerOwner { virtual ~PrinterQuery(); // PrintJobWorkerOwner + virtual void AddRef() { + return base::RefCountedThreadSafe<PrinterQuery>::AddRef(); + } + virtual void Release() { + return base::RefCountedThreadSafe<PrinterQuery>::Release(); + } virtual void GetSettingsDone(const PrintSettings& new_settings, PrintingContext::Result result); virtual PrintJobWorker* DetachWorker(PrintJobWorkerOwner* new_owner); |