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

Unified Diff: include/core/SkPathRef.h

Issue 26491003: SK_ONCE for SkData (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: dropped assert Created 7 years, 2 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 | « include/core/SkData.h ('k') | src/core/SkData.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkPathRef.h
diff --git a/include/core/SkPathRef.h b/include/core/SkPathRef.h
index 22287894d98cf698d617f90aac6b43bfe3c9e6be..d832944ec340a6a04c573aeb029a8ff5c9cc9dfd 100644
--- a/include/core/SkPathRef.h
+++ b/include/core/SkPathRef.h
@@ -108,14 +108,7 @@ public:
/**
* Gets a path ref with no verbs or points.
*/
- static SkPathRef* CreateEmpty() {
- static SkPathRef* gEmptyPathRef;
- if (!gEmptyPathRef) {
- gEmptyPathRef = SkNEW(SkPathRef); // leak!
- gEmptyPathRef->computeBounds(); // Premptively avoid a race to clear fBoundsIsDirty.
- }
- return SkRef(gEmptyPathRef);
- }
+ static SkPathRef* CreateEmpty();
/**
* Returns true if all of the points in this path are finite, meaning there
@@ -397,6 +390,11 @@ private:
SkDEBUGCODE(void validate() const;)
+ /**
+ * Called the first time someone calls CreateEmpty to actually create the singleton.
+ */
+ static void CreateEmptyImpl(SkPathRef** empty);
+
enum {
kMinSize = 256,
};
« no previous file with comments | « include/core/SkData.h ('k') | src/core/SkData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698