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

Unified Diff: src/core/SkMiniRecorder.cpp

Issue 1949313003: Reland of SkOncePtr -> SkOnce (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/SkMessageBus.h ('k') | src/core/SkPathRef.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkMiniRecorder.cpp
diff --git a/src/core/SkMiniRecorder.cpp b/src/core/SkMiniRecorder.cpp
index 2d5b0943e58eb646e767d782017bcc431d67449f..378f4304b392d682038362cede3babc698d04b3f 100644
--- a/src/core/SkMiniRecorder.cpp
+++ b/src/core/SkMiniRecorder.cpp
@@ -8,7 +8,7 @@
#include "SkCanvas.h"
#include "SkTLazy.h"
#include "SkMiniRecorder.h"
-#include "SkOncePtr.h"
+#include "SkOnce.h"
#include "SkPicture.h"
#include "SkPictureCommon.h"
#include "SkRecordDraw.h"
@@ -27,7 +27,6 @@
int numSlowPaths() const override { return 0; }
bool willPlayBackBitmaps() const override { return false; }
};
-SK_DECLARE_STATIC_ONCE_PTR(SkEmptyPicture, gEmptyPicture);
template <typename T>
class SkMiniPicture final : public SkPicture {
@@ -107,8 +106,13 @@
fState = State::kEmpty; \
return sk_make_sp<SkMiniPicture<Type>>(cull, reinterpret_cast<Type*>(fBuffer.get()))
+ static SkOnce once;
+ static SkPicture* empty;
+
switch (fState) {
- case State::kEmpty: return sk_ref_sp(gEmptyPicture.get([]{ return new SkEmptyPicture; }));
+ case State::kEmpty:
+ once([]{ empty = new SkEmptyPicture; });
+ return sk_ref_sp(empty);
CASE(DrawBitmapRectFixedSize);
CASE(DrawPath);
CASE(DrawRect);
« no previous file with comments | « src/core/SkMessageBus.h ('k') | src/core/SkPathRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698