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

Side by Side Diff: components/printing/renderer/print_web_view_helper_mac.mm

Issue 2653963002: [Experimental] Supporting OOPIF printing
Patch Set: Rename service, fix for webview, and connect to DiscardableMemoryManager Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/printing/renderer/print_web_view_helper.h" 5 #include "components/printing/renderer/print_web_view_helper.h"
6 6
7 #import <AppKit/AppKit.h> 7 #import <AppKit/AppKit.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/scoped_nsautorelease_pool.h" 10 #include "base/mac/scoped_nsautorelease_pool.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 CHECK(metafile.Init()); 46 CHECK(metafile.Init());
47 47
48 int page_number = params.page_number; 48 int page_number = params.page_number;
49 gfx::Size page_size_in_dpi; 49 gfx::Size page_size_in_dpi;
50 gfx::Rect content_area_in_dpi; 50 gfx::Rect content_area_in_dpi;
51 RenderPage(print_pages_params_->params, page_number, frame, false, &metafile, 51 RenderPage(print_pages_params_->params, page_number, frame, false, &metafile,
52 &page_size_in_dpi, &content_area_in_dpi); 52 &page_size_in_dpi, &content_area_in_dpi);
53 metafile.FinishDocument(); 53 metafile.FinishDocument();
54 54
55 PrintHostMsg_DidPrintPage_Params page_params; 55 PrintHostMsg_DidPrintPage_Params page_params;
56 page_params.data_size = metafile.GetDataSize();
57 page_params.page_number = page_number; 56 page_params.page_number = page_number;
58 page_params.document_cookie = params.params.document_cookie; 57 page_params.document_cookie = params.params.document_cookie;
59 page_params.page_size = page_size_in_dpi; 58 page_params.page_size = page_size_in_dpi;
60 page_params.content_area = content_area_in_dpi; 59 page_params.content_area = content_area_in_dpi;
61 60
62 // Ask the browser to create the shared memory for us. 61 // Ask the browser to create the shared memory for us.
63 if (!CopyMetafileDataToSharedMem(metafile, 62 if (!CopyMetafileDataToSharedMem(metafile, &page_params)) {
64 &(page_params.metafile_data_handle))) {
65 // TODO(thestig): Fail and return false instead. 63 // TODO(thestig): Fail and return false instead.
66 page_params.data_size = 0; 64 page_params.data_size = 0;
67 } 65 }
68 66
69 Send(new PrintHostMsg_DidPrintPage(routing_id(), page_params)); 67 Send(new PrintHostMsg_DidPrintPage(routing_id(), page_params));
70 } 68 }
71 69
72 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) 70 #if BUILDFLAG(ENABLE_PRINT_PREVIEW)
73 bool PrintWebViewHelper::RenderPreviewPage( 71 bool PrintWebViewHelper::RenderPreviewPage(
74 int page_number, 72 int page_number,
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) 150 #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW)
153 RenderPageContent(frame, page_number, canvas_area, content_area, 151 RenderPageContent(frame, page_number, canvas_area, content_area,
154 scale_factor, static_cast<blink::WebCanvas*>(canvas)); 152 scale_factor, static_cast<blink::WebCanvas*>(canvas));
155 } 153 }
156 154
157 // Done printing. Close the device context to retrieve the compiled metafile. 155 // Done printing. Close the device context to retrieve the compiled metafile.
158 metafile->FinishPage(); 156 metafile->FinishPage();
159 } 157 }
160 158
161 } // namespace printing 159 } // namespace printing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698