Chromium Code Reviews| Index: printing/printed_document.h |
| diff --git a/printing/printed_document.h b/printing/printed_document.h |
| index b8af4bb5f39e4984cf98d0d4278f7dc222176bd4..73fb68fcb6ce6be557ba9ebcf5f22a4c31330a5d 100644 |
| --- a/printing/printed_document.h |
| +++ b/printing/printed_document.h |
| @@ -15,7 +15,8 @@ |
| namespace base { |
| class FilePath; |
| -class MessageLoop; |
| +class RefCountedMemory; |
| +class TaskRunner; |
| } |
| namespace printing { |
| @@ -38,7 +39,8 @@ class PRINTING_EXPORT PrintedDocument |
| // originating source and settings. |
| PrintedDocument(const PrintSettings& settings, |
| PrintedPagesSource* source, |
| - int cookie); |
| + int cookie, |
| + base::TaskRunner* file_runner); |
| // Sets a page's data. 0-based. Takes metafile ownership. |
| // Note: locks for a short amount of time. |
| @@ -46,9 +48,9 @@ class PRINTING_EXPORT PrintedDocument |
| const gfx::Size& paper_size, const gfx::Rect& page_rect); |
| // Retrieves a page. If the page is not available right now, it |
| - // requests to have this page be rendered and returns false. |
| + // requests to have this page be rendered and returns NULL. |
| // Note: locks for a short amount of time. |
| - bool GetPage(int page_number, scoped_refptr<PrintedPage>* page); |
| + scoped_refptr<PrintedPage> GetPage(int page_number); |
| // Draws the page in the context. |
| // Note: locks for a short amount of time in debug only. |
| @@ -97,7 +99,14 @@ class PRINTING_EXPORT PrintedDocument |
| // no files are generated. |
| static void set_debug_dump_path(const base::FilePath& debug_dump_path); |
| - static const base::FilePath& debug_dump_path(); |
| + // Creates debug file name from given |document_name| and |extension|. |
| + // Returns empty |base::FilePath| if debug dumps is not enabled. |
| + static base::FilePath CreateDebugDumpPath(const base::string16& document_name, |
| + const std::string& extension); |
| + |
| + // Dump data on FILE thread if debug dumps enabled. |
|
Lei Zhang
2014/06/11 21:43:42
- Update the comment if you use GetBlockingPool().
Vitaly Buka (NO REVIEWS)
2014/06/11 22:22:58
Done.
|
| + void DebugDumpData(const base::RefCountedMemory* data, |
| + const std::string& extension); |
| private: |
| friend class base::RefCountedThreadSafe<PrintedDocument>; |
| @@ -138,15 +147,17 @@ class PRINTING_EXPORT PrintedDocument |
| // any lock held. This is because it can't be changed after the object's |
| // construction. |
| struct Immutable { |
| - Immutable(const PrintSettings& settings, PrintedPagesSource* source, |
| - int cookie); |
| + Immutable(const PrintSettings& settings, |
| + PrintedPagesSource* source, |
| + int cookie, |
| + base::TaskRunner* file_runner); |
| ~Immutable(); |
| // Print settings used to generate this document. Immutable. |
| PrintSettings settings_; |
| - // Native thread for the render source. |
| - base::MessageLoop* source_message_loop_; |
| + // Native thread for file operations. |
| + scoped_refptr<base::TaskRunner> file_runner_; |
| // Document name. Immutable. |
| base::string16 name_; |
| @@ -160,8 +171,6 @@ class PRINTING_EXPORT PrintedDocument |
| int cookie_; |
| }; |
| - void DebugDump(const PrintedPage& page); |
| - |
| // All writable data member access must be guarded by this lock. Needs to be |
| // mutable since it can be acquired from const member functions. |
| mutable base::Lock lock_; |