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

Unified Diff: chrome/browser/printing/printed_document.cc

Issue 125082: Add Print Selection support to Chrome. This change is fairly involved since ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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
« no previous file with comments | « chrome/browser/printing/printed_document.h ('k') | chrome/browser/printing/win_printing_context.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/printing/printed_document.cc
===================================================================
--- chrome/browser/printing/printed_document.cc (revision 18804)
+++ chrome/browser/printing/printed_document.cc (working copy)
@@ -67,25 +67,14 @@
bool PrintedDocument::GetPage(int page_number,
scoped_refptr<PrintedPage>* page) {
- bool request = false;
- {
- AutoLock lock(lock_);
- PrintedPages::const_iterator itr = mutable_.pages_.find(page_number);
- if (itr != mutable_.pages_.end()) {
- if (itr->second.get()) {
- *page = itr->second;
- return true;
- }
- request = false;
- } else {
- request = true;
- // Force the creation to not repeatedly request the same page.
- mutable_.pages_[page_number];
+ AutoLock lock(lock_);
+ PrintedPages::const_iterator itr = mutable_.pages_.find(page_number);
+ if (itr != mutable_.pages_.end()) {
+ if (itr->second.get()) {
+ *page = itr->second;
+ return true;
}
}
- if (request) {
- PrintPage_ThreadJump(page_number);
- }
return false;
}
@@ -180,32 +169,6 @@
return true;
}
-bool PrintedDocument::RequestMissingPages() {
- typedef std::set<int> PageNumbers;
- PageNumbers missing_pages;
- {
- AutoLock lock(lock_);
- PageNumber page(immutable_.settings_, mutable_.page_count_);
- if (page == PageNumber::npos())
- return false;
- for (; page != PageNumber::npos(); ++page) {
- PrintedPage* printed_page = mutable_.pages_[page.ToInt()].get();
- if (!printed_page || !printed_page->emf())
- missing_pages.insert(page.ToInt());
- }
- }
- if (!missing_pages.size())
- return true;
- PageNumbers::const_iterator end = missing_pages.end();
- for (PageNumbers::const_iterator itr = missing_pages.begin();
- itr != end;
- ++itr) {
- int page_number = *itr;
- PrintPage_ThreadJump(page_number);
- }
- return true;
-}
-
void PrintedDocument::DisconnectSource() {
AutoLock lock(lock_);
mutable_.source_ = NULL;
@@ -334,20 +297,6 @@
DCHECK_NE(res, 0);
}
-void PrintedDocument::PrintPage_ThreadJump(int page_number) {
- if (MessageLoop::current() != immutable_.source_message_loop_) {
- immutable_.source_message_loop_->PostTask(FROM_HERE, NewRunnableMethod(
- this, &PrintedDocument::PrintPage_ThreadJump, page_number));
- } else {
- PrintedPagesSource* source = NULL;
- {
- AutoLock lock(lock_);
- source = mutable_.source_;
- }
- NOTREACHED();
- }
-}
-
PrintedDocument::Mutable::Mutable(PrintedPagesSource* source)
: source_(source),
expected_page_count_(0),
« no previous file with comments | « chrome/browser/printing/printed_document.h ('k') | chrome/browser/printing/win_printing_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698