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

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

Issue 15675025: One allocation for an SkData which makes a copy. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Use 'this' instead of function as special case trigger. Created 7 years, 6 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
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 private: 98 private:
99 /** 99 /**
100 * Called when the ref count goes to 0. 100 * Called when the ref count goes to 0.
101 */ 101 */
102 virtual void internal_dispose() const { 102 virtual void internal_dispose() const {
103 this->internal_dispose_restore_refcnt_to_1(); 103 this->internal_dispose_restore_refcnt_to_1();
104 SkDELETE(this); 104 SkDELETE(this);
105 } 105 }
106 106
107 // The following friends are those which override internal_dispose()
108 // and conditionally call SkRefCnt::internal_dispose().
109 friend class GrTexture;
110 friend class SkData;
107 friend class SkWeakRefCnt; 111 friend class SkWeakRefCnt;
108 friend class GrTexture; // to allow GrTexture's internal_dispose to
109 // call SkRefCnt's & directly set fRefCnt (to 1)
110 112
111 mutable int32_t fRefCnt; 113 mutable int32_t fRefCnt;
112 114
113 typedef SkNoncopyable INHERITED; 115 typedef SkNoncopyable INHERITED;
114 }; 116 };
115 117
116 /////////////////////////////////////////////////////////////////////////////// 118 ///////////////////////////////////////////////////////////////////////////////
117 119
118 /** Helper macro to safely assign one SkRefCnt[TS]* to another, checking for 120 /** Helper macro to safely assign one SkRefCnt[TS]* to another, checking for
119 null in on each side of the assignment, and ensuring that ref() is called 121 null in on each side of the assignment, and ensuring that ref() is called
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 typedef T* SkRefPtr::*unspecified_bool_type; 259 typedef T* SkRefPtr::*unspecified_bool_type;
258 operator unspecified_bool_type() const { 260 operator unspecified_bool_type() const {
259 return fObj ? &SkRefPtr::fObj : NULL; 261 return fObj ? &SkRefPtr::fObj : NULL;
260 } 262 }
261 263
262 private: 264 private:
263 T* fObj; 265 T* fObj;
264 }; 266 };
265 267
266 #endif 268 #endif
OLDNEW
« no previous file with comments | « include/core/SkData.h ('k') | include/core/SkWeakRefCnt.h » ('j') | src/core/SkData.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698