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

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

Issue 21039: Revert my change to get the tree green. Not sure why the tests became flaky.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 11 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/print_view_manager.h ('k') | chrome/browser/renderer_host/render_view_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/printing/print_view_manager.cc
===================================================================
--- chrome/browser/printing/print_view_manager.cc (revision 9131)
+++ chrome/browser/printing/print_view_manager.cc (working copy)
@@ -27,6 +27,7 @@
waiting_to_print_(false),
inside_inner_message_loop_(false),
waiting_to_show_print_dialog_(false) {
+ memset(&print_params_, 0, sizeof(print_params_));
}
PrintViewManager::~PrintViewManager() {
@@ -239,6 +240,25 @@
void PrintViewManager::OnNotifyPrintJobInitEvent(
const JobEventDetails& event_details) {
+ ViewMsg_Print_Params old_print_params(print_params_);
+
+ // Backup the print settings relevant to the renderer.
+ DCHECK_EQ(print_job_->document(), event_details.document());
+ event_details.document()->settings().RenderParams(&print_params_);
+ print_params_.document_cookie = event_details.document()->cookie();
+ DCHECK_GT(print_params_.document_cookie, 0);
+
+ // If settings changed
+ DCHECK(owner_.render_view_host());
+ // Equals() doesn't compare the cookie value.
+ if (owner_.render_view_host() &&
+ owner_.render_view_host()->IsRenderViewLive() &&
+ (!old_print_params.Equals(print_params_) ||
+ !event_details.document()->page_count())) {
+ // TODO(maruel): Will never happen, this code is about to be deleted.
+ NOTREACHED();
+ }
+
// Continue even if owner_.render_view_host() is dead because we may already
// have buffered all the necessary pages.
switch (event_details.type()) {
@@ -440,6 +460,7 @@
print_job_->DisconnectSource();
// Don't close the worker thread.
print_job_ = NULL;
+ memset(&print_params_, 0, sizeof(print_params_));
}
void PrintViewManager::PrintNowInternal() {
« no previous file with comments | « chrome/browser/printing/print_view_manager.h ('k') | chrome/browser/renderer_host/render_view_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698