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

Side by Side Diff: printing/printed_document.h

Issue 568633002: Extracted MetafilePlayer interface from printing::MetafilePlayer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no_expose
Patch Set: Thu Sep 11 22:54:16 PDT 2014 Created 6 years, 3 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
« no previous file with comments | « printing/print_dialog_gtk_interface.h ('k') | printing/printed_document.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef PRINTING_PRINTED_DOCUMENT_H_ 5 #ifndef PRINTING_PRINTED_DOCUMENT_H_
6 #define PRINTING_PRINTED_DOCUMENT_H_ 6 #define PRINTING_PRINTED_DOCUMENT_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h"
12 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
13 #include "base/synchronization/lock.h" 14 #include "base/synchronization/lock.h"
14 #include "printing/print_settings.h" 15 #include "printing/print_settings.h"
15 #include "ui/gfx/native_widget_types.h" 16 #include "ui/gfx/native_widget_types.h"
16 17
17 namespace base { 18 namespace base {
18 class RefCountedMemory; 19 class RefCountedMemory;
19 class TaskRunner; 20 class TaskRunner;
20 } 21 }
21 22
22 namespace printing { 23 namespace printing {
23 24
24 class Metafile; 25 class MetafilePlayer;
25 class PrintedPage; 26 class PrintedPage;
26 class PrintedPagesSource; 27 class PrintedPagesSource;
27 class PrintingContext; 28 class PrintingContext;
28 29
29 // A collection of rendered pages. The settings are immutable. If the print 30 // A collection of rendered pages. The settings are immutable. If the print
30 // settings are changed, a new PrintedDocument must be created. 31 // settings are changed, a new PrintedDocument must be created.
31 // Warning: May be accessed from many threads at the same time. Only one thread 32 // Warning: May be accessed from many threads at the same time. Only one thread
32 // will have write access. Sensible functions are protected by a lock. 33 // will have write access. Sensible functions are protected by a lock.
33 // Warning: Once a page is loaded, it cannot be replaced. Pages may be discarded 34 // Warning: Once a page is loaded, it cannot be replaced. Pages may be discarded
34 // under low memory conditions. 35 // under low memory conditions.
35 class PRINTING_EXPORT PrintedDocument 36 class PRINTING_EXPORT PrintedDocument
36 : public base::RefCountedThreadSafe<PrintedDocument> { 37 : public base::RefCountedThreadSafe<PrintedDocument> {
37 public: 38 public:
38 // The cookie shall be unique and has a specific relationship with its 39 // The cookie shall be unique and has a specific relationship with its
39 // originating source and settings. 40 // originating source and settings.
40 PrintedDocument(const PrintSettings& settings, 41 PrintedDocument(const PrintSettings& settings,
41 PrintedPagesSource* source, 42 PrintedPagesSource* source,
42 int cookie, 43 int cookie,
43 base::TaskRunner* blocking_runner); 44 base::TaskRunner* blocking_runner);
44 45
45 // Sets a page's data. 0-based. Takes metafile ownership. 46 // Sets a page's data. 0-based. Takes metafile ownership.
46 // Note: locks for a short amount of time. 47 // Note: locks for a short amount of time.
47 void SetPage(int page_number, 48 void SetPage(int page_number,
48 Metafile* metafile, 49 scoped_ptr<MetafilePlayer> metafile,
49 #if defined(OS_WIN) 50 #if defined(OS_WIN)
50 double shrink, 51 double shrink,
51 #endif // OS_WIN 52 #endif // OS_WIN
52 const gfx::Size& paper_size, 53 const gfx::Size& paper_size,
53 const gfx::Rect& page_rect); 54 const gfx::Rect& page_rect);
54 55
55 // Retrieves a page. If the page is not available right now, it 56 // Retrieves a page. If the page is not available right now, it
56 // requests to have this page be rendered and returns NULL. 57 // requests to have this page be rendered and returns NULL.
57 // Note: locks for a short amount of time. 58 // Note: locks for a short amount of time.
58 scoped_refptr<PrintedPage> GetPage(int page_number); 59 scoped_refptr<PrintedPage> GetPage(int page_number);
(...skipping 10 matching lines...) Expand all
69 70
70 // Returns true if all the necessary pages for the settings are already 71 // Returns true if all the necessary pages for the settings are already
71 // rendered. 72 // rendered.
72 // Note: locks while parsing the whole tree. 73 // Note: locks while parsing the whole tree.
73 bool IsComplete() const; 74 bool IsComplete() const;
74 75
75 // Disconnects the PrintedPage source (PrintedPagesSource). It is done when 76 // Disconnects the PrintedPage source (PrintedPagesSource). It is done when
76 // the source is being destroyed. 77 // the source is being destroyed.
77 void DisconnectSource(); 78 void DisconnectSource();
78 79
79 // Retrieves the current memory usage of the renderer pages.
80 // Note: locks for a short amount of time.
81 uint32 MemoryUsage() const;
82
83 // Sets the number of pages in the document to be rendered. Can only be set 80 // Sets the number of pages in the document to be rendered. Can only be set
84 // once. 81 // once.
85 // Note: locks for a short amount of time. 82 // Note: locks for a short amount of time.
86 void set_page_count(int max_page); 83 void set_page_count(int max_page);
87 84
88 // Number of pages in the document. Used for headers/footers. 85 // Number of pages in the document. Used for headers/footers.
89 // Note: locks for a short amount of time. 86 // Note: locks for a short amount of time.
90 int page_count() const; 87 int page_count() const;
91 88
92 // Returns the number of expected pages to be rendered. It is a non-linear 89 // Returns the number of expected pages to be rendered. It is a non-linear
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 184
188 // All the immutable members. 185 // All the immutable members.
189 const Immutable immutable_; 186 const Immutable immutable_;
190 187
191 DISALLOW_COPY_AND_ASSIGN(PrintedDocument); 188 DISALLOW_COPY_AND_ASSIGN(PrintedDocument);
192 }; 189 };
193 190
194 } // namespace printing 191 } // namespace printing
195 192
196 #endif // PRINTING_PRINTED_DOCUMENT_H_ 193 #endif // PRINTING_PRINTED_DOCUMENT_H_
OLDNEW
« no previous file with comments | « printing/print_dialog_gtk_interface.h ('k') | printing/printed_document.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698