summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/renderer/print_web_view_helper_mac.mm11
-rw-r--r--chrome/renderer/print_web_view_helper_win.cc21
2 files changed, 15 insertions, 17 deletions
diff --git a/chrome/renderer/print_web_view_helper_mac.mm b/chrome/renderer/print_web_view_helper_mac.mm
index e013955..cc4a8d6 100644
--- a/chrome/renderer/print_web_view_helper_mac.mm
+++ b/chrome/renderer/print_web_view_helper_mac.mm
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -47,7 +47,7 @@ void PrintWebViewHelper::PrintPage(const ViewMsg_PrintPage_Params& params,
// Get the size of the compiled metafile.
ViewHostMsg_DidPrintPage_Params page_params;
- page_params.data_size = 0;
+ page_params.data_size = metafile.GetDataSize();
page_params.page_number = page_number;
page_params.document_cookie = params.params.document_cookie;
page_params.actual_shrink = scale_factor;
@@ -57,12 +57,10 @@ void PrintWebViewHelper::PrintPage(const ViewMsg_PrintPage_Params& params,
// Ask the browser to create the shared memory for us.
if (!CopyMetafileDataToSharedMem(&metafile,
- &(page_params.metafile_data_handle))) {
- NOTREACHED();
- return;
+ &(page_params.metafile_data_handle))) {
+ page_params.data_size = 0;
}
- page_params.data_size = metafile.GetDataSize();
Send(new ViewHostMsg_DidPrintPage(routing_id(), page_params));
}
@@ -111,7 +109,6 @@ void PrintWebViewHelper::CreatePreviewDocument(
if (!CopyMetafileDataToSharedMem(&metafile,
&(preview_params.metafile_data_handle))) {
preview_params.data_size = 0;
- NOTREACHED();
}
Send(new ViewHostMsg_PagesReadyForPreview(routing_id(), preview_params));
}
diff --git a/chrome/renderer/print_web_view_helper_win.cc b/chrome/renderer/print_web_view_helper_win.cc
index 7ebbb51..94fe479 100644
--- a/chrome/renderer/print_web_view_helper_win.cc
+++ b/chrome/renderer/print_web_view_helper_win.cc
@@ -91,7 +91,7 @@ void PrintWebViewHelper::PrintPage(const ViewMsg_PrintPage_Params& params,
DCHECK_GT(buf_size, 128u);
ViewHostMsg_DidPrintPage_Params page_params;
- page_params.data_size = 0;
+ page_params.data_size = buf_size;
page_params.metafile_data_handle = NULL;
page_params.page_number = page_number;
page_params.document_cookie = params.params.document_cookie;
@@ -102,17 +102,18 @@ void PrintWebViewHelper::PrintPage(const ViewMsg_PrintPage_Params& params,
params.params.printable_size.height());
page_params.has_visible_overlays = frame->isPageBoxVisible(page_number);
- if (CopyMetafileDataToSharedMem(metafile.get(),
- &(page_params.metafile_data_handle))) {
- page_params.data_size = buf_size;
+ if (!CopyMetafileDataToSharedMem(metafile.get(),
+ &(page_params.metafile_data_handle))) {
+ page_params.data_size = 0;
}
metafile->CloseEmf();
- if (Send(new ViewHostMsg_DuplicateSection(
+ if (!Send(new ViewHostMsg_DuplicateSection(
routing_id(),
page_params.metafile_data_handle,
&page_params.metafile_data_handle))) {
- Send(new ViewHostMsg_DidPrintPage(routing_id(), page_params));
+ NOTREACHED() << "Send message failed.";
}
+ Send(new ViewHostMsg_DidPrintPage(routing_id(), page_params));
}
void PrintWebViewHelper::CreatePreviewDocument(
@@ -167,12 +168,12 @@ void PrintWebViewHelper::CreatePreviewDocument(
ViewHostMsg_DidPreviewDocument_Params preview_params;
preview_params.document_cookie = params.params.document_cookie;
- preview_params.data_size = 0;
+ preview_params.data_size = buf_size;
preview_params.metafile_data_handle = NULL;
- if (CopyMetafileDataToSharedMem(metafile.get(),
- &(preview_params.metafile_data_handle))) {
- preview_params.data_size = buf_size;
+ if (!CopyMetafileDataToSharedMem(metafile.get(),
+ &(preview_params.metafile_data_handle))) {
+ preview_params.data_size = 0;
}
metafile->CloseEmf();
if (!Send(new ViewHostMsg_DuplicateSection(