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

Side by Side Diff: src/core/SkPathRef.cpp

Issue 651723003: Require SK_DECLARE_STATIC_LAZY_PTR is used in global scope. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: safe unref Created 6 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
« no previous file with comments | « src/core/SkMessageBus.h ('k') | src/core/SkTypeface.cpp » ('j') | 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 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkBuffer.h" 8 #include "SkBuffer.h"
9 #include "SkLazyPtr.h" 9 #include "SkLazyPtr.h"
10 #include "SkPath.h" 10 #include "SkPath.h"
(...skipping 11 matching lines...) Expand all
22 copy->copy(**pathRef, incReserveVerbs, incReservePoints); 22 copy->copy(**pathRef, incReserveVerbs, incReservePoints);
23 pathRef->reset(copy); 23 pathRef->reset(copy);
24 } 24 }
25 fPathRef = *pathRef; 25 fPathRef = *pathRef;
26 fPathRef->fGenerationID = 0; 26 fPathRef->fGenerationID = 0;
27 SkDEBUGCODE(sk_atomic_inc(&fPathRef->fEditorsAttached);) 27 SkDEBUGCODE(sk_atomic_inc(&fPathRef->fEditorsAttached);)
28 } 28 }
29 29
30 ////////////////////////////////////////////////////////////////////////////// 30 //////////////////////////////////////////////////////////////////////////////
31 31
32 SkPathRef* SkPathRef::CreateEmptyImpl() { 32 // As a template argument, this must have external linkage.
33 SkPathRef* sk_create_empty_pathref() {
33 SkPathRef* empty = SkNEW(SkPathRef); 34 SkPathRef* empty = SkNEW(SkPathRef);
34 empty->computeBounds(); // Avoids races later to be the first to do this. 35 empty->computeBounds(); // Avoids races later to be the first to do this.
35 return empty; 36 return empty;
36 } 37 }
37 38
39 SK_DECLARE_STATIC_LAZY_PTR(SkPathRef, empty, sk_create_empty_pathref);
40
38 SkPathRef* SkPathRef::CreateEmpty() { 41 SkPathRef* SkPathRef::CreateEmpty() {
39 SK_DECLARE_STATIC_LAZY_PTR(SkPathRef, empty, CreateEmptyImpl);
40 return SkRef(empty.get()); 42 return SkRef(empty.get());
41 } 43 }
42 44
43 void SkPathRef::CreateTransformedCopy(SkAutoTUnref<SkPathRef>* dst, 45 void SkPathRef::CreateTransformedCopy(SkAutoTUnref<SkPathRef>* dst,
44 const SkPathRef& src, 46 const SkPathRef& src,
45 const SkMatrix& matrix) { 47 const SkMatrix& matrix) {
46 SkDEBUGCODE(src.validate();) 48 SkDEBUGCODE(src.validate();)
47 if (matrix.isIdentity()) { 49 if (matrix.isIdentity()) {
48 if (*dst != &src) { 50 if (*dst != &src) {
49 src.ref(); 51 src.ref();
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 break; 483 break;
482 default: 484 default:
483 SkDEBUGFAIL("Unknown Verb"); 485 SkDEBUGFAIL("Unknown Verb");
484 break; 486 break;
485 } 487 }
486 } 488 }
487 SkASSERT(mask == fSegmentMask); 489 SkASSERT(mask == fSegmentMask);
488 #endif // SK_DEBUG_PATH 490 #endif // SK_DEBUG_PATH
489 } 491 }
490 #endif 492 #endif
OLDNEW
« no previous file with comments | « src/core/SkMessageBus.h ('k') | src/core/SkTypeface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698