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

Unified Diff: printing/printed_document.h

Issue 329683002: Improvements in --debug-print switch implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Wed 06/11/2014 14:29:57.35 Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
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_;

Powered by Google App Engine
This is Rietveld 408576698