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

Unified Diff: src/core/SkData.cpp

Issue 1953533002: SkOncePtr -> SkOnce (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: hide sk_num_cores() Created 4 years, 7 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 | « src/core/SkColorSpace.cpp ('k') | src/core/SkFontMgr.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 995a30a542470e6bd37e7f9cd08d5d6cb9ab45fc..ea2da3dae462c74f2bba68a9af8fba80329ea647 100644
--- a/src/core/SkData.cpp
+++ b/src/core/SkData.cpp
@@ -7,7 +7,7 @@
#include "SkData.h"
#include "SkOSFile.h"
-#include "SkOncePtr.h"
+#include "SkOnce.h"
#include "SkReadBuffer.h"
#include "SkStream.h"
#include "SkWriteBuffer.h"
@@ -80,10 +80,12 @@ sk_sp<SkData> SkData::PrivateNewWithCopy(const void* srcOrNull, size_t length) {
///////////////////////////////////////////////////////////////////////////////
-SK_DECLARE_STATIC_ONCE_PTR(SkData, gEmpty);
sk_sp<SkData> SkData::MakeEmpty() {
- SkData* data = SkRef(gEmpty.get([]{return new SkData(nullptr, 0, nullptr, nullptr); }));
- return sk_sp<SkData>(data);
+ static SkOnce once;
+ static SkData* empty;
+
+ once([]{ empty = new SkData(nullptr, 0, nullptr, nullptr); });
+ return sk_ref_sp(empty);
}
// assumes fPtr was allocated via sk_malloc
« no previous file with comments | « src/core/SkColorSpace.cpp ('k') | src/core/SkFontMgr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698