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

Unified Diff: printing/pdf_metafile_cg_mac.cc

Issue 8487001: Remove 13 exit time constructors and 3 static initializers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « printing/backend/print_backend_cups.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: printing/pdf_metafile_cg_mac.cc
diff --git a/printing/pdf_metafile_cg_mac.cc b/printing/pdf_metafile_cg_mac.cc
index 724d81499d8fcd977a185946b889a50bf855c976..ec4b51d242aba0969c10863206265013558d3cdd 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);
}
}
« no previous file with comments | « printing/backend/print_backend_cups.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698