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

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

Issue 1505023002: fix funky formatting in SkNVRefCnt (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years 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 | « 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 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 #ifndef SkRefCnt_DEFINED 8 #ifndef SkRefCnt_DEFINED
9 #define SkRefCnt_DEFINED 9 #define SkRefCnt_DEFINED
10 10
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 // Implementation is pretty much the same as SkRefCntBase. All required barr iers are the same: 211 // Implementation is pretty much the same as SkRefCntBase. All required barr iers are the same:
212 // - unique() needs acquire when it returns true, and no barrier if it ret urns false; 212 // - unique() needs acquire when it returns true, and no barrier if it ret urns false;
213 // - ref() doesn't need any barrier; 213 // - ref() doesn't need any barrier;
214 // - unref() needs a release barrier, and an acquire if it's going to call delete. 214 // - unref() needs a release barrier, and an acquire if it's going to call delete.
215 215
216 bool unique() const { return 1 == sk_atomic_load(&fRefCnt, sk_memory_order_a cquire); } 216 bool unique() const { return 1 == sk_atomic_load(&fRefCnt, sk_memory_order_a cquire); }
217 void ref() const { (void)sk_atomic_fetch_add(&fRefCnt, +1, sk_memory_orde r_relaxed); } 217 void ref() const { (void)sk_atomic_fetch_add(&fRefCnt, +1, sk_memory_orde r_relaxed); }
218 void unref() const { 218 void unref() const {
219 if (1 == sk_atomic_fetch_add(&fRefCnt, -1, sk_memory_order_acq_rel)) { 219 if (1 == sk_atomic_fetch_add(&fRefCnt, -1, sk_memory_order_acq_rel)) {
220 SkDEBUGCODE(fRefCnt = 1;) // restore the 1 for our destructor's ass ert 220 SkDEBUGCODE(fRefCnt = 1;) // restore the 1 for our destructor's ass ert
221 delete (const Derived*)this; 221 delete (const Derived*)this;
222 } 222 }
223 } 223 }
224 void deref() const { this->unref(); } 224 void deref() const { this->unref(); }
225 225
226 private: 226 private:
227 mutable int32_t fRefCnt; 227 mutable int32_t fRefCnt;
228 }; 228 };
229 229
230 #endif 230 #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