From 101cd90d376af32016848169ea923da12067f4bb Mon Sep 17 00:00:00 2001 From: Tomas Rycl Date: Thu, 19 Apr 2018 15:38:51 +0200 Subject: [PATCH] More pdf printing fixes for Windows --- .../chrome/browser/printing/pdf_to_emf_converter.cc | 7 ++++++- chromium_src/chrome/utility/printing_handler_win.cc | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/chromium_src/chrome/browser/printing/pdf_to_emf_converter.cc b/chromium_src/chrome/browser/printing/pdf_to_emf_converter.cc index 878d874ea444..cd5fef18c1fd 100644 --- a/chromium_src/chrome/browser/printing/pdf_to_emf_converter.cc +++ b/chromium_src/chrome/browser/printing/pdf_to_emf_converter.cc @@ -38,6 +38,11 @@ namespace printing { namespace { +void CloseFileOnBlockingTaskRunner(base::File temp_file) { +base::AssertBlockingAllowed(); +temp_file.Close(); +} + class PdfConverterImpl; // Allows to delete temporary directory after all temporary files created inside @@ -71,7 +76,7 @@ class TempFile { explicit TempFile(base::File file) : file_(std::move(file)), blocking_task_runner_(base::SequencedTaskRunnerHandle::Get()) { - base::ThreadRestrictions::AssertIOAllowed(); + base::AssertBlockingAllowed(); } ~TempFile() { blocking_task_runner_->PostTask( diff --git a/chromium_src/chrome/utility/printing_handler_win.cc b/chromium_src/chrome/utility/printing_handler_win.cc index 038cf75ad2e0..585259919fbb 100644 --- a/chromium_src/chrome/utility/printing_handler_win.cc +++ b/chromium_src/chrome/utility/printing_handler_win.cc @@ -156,7 +156,7 @@ bool PrintingHandlerWin::RenderPdfPageToMetafile(int page_number, if (!chrome_pdf::RenderPDFPageToDC( &pdf_data_.front(), pdf_data_.size(), page_number, metafile.context(), - pdf_rendering_settings_.dpi, + pdf_rendering_settings_.dpi.width(), pdf_rendering_settings_.dpi.height(), pdf_rendering_settings_.area.x() - offset_x, pdf_rendering_settings_.area.y() - offset_y, pdf_rendering_settings_.area.width(),