Add reset context count to GrGpu


git-svn-id: http://skia.googlecode.com/svn/trunk@2605 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index cf29ed7..6961a30 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -288,9 +288,14 @@
     void finalizeReservedVertices();
     void finalizeReservedIndices();
 
-    // overridden by API-specific derived class to handle re-emitting 3D API
-    // preample and dirtying state cache.
-    virtual void resetContext() = 0;
+    // called to handle re-emitting 3D API preample and dirtying state cache.
+    void resetContext();
+    // returns the number of times resetContext has been called. This value
+    // can be used a timestamp to detect when state cache is dirty.
+    int resetCount() const { return fResetCnt; }
+    
+    // subclass implementation of resetContext
+    virtual void onResetContext() = 0;
 
     // overridden by API-specific derived class to create objects.
     virtual GrTexture* onCreateTexture(const GrTextureDesc& desc,
@@ -363,6 +368,8 @@
 
 private:
     GrContext*                  fContext; // not reffed (context refs gpu)
+    
+    int                         fResetCnt;
 
     GrVertexBufferAllocPool*    fVertexPool;