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

Side by Side Diff: include/core/SkPathRef.h

Issue 25745003: Threads can race to be the first one to calculate the empty path ref's bounds. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #ifndef SkPathRef_DEFINED 9 #ifndef SkPathRef_DEFINED
10 #define SkPathRef_DEFINED 10 #define SkPathRef_DEFINED
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 }; 105 };
106 106
107 public: 107 public:
108 /** 108 /**
109 * Gets a path ref with no verbs or points. 109 * Gets a path ref with no verbs or points.
110 */ 110 */
111 static SkPathRef* CreateEmpty() { 111 static SkPathRef* CreateEmpty() {
112 static SkPathRef* gEmptyPathRef; 112 static SkPathRef* gEmptyPathRef;
113 if (!gEmptyPathRef) { 113 if (!gEmptyPathRef) {
114 gEmptyPathRef = SkNEW(SkPathRef); // leak! 114 gEmptyPathRef = SkNEW(SkPathRef); // leak!
115 gEmptyPathRef->computeBounds(); // Premptively avoid a race to cle ar fBoundsIsDirty.
115 } 116 }
116 return SkRef(gEmptyPathRef); 117 return SkRef(gEmptyPathRef);
117 } 118 }
118 119
119 /** 120 /**
120 * Returns true if all of the points in this path are finite, meaning there 121 * Returns true if all of the points in this path are finite, meaning there
121 * are no infinities and no NaNs. 122 * are no infinities and no NaNs.
122 */ 123 */
123 bool isFinite() const { 124 bool isFinite() const {
124 if (fBoundsIsDirty) { 125 if (fBoundsIsDirty) {
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 enum { 357 enum {
357 kEmptyGenID = 1, // GenID reserved for path ref with zero points and zer o verbs. 358 kEmptyGenID = 1, // GenID reserved for path ref with zero points and zer o verbs.
358 }; 359 };
359 mutable int32_t fGenerationID; 360 mutable int32_t fGenerationID;
360 SkDEBUGCODE(int32_t fEditorsAttached;) // assert that only one editor in use at any time. 361 SkDEBUGCODE(int32_t fEditorsAttached;) // assert that only one editor in use at any time.
361 362
362 typedef SkRefCnt INHERITED; 363 typedef SkRefCnt INHERITED;
363 }; 364 };
364 365
365 #endif 366 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698