Commit 99bb78d3 authored by Lei Zhang's avatar Lei Zhang Committed by Commit Bot

Clean up bits of PrintedDocument.

Change-Id: I75500b5732b6d7d4bd7bd8aad4de12646ea789c5
Reviewed-on: https://chromium-review.googlesource.com/1043253Reviewed-by: default avatarRebekah Potter <rbpotter@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#556129}
parent 69239a68
...@@ -377,9 +377,7 @@ void PrintJobWorker::OnNewPage() { ...@@ -377,9 +377,7 @@ void PrintJobWorker::OnNewPage() {
// Find first page to print. // Find first page to print.
int page_count = document_->page_count(); int page_count = document_->page_count();
if (!page_count) { if (!page_count) {
// We still don't know how many pages the document contains. We can't // We still don't know how many pages the document contains.
// start to print the document yet since the header/footer may refer to
// the document's page count.
return; return;
} }
// We have enough information to initialize page_number_. // We have enough information to initialize page_number_.
......
...@@ -114,14 +114,9 @@ PrintedDocument::PrintedDocument(const PrintSettings& settings, ...@@ -114,14 +114,9 @@ PrintedDocument::PrintedDocument(const PrintSettings& settings,
const base::string16& name, const base::string16& name,
int cookie) int cookie)
: immutable_(settings, name, cookie) { : immutable_(settings, name, cookie) {
// Records the expected page count if a range is setup. // If there is a range, set the number of page
if (!settings.ranges().empty()) { for (const PageRange& range : settings.ranges())
// If there is a range, set the number of page mutable_.expected_page_count_ += range.to - range.from + 1;
for (unsigned i = 0; i < settings.ranges().size(); ++i) {
const PageRange& range = settings.ranges()[i];
mutable_.expected_page_count_ += range.to - range.from + 1;
}
}
if (HasDebugDumpPath()) if (HasDebugDumpPath())
DebugDumpSettings(name, settings); DebugDumpSettings(name, settings);
......
...@@ -91,7 +91,7 @@ class PRINTING_EXPORT PrintedDocument ...@@ -91,7 +91,7 @@ class PRINTING_EXPORT PrintedDocument
// Note: locks for a short amount of time. // Note: locks for a short amount of time.
void set_page_count(int max_page); void set_page_count(int max_page);
// Number of pages in the document. Used for headers/footers. // Number of pages in the document.
// Note: locks for a short amount of time. // Note: locks for a short amount of time.
int page_count() const; int page_count() const;
...@@ -136,10 +136,10 @@ class PRINTING_EXPORT PrintedDocument ...@@ -136,10 +136,10 @@ class PRINTING_EXPORT PrintedDocument
private: private:
friend class base::RefCountedThreadSafe<PrintedDocument>; friend class base::RefCountedThreadSafe<PrintedDocument>;
virtual ~PrintedDocument(); ~PrintedDocument();
// Array of data for each print previewed page. // Array of data for each print previewed page.
typedef std::map<int, scoped_refptr<PrintedPage> > PrintedPages; using PrintedPages = std::map<int, scoped_refptr<PrintedPage>>;
// Contains all the mutable stuff. All this stuff MUST be accessed with the // Contains all the mutable stuff. All this stuff MUST be accessed with the
// lock held. // lock held.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment