| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/lock.h" | 10 #include "base/lock.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 104 |
| 105 // Sets a path where to dump printing output files for debugging. If never set | 105 // Sets a path where to dump printing output files for debugging. If never set |
| 106 // no files are generated. | 106 // no files are generated. |
| 107 static void set_debug_dump_path(const FilePath& debug_dump_path); | 107 static void set_debug_dump_path(const FilePath& debug_dump_path); |
| 108 | 108 |
| 109 static const FilePath& debug_dump_path(); | 109 static const FilePath& debug_dump_path(); |
| 110 | 110 |
| 111 private: | 111 private: |
| 112 friend class base::RefCountedThreadSafe<PrintedDocument>; | 112 friend class base::RefCountedThreadSafe<PrintedDocument>; |
| 113 | 113 |
| 114 ~PrintedDocument(); | 114 virtual ~PrintedDocument(); |
| 115 | 115 |
| 116 // Array of data for each print previewed page. | 116 // Array of data for each print previewed page. |
| 117 typedef std::map<int, scoped_refptr<PrintedPage> > PrintedPages; | 117 typedef std::map<int, scoped_refptr<PrintedPage> > PrintedPages; |
| 118 | 118 |
| 119 // Contains all the mutable stuff. All this stuff MUST be accessed with the | 119 // Contains all the mutable stuff. All this stuff MUST be accessed with the |
| 120 // lock held. | 120 // lock held. |
| 121 struct Mutable { | 121 struct Mutable { |
| 122 explicit Mutable(PrintedPagesSource* source); | 122 explicit Mutable(PrintedPagesSource* source); |
| 123 ~Mutable(); |
| 123 | 124 |
| 124 // Source that generates the PrintedPage's (i.e. a TabContents). It will be | 125 // Source that generates the PrintedPage's (i.e. a TabContents). It will be |
| 125 // set back to NULL if the source is deleted before this object. | 126 // set back to NULL if the source is deleted before this object. |
| 126 PrintedPagesSource* source_; | 127 PrintedPagesSource* source_; |
| 127 | 128 |
| 128 // Contains the pages' representation. This is a collection of PrintedPage. | 129 // Contains the pages' representation. This is a collection of PrintedPage. |
| 129 // Warning: Lock must be held when accessing this member. | 130 // Warning: Lock must be held when accessing this member. |
| 130 PrintedPages pages_; | 131 PrintedPages pages_; |
| 131 | 132 |
| 132 // Number of expected pages to be rendered. | 133 // Number of expected pages to be rendered. |
| 133 // Warning: Lock must be held when accessing this member. | 134 // Warning: Lock must be held when accessing this member. |
| 134 int expected_page_count_; | 135 int expected_page_count_; |
| 135 | 136 |
| 136 // The total number of pages in the document. | 137 // The total number of pages in the document. |
| 137 int page_count_; | 138 int page_count_; |
| 138 | 139 |
| 139 // Shrink done in comparison to desired_dpi. | 140 // Shrink done in comparison to desired_dpi. |
| 140 double shrink_factor; | 141 double shrink_factor; |
| 141 }; | 142 }; |
| 142 | 143 |
| 143 // Contains all the immutable stuff. All this stuff can be accessed without | 144 // Contains all the immutable stuff. All this stuff can be accessed without |
| 144 // any lock held. This is because it can't be changed after the object's | 145 // any lock held. This is because it can't be changed after the object's |
| 145 // construction. | 146 // construction. |
| 146 struct Immutable { | 147 struct Immutable { |
| 147 Immutable(const PrintSettings& settings, PrintedPagesSource* source, | 148 Immutable(const PrintSettings& settings, PrintedPagesSource* source, |
| 148 int cookie); | 149 int cookie); |
| 150 ~Immutable(); |
| 149 | 151 |
| 150 // Print settings used to generate this document. Immutable. | 152 // Print settings used to generate this document. Immutable. |
| 151 PrintSettings settings_; | 153 PrintSettings settings_; |
| 152 | 154 |
| 153 // Native thread for the render source. | 155 // Native thread for the render source. |
| 154 MessageLoop* source_message_loop_; | 156 MessageLoop* source_message_loop_; |
| 155 | 157 |
| 156 // Document name. Immutable. | 158 // Document name. Immutable. |
| 157 string16 name_; | 159 string16 name_; |
| 158 | 160 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 195 |
| 194 // All the immutable members. | 196 // All the immutable members. |
| 195 const Immutable immutable_; | 197 const Immutable immutable_; |
| 196 | 198 |
| 197 DISALLOW_COPY_AND_ASSIGN(PrintedDocument); | 199 DISALLOW_COPY_AND_ASSIGN(PrintedDocument); |
| 198 }; | 200 }; |
| 199 | 201 |
| 200 } // namespace printing | 202 } // namespace printing |
| 201 | 203 |
| 202 #endif // PRINTING_PRINTED_DOCUMENT_H_ | 204 #endif // PRINTING_PRINTED_DOCUMENT_H_ |
| OLD | NEW |