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

Unified Diff: src/core/SkData.cpp

Issue 651723003: Require SK_DECLARE_STATIC_LAZY_PTR is used in global scope. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: safe unref Created 6 years, 2 months 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 | « include/ports/SkRemotableFontMgr.h ('k') | src/core/SkFontHost.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkData.cpp
diff --git a/src/core/SkData.cpp b/src/core/SkData.cpp
index 11cab7e98be73388c67bfecc2845dd8c1278ea92..c5d10775f8024cad028c69dbb7e107325c157586 100644
--- a/src/core/SkData.cpp
+++ b/src/core/SkData.cpp
@@ -92,14 +92,13 @@ SkData* SkData::PrivateNewWithCopy(const void* srcOrNull, size_t length) {
///////////////////////////////////////////////////////////////////////////////
-SkData* SkData::NewEmptyImpl() {
- return new SkData(NULL, 0, NULL, NULL);
-}
+// As a template argument these must have external linkage.
+SkData* sk_new_empty_data() { return new SkData(NULL, 0, NULL, NULL); }
+namespace { void sk_unref_data(SkData* ptr) { return SkSafeUnref(ptr); } }
-void SkData::DeleteEmpty(SkData* ptr) { SkDELETE(ptr); }
+SK_DECLARE_STATIC_LAZY_PTR(SkData, empty, sk_new_empty_data, sk_unref_data);
SkData* SkData::NewEmpty() {
- SK_DECLARE_STATIC_LAZY_PTR(SkData, empty, NewEmptyImpl, DeleteEmpty);
return SkRef(empty.get());
}
« no previous file with comments | « include/ports/SkRemotableFontMgr.h ('k') | src/core/SkFontHost.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698