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

Side by Side Diff: src/core/SkPixelRef.cpp

Issue 752203002: Add an Android-framework-only stable ID to SkPixelRef. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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
« include/core/SkPixelRef.h ('K') | « include/core/SkPixelRef.h ('k') | 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 2011 Google Inc. 2 * Copyright 2011 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 #include "SkPixelRef.h" 8 #include "SkPixelRef.h"
9 #include "SkThread.h" 9 #include "SkThread.h"
10 10
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 } 196 }
197 197
198 uint32_t SkPixelRef::getGenerationID() const { 198 uint32_t SkPixelRef::getGenerationID() const {
199 if (0 == fGenerationID) { 199 if (0 == fGenerationID) {
200 fGenerationID = SkNextPixelRefGenerationID(); 200 fGenerationID = SkNextPixelRefGenerationID();
201 fUniqueGenerationID = true; // The only time we can be sure of this! 201 fUniqueGenerationID = true; // The only time we can be sure of this!
202 } 202 }
203 return fGenerationID; 203 return fGenerationID;
204 } 204 }
205 205
206 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
207 uint32_t SkPixelRef::getStableID() const {
208 if (0 == fStableID) {
209 // Although it is okay for the stable ID to collide with a gen ID, it
210 // is also okay for them not to collide, and this allows us to share
211 // code.
212 fStableID = SkNextPixelRefGenerationID();
213 }
214 return fStableID;
215 }
216 #endif
217
206 void SkPixelRef::addGenIDChangeListener(GenIDChangeListener* listener) { 218 void SkPixelRef::addGenIDChangeListener(GenIDChangeListener* listener) {
207 if (NULL == listener || !fUniqueGenerationID) { 219 if (NULL == listener || !fUniqueGenerationID) {
208 // No point in tracking this if we're not going to call it. 220 // No point in tracking this if we're not going to call it.
209 SkDELETE(listener); 221 SkDELETE(listener);
210 return; 222 return;
211 } 223 }
212 *fGenIDChangeListeners.append() = listener; 224 *fGenIDChangeListeners.append() = listener;
213 } 225 }
214 226
215 void SkPixelRef::callGenIDChangeListeners() { 227 void SkPixelRef::callGenIDChangeListeners() {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 278
267 #ifdef SK_BUILD_FOR_ANDROID 279 #ifdef SK_BUILD_FOR_ANDROID
268 void SkPixelRef::globalRef(void* data) { 280 void SkPixelRef::globalRef(void* data) {
269 this->ref(); 281 this->ref();
270 } 282 }
271 283
272 void SkPixelRef::globalUnref() { 284 void SkPixelRef::globalUnref() {
273 this->unref(); 285 this->unref();
274 } 286 }
275 #endif 287 #endif
OLDNEW
« include/core/SkPixelRef.h ('K') | « include/core/SkPixelRef.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698