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

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

Issue 25716003: Make it explicit that some validate methods are debug only ... (Closed) Base URL: http://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 | « include/core/SkPathRef.h ('k') | include/core/SkWeakRefCnt.h » ('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 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
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 9
10 #ifndef SkRefCnt_DEFINED 10 #ifndef SkRefCnt_DEFINED
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 SkASSERT(fRefCnt > 0); 72 SkASSERT(fRefCnt > 0);
73 // Release barrier (SL/S), if not provided below. 73 // Release barrier (SL/S), if not provided below.
74 if (sk_atomic_dec(&fRefCnt) == 1) { 74 if (sk_atomic_dec(&fRefCnt) == 1) {
75 // Aquire barrier (L/SL), if not provided above. 75 // Aquire barrier (L/SL), if not provided above.
76 // Prevents code in dispose from happening before the decrement. 76 // Prevents code in dispose from happening before the decrement.
77 sk_membar_aquire__after_atomic_dec(); 77 sk_membar_aquire__after_atomic_dec();
78 internal_dispose(); 78 internal_dispose();
79 } 79 }
80 } 80 }
81 81
82 #ifdef SK_DEBUG
82 void validate() const { 83 void validate() const {
83 SkASSERT(fRefCnt > 0); 84 SkASSERT(fRefCnt > 0);
84 } 85 }
86 #endif
85 87
86 /** 88 /**
87 * Alias for unref(), for compatibility with WTF::RefPtr. 89 * Alias for unref(), for compatibility with WTF::RefPtr.
88 */ 90 */
89 void deref() { this->unref(); } 91 void deref() { this->unref(); }
90 92
91 protected: 93 protected:
92 /** 94 /**
93 * Allow subclasses to call this if they've overridden internal_dispose 95 * Allow subclasses to call this if they've overridden internal_dispose
94 * so they can reset fRefCnt before the destructor is called. Should only 96 * so they can reset fRefCnt before the destructor is called. Should only
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 typedef T* SkRefPtr::*unspecified_bool_type; 274 typedef T* SkRefPtr::*unspecified_bool_type;
273 operator unspecified_bool_type() const { 275 operator unspecified_bool_type() const {
274 return fObj ? &SkRefPtr::fObj : NULL; 276 return fObj ? &SkRefPtr::fObj : NULL;
275 } 277 }
276 278
277 private: 279 private:
278 T* fObj; 280 T* fObj;
279 }; 281 };
280 282
281 #endif 283 #endif
OLDNEW
« no previous file with comments | « include/core/SkPathRef.h ('k') | include/core/SkWeakRefCnt.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698