diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-07 06:03:30 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-07 06:03:30 +0000 |
commit | 26430024d4ba899f13140334e0311f8b586557fa (patch) | |
tree | 64e154a9c5e5ee37642340f303531af76e56e3c2 /printing/pdf_metafile_cg_mac.cc | |
parent | 5a4c3f5564f8870edca6be511b33f5c38c599c94 (diff) | |
download | chromium_src-26430024d4ba899f13140334e0311f8b586557fa.zip chromium_src-26430024d4ba899f13140334e0311f8b586557fa.tar.gz chromium_src-26430024d4ba899f13140334e0311f8b586557fa.tar.bz2 |
Remove 13 exit time constructors and 3 static initializers
BUG=101600,94925
TEST=none
TBR=vandebo,viettrungluu
Review URL: http://codereview.chromium.org/8487001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108838 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing/pdf_metafile_cg_mac.cc')
-rw-r--r-- | printing/pdf_metafile_cg_mac.cc | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/printing/pdf_metafile_cg_mac.cc b/printing/pdf_metafile_cg_mac.cc index 724d814..ec4b51d 100644 --- a/printing/pdf_metafile_cg_mac.cc +++ b/printing/pdf_metafile_cg_mac.cc @@ -5,6 +5,7 @@ #include "printing/pdf_metafile_cg_mac.h" #include "base/file_path.h" +#include "base/lazy_instance.h" #include "base/logging.h" #include "base/mac/mac_util.h" #include "base/mac/scoped_cftyperef.h" @@ -34,7 +35,10 @@ namespace { // single-process mode. TODO(avi): This Apple bug appears fixed in 10.7; when // 10.7 is the minimum required version for Chromium, remove this hack. -base::ThreadLocalPointer<struct __CFSet> thread_pdf_docs; +base::LazyInstance< + base::ThreadLocalPointer<struct __CFSet>, + base::LeakyLazyInstanceTraits<base::ThreadLocalPointer<struct __CFSet> > > + thread_pdf_docs(base::LINKER_INITIALIZED); } // namespace @@ -43,24 +47,24 @@ namespace printing { PdfMetafileCg::PdfMetafileCg() : page_is_open_(false), thread_pdf_docs_owned_(false) { - if (!thread_pdf_docs.Get() && base::mac::IsOSSnowLeopardOrEarlier()) { + if (!thread_pdf_docs.Pointer()->Get() && + base::mac::IsOSSnowLeopardOrEarlier()) { thread_pdf_docs_owned_ = true; - thread_pdf_docs.Set(CFSetCreateMutable(kCFAllocatorDefault, - 0, - &kCFTypeSetCallBacks)); + thread_pdf_docs.Pointer()->Set( + CFSetCreateMutable(kCFAllocatorDefault, 0, &kCFTypeSetCallBacks)); } } PdfMetafileCg::~PdfMetafileCg() { DCHECK(thread_checker_.CalledOnValidThread()); - if (pdf_doc_ && thread_pdf_docs.Get()) { + if (pdf_doc_ && thread_pdf_docs.Pointer()->Get()) { // Transfer ownership to the pool. - CFSetAddValue(thread_pdf_docs.Get(), pdf_doc_); + CFSetAddValue(thread_pdf_docs.Pointer()->Get(), pdf_doc_); } if (thread_pdf_docs_owned_) { - CFRelease(thread_pdf_docs.Get()); - thread_pdf_docs.Set(NULL); + CFRelease(thread_pdf_docs.Pointer()->Get()); + thread_pdf_docs.Pointer()->Set(NULL); } } |