Index: src/core/SkData.cpp |
diff --git a/src/core/SkData.cpp b/src/core/SkData.cpp |
index 9e65d2a32e28506b34282e1b8872619bff8e1c5d..017c397bbf71732b859a46acb398a1fc1607702d 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,14 +80,9 @@ SkData* SkData::PrivateNewWithCopy(const void* srcOrNull, size_t length) { |
/////////////////////////////////////////////////////////////////////////////// |
-// 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); |
- |
+SK_DECLARE_STATIC_ONCE_PTR(SkData, gEmpty); |
SkData* SkData::NewEmpty() { |
- return SkRef(empty.get()); |
+ return SkRef(gEmpty.get([]{return new SkData(nullptr, 0, nullptr, nullptr); })); |
} |
// assumes fPtr was allocated via sk_malloc |