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

Unified Diff: src/core/SkData.cpp

Issue 1322933005: Port uses of SkLazyPtr to SkOncePtr. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: name Created 5 years, 3 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/SkColorTable.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 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
« no previous file with comments | « src/core/SkColorTable.cpp ('k') | src/core/SkFontMgr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698