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

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

Issue 1217573002: remove SkInstCnt (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 5 years, 5 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 | « include/core/SkTypeface.h ('k') | include/core/SkXfermode.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 * Copyright 2012 Google Inc. 2 * Copyright 2012 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 #ifndef SkWeakRefCnt_DEFINED 8 #ifndef SkWeakRefCnt_DEFINED
9 #define SkWeakRefCnt_DEFINED 9 #define SkWeakRefCnt_DEFINED
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 if (myRef.try_ref()) { 44 if (myRef.try_ref()) {
45 ... // use myRef 45 ... // use myRef
46 myRef.unref(); 46 myRef.unref();
47 } else { 47 } else {
48 // myRef is in the disposed state 48 // myRef is in the disposed state
49 } 49 }
50 myRef.weak_unref(); 50 myRef.weak_unref();
51 */ 51 */
52 class SK_API SkWeakRefCnt : public SkRefCnt { 52 class SK_API SkWeakRefCnt : public SkRefCnt {
53 public: 53 public:
54 SK_DECLARE_INST_COUNT(SkWeakRefCnt)
55
56 /** Default construct, initializing the reference counts to 1. 54 /** Default construct, initializing the reference counts to 1.
57 The strong references collectively hold one weak reference. When the 55 The strong references collectively hold one weak reference. When the
58 strong reference count goes to zero, the collectively held weak 56 strong reference count goes to zero, the collectively held weak
59 reference is released. 57 reference is released.
60 */ 58 */
61 SkWeakRefCnt() : SkRefCnt(), fWeakCnt(1) {} 59 SkWeakRefCnt() : SkRefCnt(), fWeakCnt(1) {}
62 60
63 /** Destruct, asserting that the weak reference count is 1. 61 /** Destruct, asserting that the weak reference count is 1.
64 */ 62 */
65 virtual ~SkWeakRefCnt() { 63 virtual ~SkWeakRefCnt() {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 weak_unref(); 150 weak_unref();
153 } 151 }
154 152
155 /* Invariant: fWeakCnt = #weak + (fRefCnt > 0 ? 1 : 0) */ 153 /* Invariant: fWeakCnt = #weak + (fRefCnt > 0 ? 1 : 0) */
156 mutable int32_t fWeakCnt; 154 mutable int32_t fWeakCnt;
157 155
158 typedef SkRefCnt INHERITED; 156 typedef SkRefCnt INHERITED;
159 }; 157 };
160 158
161 #endif 159 #endif
OLDNEW
« no previous file with comments | « include/core/SkTypeface.h ('k') | include/core/SkXfermode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698