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

Unified Diff: chrome/renderer/printing/print_web_view_helper.cc

Issue 427723004: Fix for race condition where print preview hangs when attempting to print a PDF that hasn't loaded. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved |request_print_preview_closure_| into the switch statement. Created 6 years, 5 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/renderer/printing/print_web_view_helper.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/printing/print_web_view_helper.cc
diff --git a/chrome/renderer/printing/print_web_view_helper.cc b/chrome/renderer/printing/print_web_view_helper.cc
index 777eb69fa183c52236578b34969c60e803511b5e..868a72bce48431d29d49235a4b968874ca169442 100644
--- a/chrome/renderer/printing/print_web_view_helper.cc
+++ b/chrome/renderer/printing/print_web_view_helper.cc
@@ -820,7 +820,12 @@ void PrintWebViewHelper::DidStartLoading() {
void PrintWebViewHelper::DidStopLoading() {
is_loading_ = false;
- ShowScriptedPrintPreview();
+ if (request_print_preview_closure_.is_null()) {
+ ShowScriptedPrintPreview();
Vitaly Buka (NO REVIEWS) 2014/08/05 06:05:06 please remove ShowScriptedPrintPreview() from here
ivandavid 2014/08/05 19:30:17 Done.
+ } else {
+ request_print_preview_closure_.Run();
+ request_print_preview_closure_.Reset();
+ }
}
// Prints |frame| which called window.print().
@@ -1725,6 +1730,17 @@ void PrintWebViewHelper::RequestPrintPreview(PrintPreviewRequestType type) {
return;
}
case PRINT_PREVIEW_USER_INITIATED_ENTIRE_FRAME: {
ivandavid 2014/07/29 20:02:51 I encountered a similar problem to the one describ
Vitaly Buka (NO REVIEWS) 2014/08/05 05:49:57 My understanding is that it's by design. is_loadin
ivandavid 2014/08/05 19:30:17 Done.
+ // If |is_loading_| is true and the function proceeds, Print Preview will
+ // hang. Save |type| and call this function when DidStopLoading() is
+ // called, ie. right when |is_loading_| is set to false.
+ if (is_loading_) {
+ request_print_preview_closure_ =
+ base::Bind(&PrintWebViewHelper::RequestPrintPreview,
+ base::Unretained(this),
+ type);
+ return;
+ }
+
break;
}
case PRINT_PREVIEW_USER_INITIATED_SELECTION: {
« no previous file with comments | « chrome/renderer/printing/print_web_view_helper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698