diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-15 20:08:44 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-15 20:08:44 +0000 |
commit | 413c52fb9b62a4db978727d0e353ffd12c44a46c (patch) | |
tree | e42ade0b70097364468030c3d619a8b00a3550f4 /chrome/renderer | |
parent | ad02e2f8c32af11fced8b53c60428f4d5e19bb70 (diff) | |
download | chromium_src-413c52fb9b62a4db978727d0e353ffd12c44a46c.zip chromium_src-413c52fb9b62a4db978727d0e353ffd12c44a46c.tar.gz chromium_src-413c52fb9b62a4db978727d0e353ffd12c44a46c.tar.bz2 |
Make code around CopyMetafileDataToSharedMem consistent.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6525008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74997 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/print_web_view_helper_mac.mm | 11 | ||||
-rw-r--r-- | chrome/renderer/print_web_view_helper_win.cc | 21 |
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( |