OLD | NEW |
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 "printing/pdf_metafile_cg_mac.h" | 5 #include "printing/pdf_metafile_cg_mac.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/mac/mac_util.h" | 12 #include "base/mac/mac_util.h" |
13 #include "base/mac/scoped_cftyperef.h" | 13 #include "base/mac/scoped_cftyperef.h" |
14 #include "base/strings/sys_string_conversions.h" | 14 #include "base/strings/sys_string_conversions.h" |
15 #include "base/threading/thread_local.h" | 15 #include "base/threading/thread_local.h" |
16 #include "ui/gfx/rect.h" | 16 #include "ui/gfx/rect.h" |
17 #include "ui/gfx/size.h" | 17 #include "ui/gfx/size.h" |
18 | 18 |
19 using base::mac::ScopedCFTypeRef; | 19 using base::ScopedCFTypeRef; |
20 | 20 |
21 namespace { | 21 namespace { |
22 | 22 |
23 // What is up with this ugly hack? <http://crbug.com/64641>, that's what. | 23 // What is up with this ugly hack? <http://crbug.com/64641>, that's what. |
24 // The bug: Printing certain PDFs crashes. The cause: When printing, the | 24 // The bug: Printing certain PDFs crashes. The cause: When printing, the |
25 // renderer process assembles pages one at a time, in PDF format, to send to the | 25 // renderer process assembles pages one at a time, in PDF format, to send to the |
26 // browser process. When printing a PDF, the PDF plugin returns output in PDF | 26 // browser process. When printing a PDF, the PDF plugin returns output in PDF |
27 // format. There is a bug in 10.5 and 10.6 (<rdar://9018916>, | 27 // format. There is a bug in 10.5 and 10.6 (<rdar://9018916>, |
28 // <http://www.openradar.me/9018916>) where reference counting is broken when | 28 // <http://www.openradar.me/9018916>) where reference counting is broken when |
29 // drawing certain PDFs into PDF contexts. So at the high-level, a PdfMetafileCg | 29 // drawing certain PDFs into PDF contexts. So at the high-level, a PdfMetafileCg |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 | 310 |
311 if (!pdf_doc_.get()) { | 311 if (!pdf_doc_.get()) { |
312 ScopedCFTypeRef<CGDataProviderRef> pdf_data_provider( | 312 ScopedCFTypeRef<CGDataProviderRef> pdf_data_provider( |
313 CGDataProviderCreateWithCFData(pdf_data_)); | 313 CGDataProviderCreateWithCFData(pdf_data_)); |
314 pdf_doc_.reset(CGPDFDocumentCreateWithProvider(pdf_data_provider)); | 314 pdf_doc_.reset(CGPDFDocumentCreateWithProvider(pdf_data_provider)); |
315 } | 315 } |
316 return pdf_doc_.get(); | 316 return pdf_doc_.get(); |
317 } | 317 } |
318 | 318 |
319 } // namespace printing | 319 } // namespace printing |
OLD | NEW |