Index: src/core/SkData.cpp |
diff --git a/src/core/SkData.cpp b/src/core/SkData.cpp |
index ea2da3dae462c74f2bba68a9af8fba80329ea647..995a30a542470e6bd37e7f9cd08d5d6cb9ab45fc 100644 |
--- a/src/core/SkData.cpp |
+++ b/src/core/SkData.cpp |
@@ -7,7 +7,7 @@ |
#include "SkData.h" |
#include "SkOSFile.h" |
-#include "SkOnce.h" |
+#include "SkOncePtr.h" |
#include "SkReadBuffer.h" |
#include "SkStream.h" |
#include "SkWriteBuffer.h" |
@@ -80,12 +80,10 @@ |
/////////////////////////////////////////////////////////////////////////////// |
+SK_DECLARE_STATIC_ONCE_PTR(SkData, gEmpty); |
sk_sp<SkData> SkData::MakeEmpty() { |
- static SkOnce once; |
- static SkData* empty; |
- |
- once([]{ empty = new SkData(nullptr, 0, nullptr, nullptr); }); |
- return sk_ref_sp(empty); |
+ SkData* data = SkRef(gEmpty.get([]{return new SkData(nullptr, 0, nullptr, nullptr); })); |
+ return sk_sp<SkData>(data); |
} |
// assumes fPtr was allocated via sk_malloc |