Change Atlas recycling to track current flush count and recycle if Atlas not used in current flush.

BUG=
R=bsalomon@google.com, robertphillips@google.com

Author: jvanverth@google.com

Review URL: https://chromiumcodereview.appspot.com/23120004

git-svn-id: http://skia.googlecode.com/svn/trunk@10777 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrAtlas.h b/src/gpu/GrAtlas.h
index b6f25c2..7831a8d 100644
--- a/src/gpu/GrAtlas.h
+++ b/src/gpu/GrAtlas.h
@@ -13,6 +13,7 @@
 
 #include "GrPoint.h"
 #include "GrTexture.h"
+#include "GrDrawTarget.h"
 
 class GrGpu;
 class GrRectanizer;
@@ -36,32 +37,25 @@
         }
     }
 
-    static void MarkAllUnused(GrAtlas* atlas) {
-        while (NULL != atlas) {
-            atlas->fUsed = false;
-            atlas = atlas->fNext;
-        }
-    }
-
     static bool RemoveUnusedAtlases(GrAtlasMgr* atlasMgr, GrAtlas** startAtlas);
 
-    bool used() const { return fUsed; }
-    void setUsed(bool used) { fUsed = used; }
+    GrDrawTarget::DrawToken drawToken() const { return fDrawToken; }
+    void setDrawToken(GrDrawTarget::DrawToken draw) { fDrawToken = draw; }
 
 private:
     GrAtlas(GrAtlasMgr*, int plotX, int plotY, GrMaskFormat format);
     ~GrAtlas(); // does not try to delete the fNext field
 
-    GrAtlas*        fNext;
-
     // for recycling
-    bool            fUsed;
+    GrDrawTarget::DrawToken fDrawToken;
 
-    GrTexture*      fTexture;
-    GrRectanizer*   fRects;
-    GrAtlasMgr*     fAtlasMgr;
-    GrIPoint16      fPlot;
-    GrMaskFormat    fMaskFormat;
+    GrAtlas*                fNext;
+
+    GrTexture*              fTexture;
+    GrRectanizer*           fRects;
+    GrAtlasMgr*             fAtlasMgr;
+    GrIPoint16              fPlot;
+    GrMaskFormat            fMaskFormat;
 
     friend class GrAtlasMgr;
 };