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

Unified Diff: src/pdf/SkPDFShader.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/pdf/SkPDFGraphicState.cpp ('k') | src/utils/SkEventTracer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFShader.cpp
diff --git a/src/pdf/SkPDFShader.cpp b/src/pdf/SkPDFShader.cpp
index 645091dad2fe33b3d82a84fe8a728d37232989c4..fe6e47c1db0f049307969097919a9426c72788c8 100644
--- a/src/pdf/SkPDFShader.cpp
+++ b/src/pdf/SkPDFShader.cpp
@@ -10,6 +10,7 @@
#include "SkPDFShader.h"
#include "SkData.h"
+#include "SkOncePtr.h"
#include "SkPDFCanon.h"
#include "SkPDFDevice.h"
#include "SkPDFFormXObject.h"
@@ -677,8 +678,7 @@ static bool split_perspective(const SkMatrix in, SkMatrix* affine,
return true;
}
-namespace {
-SkPDFObject* create_range_object() {
+static SkPDFObject* create_range_object() {
SkPDFArray* range = new SkPDFArray;
range->reserve(6);
range->appendInt(0);
@@ -689,12 +689,7 @@ SkPDFObject* create_range_object() {
range->appendInt(1);
return range;
}
-
-template <typename T> void unref(T* ptr) { ptr->unref();}
-} // namespace
-
-SK_DECLARE_STATIC_LAZY_PTR(SkPDFObject, rangeObject,
- create_range_object, unref<SkPDFObject>);
+SK_DECLARE_STATIC_ONCE_PTR(SkPDFObject, rangeObject);
static SkPDFStream* make_ps_function(const SkString& psCode,
SkPDFArray* domain) {
@@ -703,7 +698,7 @@ static SkPDFStream* make_ps_function(const SkString& psCode,
SkPDFStream* result = new SkPDFStream(funcData.get());
result->insertInt("FunctionType", 4);
result->insertObject("Domain", SkRef(domain));
- result->insertObject("Range", SkRef(rangeObject.get()));
+ result->insertObject("Range", SkRef(rangeObject.get(create_range_object)));
return result;
}
« no previous file with comments | « src/pdf/SkPDFGraphicState.cpp ('k') | src/utils/SkEventTracer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698