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

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

Issue 13925021: Remove 'friend SkRefCnt' from SkData. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 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 | « no previous file | include/core/SkRefCnt.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 2011 Google Inc. 3 * Copyright 2011 Google Inc.
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 10
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 private: 115 private:
116 ReleaseProc fReleaseProc; 116 ReleaseProc fReleaseProc;
117 void* fReleaseProcContext; 117 void* fReleaseProcContext;
118 118
119 const void* fPtr; 119 const void* fPtr;
120 size_t fSize; 120 size_t fSize;
121 121
122 SkData(const void* ptr, size_t size, ReleaseProc, void* context); 122 SkData(const void* ptr, size_t size, ReleaseProc, void* context);
123 virtual ~SkData(); 123 virtual ~SkData();
124 124
125 // This is here because SkAutoTUnref creates an internal helper class
126 // that derives from SkData (i.e., BlockRef) to prevent refs\unrefs.
127 // This helper class generates a compiler warning on Windows since the
128 // SkData's destructor is private. This friending gives the helper class
129 // access to the destructor.
130 friend class SkAutoTUnref<SkData>::BlockRef<SkData>;
131
132 typedef SkFlattenable INHERITED; 125 typedef SkFlattenable INHERITED;
133 }; 126 };
134 127
135 /** 128 /** Typedef of SkAutoTUnref<SkData> for automatically unref-ing a SkData. */
136 * Specialized version of SkAutoTUnref<SkData> for automatically unref-ing a 129 typedef SkAutoTUnref<SkData> SkAutoDataUnref;
137 * SkData.
138 */
139 class SkAutoDataUnref : SkNoncopyable {
140 public:
141 SkAutoDataUnref(SkData* data) : fRef(data) {}
142 ~SkAutoDataUnref() {
143 SkSafeUnref(fRef);
144 }
145
146 SkData* get() const { return fRef; }
147
148 void release() {
149 if (fRef) {
150 fRef->unref();
151 fRef = NULL;
152 }
153 }
154
155 SkData *operator->() const { return fRef; }
156 operator SkData*() { return fRef; }
157
158 private:
159 SkData* fRef;
160 };
161 130
162 #endif 131 #endif
OLDNEW
« no previous file with comments | « no previous file | include/core/SkRefCnt.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698