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/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 thread_pdf_docs = LAZY_INSTANCE_INITIALIZER; | 41 thread_pdf_docs = LAZY_INSTANCE_INITIALIZER; |
42 | 42 |
43 } // namespace | 43 } // namespace |
44 | 44 |
45 namespace printing { | 45 namespace printing { |
46 | 46 |
47 PdfMetafileCg::PdfMetafileCg() | 47 PdfMetafileCg::PdfMetafileCg() |
48 : page_is_open_(false), | 48 : page_is_open_(false), |
49 thread_pdf_docs_owned_(false) { | 49 thread_pdf_docs_owned_(false) { |
50 if (!thread_pdf_docs.Pointer()->Get() && | 50 if (!thread_pdf_docs.Pointer()->Get() && |
51 base::mac::IsOSSnowLeopardOrEarlier()) { | 51 base::mac::IsOSSnowLeopard()) { |
52 thread_pdf_docs_owned_ = true; | 52 thread_pdf_docs_owned_ = true; |
53 thread_pdf_docs.Pointer()->Set( | 53 thread_pdf_docs.Pointer()->Set( |
54 CFSetCreateMutable(kCFAllocatorDefault, 0, &kCFTypeSetCallBacks)); | 54 CFSetCreateMutable(kCFAllocatorDefault, 0, &kCFTypeSetCallBacks)); |
55 } | 55 } |
56 } | 56 } |
57 | 57 |
58 PdfMetafileCg::~PdfMetafileCg() { | 58 PdfMetafileCg::~PdfMetafileCg() { |
59 DCHECK(thread_checker_.CalledOnValidThread()); | 59 DCHECK(thread_checker_.CalledOnValidThread()); |
60 if (pdf_doc_ && thread_pdf_docs.Pointer()->Get()) { | 60 if (pdf_doc_ && thread_pdf_docs.Pointer()->Get()) { |
61 // Transfer ownership to the pool. | 61 // Transfer ownership to the pool. |
(...skipping 248 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 |