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

Side by Side Diff: components/printing/renderer/print_render_frame_helper_pdf_win.cc

Issue 2920013002: Use pdf compositor service for printing when OOPIF is enabled
Patch Set: rebase Created 3 years, 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_render_frame_helper.h" 5 #include "components/printing/renderer/print_render_frame_helper.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/process/process_handle.h" 10 #include "base/process/process_handle.h"
11 #include "components/printing/common/print_messages.h" 11 #include "components/printing/common/print_messages.h"
12 #include "printing/features/features.h" 12 #include "printing/features/features.h"
13 #include "printing/metafile_skia_wrapper.h" 13 #include "printing/metafile_skia_wrapper.h"
14 14
15 namespace printing { 15 namespace printing {
16 16
17 #if BUILDFLAG(ENABLE_BASIC_PRINTING) 17 #if BUILDFLAG(ENABLE_BASIC_PRINTING)
18 bool PrintRenderFrameHelper::PrintPagesNative(blink::WebLocalFrame* frame, 18 bool PrintRenderFrameHelper::PrintPagesNative(blink::WebLocalFrame* frame,
19 int page_count) { 19 int page_count) {
20 const PrintMsg_PrintPages_Params& params = *print_pages_params_; 20 const PrintMsg_PrintPages_Params& params = *print_pages_params_;
21 std::vector<int> printed_pages = GetPrintedPages(params, page_count); 21 std::vector<int> printed_pages = GetPrintedPages(params, page_count);
22 if (printed_pages.empty()) 22 if (printed_pages.empty())
23 return false; 23 return false;
24 24
25 std::vector<gfx::Size> page_size_in_dpi(printed_pages.size()); 25 std::vector<gfx::Size> page_size_in_dpi(printed_pages.size());
26 std::vector<gfx::Rect> content_area_in_dpi(printed_pages.size()); 26 std::vector<gfx::Rect> content_area_in_dpi(printed_pages.size());
27 std::vector<gfx::Rect> printable_area_in_dpi(printed_pages.size()); 27 std::vector<gfx::Rect> printable_area_in_dpi(printed_pages.size());
28 28
29 PdfMetafileSkia metafile(PDF_SKIA_DOCUMENT_TYPE); 29 PdfMetafileSkia metafile(params.params.printed_doc_type);
30 CHECK(metafile.Init()); 30 CHECK(metafile.Init());
31 31
32 for (size_t i = 0; i < printed_pages.size(); ++i) { 32 for (size_t i = 0; i < printed_pages.size(); ++i) {
33 PrintPageInternal(params.params, printed_pages[i], page_count, frame, 33 PrintPageInternal(params.params, printed_pages[i], page_count, frame,
34 &metafile, &page_size_in_dpi[i], &content_area_in_dpi[i], 34 &metafile, &page_size_in_dpi[i], &content_area_in_dpi[i],
35 &printable_area_in_dpi[i]); 35 &printable_area_in_dpi[i]);
36 } 36 }
37 37
38 // blink::printEnd() for PDF should be called before metafile is closed. 38 // blink::printEnd() for PDF should be called before metafile is closed.
39 FinishFramePrinting(); 39 FinishFramePrinting();
(...skipping 21 matching lines...) Expand all
61 // Send the rest of the pages with an invalid metafile handle. 61 // Send the rest of the pages with an invalid metafile handle.
62 // TODO(erikchen): Fix semantics. See https://crbug.com/640840 62 // TODO(erikchen): Fix semantics. See https://crbug.com/640840
63 if (printed_page_params.metafile_data_handle.IsValid()) 63 if (printed_page_params.metafile_data_handle.IsValid())
64 printed_page_params.metafile_data_handle = base::SharedMemoryHandle(); 64 printed_page_params.metafile_data_handle = base::SharedMemoryHandle();
65 } 65 }
66 return true; 66 return true;
67 } 67 }
68 #endif // BUILDFLAG(ENABLE_BASIC_PRINTING) 68 #endif // BUILDFLAG(ENABLE_BASIC_PRINTING)
69 69
70 } // namespace printing 70 } // namespace printing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698