Replaced TextureCacheEntry with GrTexture* and a back pointer to GrResourceEntry (in GrTexture)

http://codereview.appspot.com/6460089/



git-svn-id: http://skia.googlecode.com/svn/trunk@5122 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrStencilBuffer.cpp b/src/gpu/GrStencilBuffer.cpp
index 53a4a65..7f733f4 100644
--- a/src/gpu/GrStencilBuffer.cpp
+++ b/src/gpu/GrStencilBuffer.cpp
@@ -23,9 +23,11 @@
 }
 
 void GrStencilBuffer::transferToCacheAndLock() {
-    GrAssert(NULL == fCacheEntry);
-    fCacheEntry = 
-        this->getGpu()->getContext()->addAndLockStencilBuffer(this);
+    GrAssert(NULL == this->getCacheEntry());
+    GrAssert(!fHoldingLock);
+
+    this->getGpu()->getContext()->addAndLockStencilBuffer(this);
+    fHoldingLock = true;
 }
 
 void GrStencilBuffer::onRelease() {
@@ -39,7 +41,7 @@
         this->unlockInCache();
         // we shouldn't be deleted here because some RT still has a ref on us.
     }
-    fCacheEntry = NULL;
+    fHoldingLock = false;
 }
 
 void GrStencilBuffer::onAbandon() {
@@ -48,11 +50,11 @@
 }
 
 void GrStencilBuffer::unlockInCache() {
-    if (NULL != fCacheEntry) {
+    if (fHoldingLock) {
         GrGpu* gpu = this->getGpu();
         if (NULL != gpu) {
             GrAssert(NULL != gpu->getContext());
-            gpu->getContext()->unlockStencilBuffer(fCacheEntry);
+            gpu->getContext()->unlockStencilBuffer(this);
         }
     }
 }