Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: chrome/browser/printing/print_job.h

Issue 251012: Assert that thread-safe reference counting is used with... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #ifndef CHROME_BROWSER_PRINTING_PRINT_JOB_H_ 5 #ifndef CHROME_BROWSER_PRINTING_PRINT_JOB_H_
6 #define CHROME_BROWSER_PRINTING_PRINT_JOB_H_ 6 #define CHROME_BROWSER_PRINTING_PRINT_JOB_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/gfx/native_widget_types.h" 9 #include "base/gfx/native_widget_types.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
11 #include "base/ref_counted.h"
12 #include "chrome/browser/printing/print_job_worker_owner.h" 11 #include "chrome/browser/printing/print_job_worker_owner.h"
13 #include "chrome/common/notification_registrar.h" 12 #include "chrome/common/notification_registrar.h"
14 13
15 class GURL; 14 class GURL;
16 class Thread; 15 class Thread;
17 16
18 namespace printing { 17 namespace printing {
19 18
20 // See definition below. 19 // See definition below.
21 class JobEventDetails; 20 class JobEventDetails;
22 21
23 class PrintedDocument; 22 class PrintedDocument;
24 class PrintedPage; 23 class PrintedPage;
25 class PrintedPagesSource; 24 class PrintedPagesSource;
26 class PrintJobWorker; 25 class PrintJobWorker;
27 class PrinterQuery; 26 class PrinterQuery;
28 27
29 // Manages the print work for a specific document. Talks to the printer through 28 // Manages the print work for a specific document. Talks to the printer through
30 // PrintingContext though PrintJob::Worker. Hides access to PrintingContext in a 29 // PrintingContext though PrintJob::Worker. Hides access to PrintingContext in a
31 // worker thread so the caller never blocks. PrintJob will send notifications on 30 // worker thread so the caller never blocks. PrintJob will send notifications on
32 // any state change. While printing, the PrintJobManager instance keeps a 31 // any state change. While printing, the PrintJobManager instance keeps a
33 // reference to the job to be sure it is kept alive. All the code in this class 32 // reference to the job to be sure it is kept alive. All the code in this class
34 // runs in the UI thread. 33 // runs in the UI thread.
35 class PrintJob : public base::RefCountedThreadSafe<PrintJob>, 34 class PrintJob : public PrintJobWorkerOwner,
36 public NotificationObserver, 35 public NotificationObserver,
37 public PrintJobWorkerOwner,
38 public MessageLoop::DestructionObserver { 36 public MessageLoop::DestructionObserver {
39 public: 37 public:
40 // Create a empty PrintJob. When initializing with this constructor, 38 // Create a empty PrintJob. When initializing with this constructor,
41 // post-constructor initialization must be done with Initialize(). 39 // post-constructor initialization must be done with Initialize().
42 PrintJob(); 40 PrintJob();
43 virtual ~PrintJob(); 41 virtual ~PrintJob();
44 42
45 // Grabs the ownership of the PrintJobWorker from another job, which is 43 // Grabs the ownership of the PrintJobWorker from another job, which is
46 // usually a PrinterQuery. 44 // usually a PrinterQuery.
47 void Initialize(PrintJobWorkerOwner* job, PrintedPagesSource* source); 45 void Initialize(PrintJobWorkerOwner* job, PrintedPagesSource* source);
48 46
49 // NotificationObserver 47 // NotificationObserver
50 virtual void Observe(NotificationType type, 48 virtual void Observe(NotificationType type,
51 const NotificationSource& source, 49 const NotificationSource& source,
52 const NotificationDetails& details); 50 const NotificationDetails& details);
53 51
54 // PrintJobWorkerOwner 52 // PrintJobWorkerOwner
55 virtual void AddRef() {
56 return base::RefCountedThreadSafe<PrintJob>::AddRef();
57 }
58 virtual void Release() {
59 return base::RefCountedThreadSafe<PrintJob>::Release();
60 }
61
62 virtual void GetSettingsDone(const PrintSettings& new_settings, 53 virtual void GetSettingsDone(const PrintSettings& new_settings,
63 PrintingContext::Result result); 54 PrintingContext::Result result);
64 virtual PrintJobWorker* DetachWorker(PrintJobWorkerOwner* new_owner); 55 virtual PrintJobWorker* DetachWorker(PrintJobWorkerOwner* new_owner);
65 virtual MessageLoop* message_loop() { return ui_message_loop_; } 56 virtual MessageLoop* message_loop() { return ui_message_loop_; }
66 virtual const PrintSettings& settings() const { return settings_; } 57 virtual const PrintSettings& settings() const { return settings_; }
67 virtual int cookie() const; 58 virtual int cookie() const;
68 59
69 // DestructionObserver 60 // DestructionObserver
70 virtual void WillDestroyCurrentMessageLoop(); 61 virtual void WillDestroyCurrentMessageLoop();
71 62
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 scoped_refptr<PrintedDocument> document_; 194 scoped_refptr<PrintedDocument> document_;
204 scoped_refptr<PrintedPage> page_; 195 scoped_refptr<PrintedPage> page_;
205 const Type type_; 196 const Type type_;
206 197
207 DISALLOW_COPY_AND_ASSIGN(JobEventDetails); 198 DISALLOW_COPY_AND_ASSIGN(JobEventDetails);
208 }; 199 };
209 200
210 } // namespace printing 201 } // namespace printing
211 202
212 #endif // CHROME_BROWSER_PRINTING_PRINT_JOB_H_ 203 #endif // CHROME_BROWSER_PRINTING_PRINT_JOB_H_
OLDNEW
« no previous file with comments | « chrome/browser/history/history_unittest.cc ('k') | chrome/browser/printing/print_job_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698