void SkCountdown::run() { if (sk_atomic_dec(&fCount) == 1) { fReady.lock(); fReady.signal(); fReady.unlock(); } }
void MCGImageRelease(MCGImageRef self) { if (self != NULL) { if (sk_atomic_dec((int32_t *)&self -> references) == 1) MCGImageDestroy(self); } }
SkPixelRef::~SkPixelRef() { #ifndef SK_SUPPORT_LEGACY_UNBALANCED_PIXELREF_LOCKCOUNT SkASSERT(SKPIXELREF_PRELOCKED_LOCKCOUNT == fLockCount || 0 == fLockCount); #endif #ifdef SK_TRACE_PIXELREF_LIFETIME SkDebugf("~pixelref %d\n", sk_atomic_dec(&gInstCounter) - 1); #endif this->callGenIDChangeListeners(); }
~SkTLSRec() { if (fDeleteProc) { fDeleteProc(fData); } // else we leak fData, or it will be managed by the caller #ifdef SK_TRACE_TLS_LIFETIME int n = sk_atomic_dec(&gTLSRecCount); SkDebugf("~SkTLSRec[%d]\n", n - 1); #endif }
void AndroidPixelRef::globalUnref() { if (fOnJavaHeap && sk_atomic_dec(&fGlobalRefCnt) == 1) { JNIEnv *env = vm2env(fVM); if (!fHasGlobalRef) { SkDebugf("We don't have a global ref!"); sk_throw(); } env->DeleteGlobalRef(fStorageObj); fStorageObj = NULL; fHasGlobalRef = false; } unref(); }
void AndroidPixelRef::globalUnref() { if (fWrappedPixelRef) { // delegate java obj management to the wrapped ref fWrappedPixelRef->globalUnref(); return; } if (fOnJavaHeap && sk_atomic_dec(&fGlobalRefCnt) == 1) { JNIEnv *env = vm2env(fVM); if (!fHasGlobalRef) { SkDebugf("We don't have a global ref!"); sk_throw(); } env->DeleteGlobalRef(fStorageObj); fStorageObj = NULL; fHasGlobalRef = false; } unref(); }
void unref() { SkASSERT(fRefCnt > 0); if (sk_atomic_dec(&fRefCnt) == 1) { sk_free(this); } }
static void FakeDeleteTLS(void*) { sk_atomic_dec(&gCounter); }
static inline void dec_shader_counter() { #ifdef SK_TRACK_SHADER_LIFETIME int32_t prev = sk_atomic_dec(&gShaderCounter); SkDebugf("--- shader counter %d\n", prev - 1); #endif }
static void dec() { int32_t oldCount = sk_atomic_dec(&gCachedDataCounter); SkDebugf("SkCachedData dec %d\n", oldCount - 1); }
int GrMockGpu::NextExternalTextureID() { // We use negative ints for the "testing only external textures" so they can easily be // identified when debugging. static int gID = 0; return sk_atomic_dec(&gID) - 1; }
int GrMockGpu::NextInternalRenderTargetID() { // We start off with large numbers to differentiate from texture IDs, even though their // technically in a different space. static int gID = SK_MaxS32; return sk_atomic_dec(&gID); }