Index: src/core/SkData.cpp |
diff --git a/src/core/SkData.cpp b/src/core/SkData.cpp |
index 017c397bbf71732b859a46acb398a1fc1607702d..9e65d2a32e28506b34282e1b8872619bff8e1c5d 100644 |
--- a/src/core/SkData.cpp |
+++ b/src/core/SkData.cpp |
@@ -6,8 +6,8 @@ |
*/ |
#include "SkData.h" |
+#include "SkLazyPtr.h" |
#include "SkOSFile.h" |
-#include "SkOncePtr.h" |
#include "SkReadBuffer.h" |
#include "SkStream.h" |
#include "SkWriteBuffer.h" |
@@ -80,9 +80,14 @@ |
/////////////////////////////////////////////////////////////////////////////// |
-SK_DECLARE_STATIC_ONCE_PTR(SkData, gEmpty); |
+// As a template argument these must have external linkage. |
+SkData* sk_new_empty_data() { return new SkData(nullptr, 0, nullptr, nullptr); } |
+namespace { void sk_unref_data(SkData* ptr) { return SkSafeUnref(ptr); } } |
+ |
+SK_DECLARE_STATIC_LAZY_PTR(SkData, empty, sk_new_empty_data, sk_unref_data); |
+ |
SkData* SkData::NewEmpty() { |
- return SkRef(gEmpty.get([]{return new SkData(nullptr, 0, nullptr, nullptr); })); |
+ return SkRef(empty.get()); |
} |
// assumes fPtr was allocated via sk_malloc |