Revert of add a ClassID function to GrBatch (patchset #5 id:80001 of https://codereview.chromium.org/1352813003/ )

Reason for revert:
breaks mac bot

Original issue's description:
> add a ClassID function to GrBatch
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/4078d529e9e199eea13456db7bf3a63a104ab5b9

TBR=robertphillips@google.com,bsalomon@google.com,joshualitt@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1345393003
diff --git a/gm/beziereffects.cpp b/gm/beziereffects.cpp
index 81d5c58..1886a4a2 100644
--- a/gm/beziereffects.cpp
+++ b/gm/beziereffects.cpp
@@ -32,7 +32,6 @@
 
 class BezierCubicOrConicTestBatch : public GrTestBatch {
 public:
-    DEFINE_BATCH_CLASS_ID
     struct Geometry : public GrTestBatch::Geometry {
         SkRect fBounds;
     };
@@ -47,7 +46,8 @@
 private:
     BezierCubicOrConicTestBatch(const GrGeometryProcessor* gp, const Geometry& geo,
                                 const SkScalar klmEqs[9], SkScalar sign)
-        : INHERITED(ClassID(), gp, geo.fBounds) {
+        : INHERITED(gp, geo.fBounds) {
+        this->initClassID<BezierCubicOrConicTestBatch>();
         for (int i = 0; i < 9; i++) {
             fKlmEqs[i] = klmEqs[i];
         }
@@ -432,7 +432,6 @@
 
 class BezierQuadTestBatch : public GrTestBatch {
 public:
-    DEFINE_BATCH_CLASS_ID
     struct Geometry : public GrTestBatch::Geometry {
         SkRect fBounds;
     };
@@ -447,9 +446,10 @@
 private:
     BezierQuadTestBatch(const GrGeometryProcessor* gp, const Geometry& geo,
                         const GrPathUtils::QuadUVMatrix& devToUV)
-        : INHERITED(ClassID(), gp, geo.fBounds)
+        : INHERITED(gp, geo.fBounds)
         , fGeometry(geo)
         , fDevToUV(devToUV) {
+        this->initClassID<BezierQuadTestBatch>();
     }
 
     struct Vertex {
diff --git a/gm/convexpolyeffect.cpp b/gm/convexpolyeffect.cpp
index 35cc498..c014e6a 100644
--- a/gm/convexpolyeffect.cpp
+++ b/gm/convexpolyeffect.cpp
@@ -31,7 +31,6 @@
 
 class ConvexPolyTestBatch : public GrTestBatch {
 public:
-    DEFINE_BATCH_CLASS_ID
     struct Geometry : public GrTestBatch::Geometry {
         SkRect fBounds;
     };
@@ -44,8 +43,9 @@
 
 private:
     ConvexPolyTestBatch(const GrGeometryProcessor* gp, const Geometry& geo)
-        : INHERITED(ClassID(), gp, geo.fBounds)
+        : INHERITED(gp, geo.fBounds)
         , fGeometry(geo) {
+        this->initClassID<ConvexPolyTestBatch>();
     }
 
     Geometry* geoData(int index) override {
diff --git a/src/gpu/GrAtlasTextContext.cpp b/src/gpu/GrAtlasTextContext.cpp
index 822c480..fa96a8d 100644
--- a/src/gpu/GrAtlasTextContext.cpp
+++ b/src/gpu/GrAtlasTextContext.cpp
@@ -1431,8 +1431,6 @@
 
 class TextBatch : public GrVertexBatch {
 public:
-    DEFINE_BATCH_CLASS_ID
-
     typedef GrAtlasTextContext::DistanceAdjustTable DistanceAdjustTable;
     typedef GrAtlasTextBlob Blob;
     typedef Blob::Run Run;
@@ -1450,6 +1448,7 @@
                                    GrBatchFontCache* fontCache) {
         TextBatch* batch = new TextBatch;
 
+        batch->initClassID<TextBatch>();
         batch->fFontCache = fontCache;
         switch (maskFormat) {
             case kA8_GrMaskFormat:
@@ -1475,7 +1474,7 @@
                                           SkColor filteredColor, bool isLCD,
                                           bool useBGR) {
         TextBatch* batch = new TextBatch;
-
+        batch->initClassID<TextBatch>();
         batch->fFontCache = fontCache;
         batch->fMaskType = isLCD ? kLCDDistanceField_MaskType : kGrayscaleDistanceField_MaskType;
         batch->fDistanceAdjustTable.reset(SkRef(distanceAdjustTable));
@@ -1784,7 +1783,7 @@
         this->flush(target, &flushInfo);
     }
 
-    TextBatch() : INHERITED(ClassID()) {} // initialized in factory functions.
+    TextBatch() {} // initialized in factory functions.
 
     ~TextBatch() {
         for (int i = 0; i < fGeoCount; i++) {
@@ -2045,8 +2044,6 @@
     // Distance field properties
     SkAutoTUnref<const DistanceAdjustTable> fDistanceAdjustTable;
     SkColor fFilteredColor;
-
-    typedef GrVertexBatch INHERITED;
 };
 
 void GrAtlasTextContext::flushRunAsPaths(GrDrawContext* dc, GrRenderTarget* rt,
diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h
index b12ac99..cae1552 100644
--- a/src/gpu/GrDrawTarget.h
+++ b/src/gpu/GrDrawTarget.h
@@ -23,7 +23,6 @@
 #include "SkClipStack.h"
 #include "SkMatrix.h"
 #include "SkPath.h"
-#include "SkStringUtils.h"
 #include "SkStrokeRec.h"
 #include "SkTArray.h"
 #include "SkTLazy.h"
diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp
index 8a938c2..8eed382 100644
--- a/src/gpu/GrOvalRenderer.cpp
+++ b/src/gpu/GrOvalRenderer.cpp
@@ -606,15 +606,13 @@
 
 class CircleBatch : public GrVertexBatch {
 public:
-    DEFINE_BATCH_CLASS_ID
-
     struct Geometry {
+        GrColor fColor;
         SkMatrix fViewMatrix;
-        SkRect fDevBounds;
         SkScalar fInnerRadius;
         SkScalar fOuterRadius;
-        GrColor fColor;
         bool fStroke;
+        SkRect fDevBounds;
     };
 
     static GrDrawBatch* Create(const Geometry& geometry) { return new CircleBatch(geometry); }
@@ -707,7 +705,8 @@
 
     SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
 
-    CircleBatch(const Geometry& geometry) : INHERITED(ClassID()) {
+    CircleBatch(const Geometry& geometry) {
+        this->initClassID<CircleBatch>();
         fGeoData.push_back(geometry);
 
         this->setBounds(geometry.fDevBounds);
@@ -754,8 +753,6 @@
 
     BatchTracker fBatch;
     SkSTArray<1, Geometry, true> fGeoData;
-
-    typedef GrVertexBatch INHERITED;
 };
 
 static GrDrawBatch* create_circle_batch(GrColor color,
@@ -824,17 +821,15 @@
 
 class EllipseBatch : public GrVertexBatch {
 public:
-    DEFINE_BATCH_CLASS_ID
-
     struct Geometry {
+        GrColor fColor;
         SkMatrix fViewMatrix;
-        SkRect fDevBounds;
         SkScalar fXRadius;
         SkScalar fYRadius;
         SkScalar fInnerXRadius;
         SkScalar fInnerYRadius;
-        GrColor fColor;
         bool fStroke;
+        SkRect fDevBounds;
     };
 
     static GrDrawBatch* Create(const Geometry& geometry) { return new EllipseBatch(geometry); }
@@ -931,7 +926,8 @@
 
     SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
 
-    EllipseBatch(const Geometry& geometry) : INHERITED(ClassID()) {
+    EllipseBatch(const Geometry& geometry) {
+        this->initClassID<EllipseBatch>();
         fGeoData.push_back(geometry);
 
         this->setBounds(geometry.fDevBounds);
@@ -979,8 +975,6 @@
 
     BatchTracker fBatch;
     SkSTArray<1, Geometry, true> fGeoData;
-
-    typedef GrVertexBatch INHERITED;
 };
 
 static GrDrawBatch* create_ellipse_batch(GrColor color,
@@ -1091,19 +1085,17 @@
 
 class DIEllipseBatch : public GrVertexBatch {
 public:
-    DEFINE_BATCH_CLASS_ID
-
     struct Geometry {
+        GrColor fColor;
         SkMatrix fViewMatrix;
-        SkRect fBounds;
         SkScalar fXRadius;
         SkScalar fYRadius;
         SkScalar fInnerXRadius;
         SkScalar fInnerYRadius;
         SkScalar fGeoDx;
         SkScalar fGeoDy;
-        GrColor fColor;
         DIEllipseEdgeEffect::Mode fMode;
+        SkRect fBounds;
     };
 
     static GrDrawBatch* Create(const Geometry& geometry, const SkRect& bounds) {
@@ -1194,7 +1186,8 @@
 
     SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
 
-    DIEllipseBatch(const Geometry& geometry, const SkRect& bounds) : INHERITED(ClassID()) {
+    DIEllipseBatch(const Geometry& geometry, const SkRect& bounds) {
+        this->initClassID<DIEllipseBatch>();
         fGeoData.push_back(geometry);
 
         this->setBounds(bounds);
@@ -1241,8 +1234,6 @@
 
     BatchTracker fBatch;
     SkSTArray<1, Geometry, true> fGeoData;
-
-    typedef GrVertexBatch INHERITED;
 };
 
 static GrDrawBatch* create_diellipse_batch(GrColor color,
@@ -1450,15 +1441,13 @@
 
 class RRectCircleRendererBatch : public GrVertexBatch {
 public:
-    DEFINE_BATCH_CLASS_ID
-
     struct Geometry {
+        GrColor fColor;
         SkMatrix fViewMatrix;
-        SkRect fDevBounds;
         SkScalar fInnerRadius;
         SkScalar fOuterRadius;
-        GrColor fColor;
         bool fStroke;
+        SkRect fDevBounds;
     };
 
     static GrDrawBatch* Create(const Geometry& geometry) {
@@ -1574,7 +1563,8 @@
 
     SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
 
-    RRectCircleRendererBatch(const Geometry& geometry) : INHERITED(ClassID()) {
+    RRectCircleRendererBatch(const Geometry& geometry) {
+        this->initClassID<RRectCircleRendererBatch>();
         fGeoData.push_back(geometry);
 
         this->setBounds(geometry.fDevBounds);
@@ -1621,23 +1611,19 @@
 
     BatchTracker fBatch;
     SkSTArray<1, Geometry, true> fGeoData;
-
-    typedef GrVertexBatch INHERITED;
 };
 
 class RRectEllipseRendererBatch : public GrVertexBatch {
 public:
-    DEFINE_BATCH_CLASS_ID
-
     struct Geometry {
+        GrColor fColor;
         SkMatrix fViewMatrix;
-        SkRect fDevBounds;
         SkScalar fXRadius;
         SkScalar fYRadius;
         SkScalar fInnerXRadius;
         SkScalar fInnerYRadius;
-        GrColor fColor;
         bool fStroke;
+        SkRect fDevBounds;
     };
 
     static GrDrawBatch* Create(const Geometry& geometry) {
@@ -1763,7 +1749,8 @@
 
     SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
 
-    RRectEllipseRendererBatch(const Geometry& geometry) : INHERITED(ClassID()) {
+    RRectEllipseRendererBatch(const Geometry& geometry) {
+        this->initClassID<RRectEllipseRendererBatch>();
         fGeoData.push_back(geometry);
 
         this->setBounds(geometry.fDevBounds);
@@ -1811,8 +1798,6 @@
 
     BatchTracker fBatch;
     SkSTArray<1, Geometry, true> fGeoData;
-
-    typedef GrVertexBatch INHERITED;
 };
 
 static GrDrawBatch* create_rrect_batch(GrColor color,
diff --git a/src/gpu/batches/GrAAConvexPathRenderer.cpp b/src/gpu/batches/GrAAConvexPathRenderer.cpp
index 543885e..75bf332 100644
--- a/src/gpu/batches/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/batches/GrAAConvexPathRenderer.cpp
@@ -733,7 +733,6 @@
 
 class AAConvexPathBatch : public GrVertexBatch {
 public:
-    DEFINE_BATCH_CLASS_ID
     struct Geometry {
         GrColor fColor;
         SkMatrix fViewMatrix;
@@ -753,6 +752,7 @@
     }
 
 private:
+
     void initBatchTracker(const GrPipelineOptimizations& opt) override {
         // Handle any color overrides
         if (!opt.readsColor()) {
@@ -921,7 +921,8 @@
 
     SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
 
-    AAConvexPathBatch(const Geometry& geometry) : INHERITED(ClassID()) {
+    AAConvexPathBatch(const Geometry& geometry) {
+        this->initClassID<AAConvexPathBatch>();
         fGeoData.push_back(geometry);
 
         // compute bounds
@@ -978,8 +979,6 @@
 
     BatchTracker fBatch;
     SkSTArray<1, Geometry, true> fGeoData;
-
-    typedef GrVertexBatch INHERITED;
 };
 
 bool GrAAConvexPathRenderer::onDrawPath(const DrawPathArgs& args) {
diff --git a/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp b/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
index ee5fdb8..f06553c 100644
--- a/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
+++ b/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
@@ -111,8 +111,6 @@
 
 class AADistanceFieldPathBatch : public GrVertexBatch {
 public:
-    DEFINE_BATCH_CLASS_ID
-
     typedef GrAADistanceFieldPathRenderer::PathData PathData;
     typedef SkTDynamicHash<PathData, PathData::Key> PathCache;
     typedef GrAADistanceFieldPathRenderer::PathDataList PathDataList;
@@ -278,8 +276,8 @@
 
     AADistanceFieldPathBatch(const Geometry& geometry, GrColor color, const SkMatrix& viewMatrix,
                              GrBatchAtlas* atlas,
-                             PathCache* pathCache, PathDataList* pathList)
-        : INHERITED(ClassID()) {
+                             PathCache* pathCache, PathDataList* pathList) {
+        this->initClassID<AADistanceFieldPathBatch>();
         fBatch.fColor = color;
         fBatch.fViewMatrix = viewMatrix;
         fGeoData.push_back(geometry);
@@ -521,8 +519,6 @@
     GrBatchAtlas* fAtlas;
     PathCache* fPathCache;
     PathDataList* fPathList;
-
-    typedef GrVertexBatch INHERITED;
 };
 
 bool GrAADistanceFieldPathRenderer::onDrawPath(const DrawPathArgs& args) {
diff --git a/src/gpu/batches/GrAAHairLinePathRenderer.cpp b/src/gpu/batches/GrAAHairLinePathRenderer.cpp
index d17ed09..c6bdd055 100644
--- a/src/gpu/batches/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/batches/GrAAHairLinePathRenderer.cpp
@@ -672,8 +672,6 @@
 
 class AAHairlineBatch : public GrVertexBatch {
 public:
-    DEFINE_BATCH_CLASS_ID
-
     struct Geometry {
         GrColor fColor;
         uint8_t fCoverage;
@@ -718,7 +716,8 @@
     typedef SkTArray<int, true> IntArray;
     typedef SkTArray<float, true> FloatArray;
 
-    AAHairlineBatch(const Geometry& geometry) : INHERITED(ClassID()) {
+    AAHairlineBatch(const Geometry& geometry) {
+        this->initClassID<AAHairlineBatch>();
         fGeoData.push_back(geometry);
 
         // compute bounds
@@ -786,8 +785,6 @@
 
     BatchTracker fBatch;
     SkSTArray<1, Geometry, true> fGeoData;
-
-    typedef GrVertexBatch INHERITED;
 };
 
 void AAHairlineBatch::onPrepareDraws(Target* target) {
diff --git a/src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp b/src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp
index a7e9824..d05fe4e 100644
--- a/src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp
+++ b/src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp
@@ -119,8 +119,6 @@
 
 class AAFlatteningConvexPathBatch : public GrVertexBatch {
 public:
-    DEFINE_BATCH_CLASS_ID
-
     struct Geometry {
         GrColor fColor;
         SkMatrix fViewMatrix;
@@ -260,7 +258,8 @@
 
     SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
 
-    AAFlatteningConvexPathBatch(const Geometry& geometry) : INHERITED(ClassID()) {
+    AAFlatteningConvexPathBatch(const Geometry& geometry) {
+        this->initClassID<AAFlatteningConvexPathBatch>();
         fGeoData.push_back(geometry);
 
         // compute bounds
@@ -309,8 +308,6 @@
 
     BatchTracker fBatch;
     SkSTArray<1, Geometry, true> fGeoData;
-
-    typedef GrVertexBatch INHERITED;
 };
 
 bool GrAALinearizingConvexPathRenderer::onDrawPath(const DrawPathArgs& args) {
diff --git a/src/gpu/batches/GrAAStrokeRectBatch.h b/src/gpu/batches/GrAAStrokeRectBatch.h
index fad5bd9..ae75348 100644
--- a/src/gpu/batches/GrAAStrokeRectBatch.h
+++ b/src/gpu/batches/GrAAStrokeRectBatch.h
@@ -18,8 +18,6 @@
 
 class GrAAStrokeRectBatch : public GrVertexBatch {
 public:
-    DEFINE_BATCH_CLASS_ID
-
     // TODO support AA rotated stroke rects by copying around view matrices
     struct Geometry {
         GrColor fColor;
@@ -50,8 +48,8 @@
     void onPrepareDraws(Target*) override;
     void initBatchTracker(const GrPipelineOptimizations&) override;
 
-    GrAAStrokeRectBatch(const Geometry& geometry, const SkMatrix& viewMatrix)
-        : INHERITED(ClassID()) {
+    GrAAStrokeRectBatch(const Geometry& geometry, const SkMatrix& viewMatrix)  {
+        this->initClassID<GrAAStrokeRectBatch>();
         fBatch.fViewMatrix = viewMatrix;
         fGeoData.push_back(geometry);
 
@@ -107,8 +105,6 @@
 
     BatchTracker fBatch;
     SkSTArray<1, Geometry, true> fGeoData;
-
-    typedef GrVertexBatch INHERITED;
 };
 
 
diff --git a/src/gpu/batches/GrBatch.cpp b/src/gpu/batches/GrBatch.cpp
index 19c19ff..a3a9884 100644
--- a/src/gpu/batches/GrBatch.cpp
+++ b/src/gpu/batches/GrBatch.cpp
@@ -46,10 +46,10 @@
     return MemoryPoolAccessor().pool()->release(target);
 }
 
-GrBatch::GrBatch(uint32_t classID)
-    : fClassID(classID)
+GrBatch::GrBatch()
+    : fClassID(kIllegalBatchID)
 #if GR_BATCH_SPEW
-    , fUniqueID(GenBatchID())
+    , fUniqueID(GenID(&gCurrBatchUniqueID))
 #endif
 {
     SkDEBUGCODE(fUsed = false;)
diff --git a/src/gpu/batches/GrBatch.h b/src/gpu/batches/GrBatch.h
index c5fc80c..b6eec1f 100644
--- a/src/gpu/batches/GrBatch.h
+++ b/src/gpu/batches/GrBatch.h
@@ -41,16 +41,9 @@
     #define GrBATCH_INFO(...)
 #endif
 
-// A helper macro to generate a class static id
-#define DEFINE_BATCH_CLASS_ID \
-    static uint32_t ClassID() { \
-        static uint32_t kClassID = GenBatchClassID(); \
-        return kClassID; \
-    }
-
 class GrBatch : public GrNonAtomicRef {
 public:
-    GrBatch(uint32_t classID);
+    GrBatch();
     ~GrBatch() override;
 
     virtual const char* name() const = 0;
@@ -76,17 +69,10 @@
     }
 
     /**
-     * Helper for safely down-casting to a GrBatch subclass
+     * Helper for down-casting to a GrBatch subclass
      */
-    template <typename T> const T& cast() const {
-        SkASSERT(T::ClassID() == this->classID());
-        return *static_cast<const T*>(this);
-    }
-
-    template <typename T> T* cast() {
-        SkASSERT(T::ClassID() == this->classID());
-        return static_cast<T*>(this);
-    }
+    template <typename T> const T& cast() const { return *static_cast<const T*>(this); }
+    template <typename T> T* cast() { return static_cast<T*>(this); }
 
     uint32_t classID() const { SkASSERT(kIllegalBatchID != fClassID); return fClassID; }
 
@@ -110,6 +96,11 @@
     virtual SkString dumpInfo() const = 0;
 
 protected:
+    template <typename PROC_SUBCLASS> void initClassID() {
+         static uint32_t kClassID = GenID(&gCurrBatchClassID);
+         fClassID = kClassID;
+    }
+
     // NOTE, compute some bounds, even if extremely conservative.  Do *NOT* setLargest on the bounds
     // rect because we outset it for dst copy textures
     void setBounds(const SkRect& newBounds) { fBounds = newBounds; }
@@ -118,8 +109,6 @@
         return fBounds.joinPossiblyEmptyRect(otherBounds);
     }
 
-    static uint32_t GenBatchClassID() { return GenID(&gCurrBatchClassID); }
-
     SkRect                              fBounds;
 
 private:
@@ -129,7 +118,8 @@
     virtual void onDraw(GrBatchFlushState*) = 0;
 
     static uint32_t GenID(int32_t* idCounter) {
-        // The atomic inc returns the old value not the incremented value. So we add
+        // fCurrProcessorClassID has been initialized to kIllegalProcessorClassID. The
+        // atomic inc returns the old value not the incremented value. So we add
         // 1 to the returned value.
         uint32_t id = static_cast<uint32_t>(sk_atomic_inc(idCounter)) + 1;
         if (!id) {
@@ -143,14 +133,13 @@
         kIllegalBatchID = 0,
     };
 
+    uint32_t                            fClassID;
     SkDEBUGCODE(bool                    fUsed;)
-    const uint32_t                      fClassID;
 #if GR_BATCH_SPEW
-    static uint32_t GenBatchID() { return GenID(&gCurrBatchUniqueID); }
-    const uint32_t                      fUniqueID;
-    static int32_t                      gCurrBatchUniqueID;
+    uint32_t                            fUniqueID;
+    static int32_t gCurrBatchUniqueID;
 #endif
-    static int32_t                      gCurrBatchClassID;
+    static int32_t gCurrBatchClassID;
     typedef GrNonAtomicRef INHERITED;
 };
 
diff --git a/src/gpu/batches/GrClearBatch.h b/src/gpu/batches/GrClearBatch.h
index b973dab..f13b073 100644
--- a/src/gpu/batches/GrClearBatch.h
+++ b/src/gpu/batches/GrClearBatch.h
@@ -15,13 +15,11 @@
 
 class GrClearBatch final : public GrBatch {
 public:
-    DEFINE_BATCH_CLASS_ID
-
     GrClearBatch(const SkIRect& rect,  GrColor color, GrRenderTarget* rt)
-        : INHERITED(ClassID())
-        , fRect(rect)
+        : fRect(rect)
         , fColor(color)
         , fRenderTarget(rt) {
+        this->initClassID<GrClearBatch>();
         fBounds = SkRect::Make(rect);
     }
 
@@ -52,19 +50,15 @@
     SkIRect                                                 fRect;
     GrColor                                                 fColor;
     GrPendingIOResource<GrRenderTarget, kWrite_GrIOType>    fRenderTarget;
-
-    typedef GrBatch INHERITED;
 };
 
 class GrClearStencilClipBatch final : public GrBatch {
 public:
-    DEFINE_BATCH_CLASS_ID
-
     GrClearStencilClipBatch(const SkIRect& rect, bool insideClip, GrRenderTarget* rt)
-        : INHERITED(ClassID())
-        , fRect(rect)
+        : fRect(rect)
         , fInsideClip(insideClip)
         , fRenderTarget(rt) {
+        this->initClassID<GrClearStencilClipBatch>();
         fBounds = SkRect::Make(rect);
     }
 
@@ -92,8 +86,6 @@
     SkIRect                                                 fRect;
     bool                                                    fInsideClip;
     GrPendingIOResource<GrRenderTarget, kWrite_GrIOType>    fRenderTarget;
-
-    typedef GrBatch INHERITED;
 };
 
 #endif
diff --git a/src/gpu/batches/GrCopySurfaceBatch.h b/src/gpu/batches/GrCopySurfaceBatch.h
index ed5e77f..584bbab 100644
--- a/src/gpu/batches/GrCopySurfaceBatch.h
+++ b/src/gpu/batches/GrCopySurfaceBatch.h
@@ -15,8 +15,6 @@
 
 class GrCopySurfaceBatch final : public GrBatch {
 public:
-    DEFINE_BATCH_CLASS_ID
-
     static GrBatch* Create(GrSurface* dst, GrSurface* src, const SkIRect& srcRect,
                            const SkIPoint& dstPoint);
 
@@ -39,11 +37,11 @@
 private:
     GrCopySurfaceBatch(GrSurface* dst, GrSurface* src, const SkIRect& srcRect,
                        const SkIPoint& dstPoint)
-        : INHERITED(ClassID())
-        , fDst(dst)
+        : fDst(dst)
         , fSrc(src)
         , fSrcRect(srcRect)
         , fDstPoint(dstPoint) {
+        this->initClassID<GrCopySurfaceBatch>();        
         fBounds = SkRect::MakeXYWH(SkIntToScalar(dstPoint.fX), SkIntToScalar(dstPoint.fY),
                                    SkIntToScalar(srcRect.width()), SkIntToScalar(srcRect.height()));
     }
@@ -60,8 +58,6 @@
     GrPendingIOResource<GrSurface, kRead_GrIOType>  fSrc;
     SkIRect                                         fSrcRect;
     SkIPoint                                        fDstPoint;
-
-    typedef GrBatch INHERITED;
 };
 
 #endif
diff --git a/src/gpu/batches/GrDefaultPathRenderer.cpp b/src/gpu/batches/GrDefaultPathRenderer.cpp
index 67bccb6..f4ce7c8 100644
--- a/src/gpu/batches/GrDefaultPathRenderer.cpp
+++ b/src/gpu/batches/GrDefaultPathRenderer.cpp
@@ -211,8 +211,6 @@
 
 class DefaultPathBatch : public GrVertexBatch {
 public:
-    DEFINE_BATCH_CLASS_ID
-
     struct Geometry {
         GrColor fColor;
         SkPath fPath;
@@ -378,8 +376,8 @@
     SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
 
     DefaultPathBatch(const Geometry& geometry, uint8_t coverage, const SkMatrix& viewMatrix,
-                     bool isHairline, const SkRect& devBounds)
-        : INHERITED(ClassID()) {
+                     bool isHairline, const SkRect& devBounds) {
+        this->initClassID<DefaultPathBatch>();
         fBatch.fCoverage = coverage;
         fBatch.fIsHairline = isHairline;
         fBatch.fViewMatrix = viewMatrix;
@@ -532,8 +530,6 @@
 
     BatchTracker fBatch;
     SkSTArray<1, Geometry, true> fGeoData;
-
-    typedef GrVertexBatch INHERITED;
 };
 
 bool GrDefaultPathRenderer::internalDrawPath(GrDrawTarget* target,
diff --git a/src/gpu/batches/GrDiscardBatch.h b/src/gpu/batches/GrDiscardBatch.h
index c13e732..8a050a7 100644
--- a/src/gpu/batches/GrDiscardBatch.h
+++ b/src/gpu/batches/GrDiscardBatch.h
@@ -15,11 +15,9 @@
 
 class GrDiscardBatch final : public GrBatch {
 public:
-    DEFINE_BATCH_CLASS_ID
-
     GrDiscardBatch(GrRenderTarget* rt)
-        : INHERITED(ClassID())
-        , fRenderTarget(rt) {
+        : fRenderTarget(rt) {
+        this->initClassID<GrDiscardBatch>();
         fBounds = SkRect::MakeWH(SkIntToScalar(rt->width()), SkIntToScalar(rt->height()));
     }
 
@@ -45,8 +43,6 @@
     }
 
     GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget;
-
-    typedef GrBatch INHERITED;
 };
 
 #endif
diff --git a/src/gpu/batches/GrDrawAtlasBatch.cpp b/src/gpu/batches/GrDrawAtlasBatch.cpp
index 2254e9c..3596e16 100644
--- a/src/gpu/batches/GrDrawAtlasBatch.cpp
+++ b/src/gpu/batches/GrDrawAtlasBatch.cpp
@@ -77,8 +77,8 @@
 
 GrDrawAtlasBatch::GrDrawAtlasBatch(const Geometry& geometry, const SkMatrix& viewMatrix,
                                    int spriteCount, const SkRSXform* xforms, const SkRect* rects,
-                                   const SkColor* colors)
-    : INHERITED(ClassID()) {
+                                   const SkColor* colors) {
+    this->initClassID<GrDrawAtlasBatch>();
     SkASSERT(xforms);
     SkASSERT(rects);
     
diff --git a/src/gpu/batches/GrDrawAtlasBatch.h b/src/gpu/batches/GrDrawAtlasBatch.h
index de128f2..9a864c0 100644
--- a/src/gpu/batches/GrDrawAtlasBatch.h
+++ b/src/gpu/batches/GrDrawAtlasBatch.h
@@ -14,13 +14,11 @@
 
 class GrDrawAtlasBatch : public GrVertexBatch {
 public:
-    DEFINE_BATCH_CLASS_ID
-
     struct Geometry {
         GrColor                 fColor;
         SkTArray<uint8_t, true> fVerts;
     };
-
+    
     static GrDrawBatch* Create(const Geometry& geometry, const SkMatrix& viewMatrix,
                                int spriteCount, const SkRSXform* xforms, const SkRect* rects,
                                const SkColor* colors) {
@@ -68,8 +66,6 @@
     bool     fColorIgnored;
     bool     fCoverageIgnored;
     bool     fHasColors;
-
-    typedef GrVertexBatch INHERITED;
 };
 
 #endif
diff --git a/src/gpu/batches/GrDrawBatch.cpp b/src/gpu/batches/GrDrawBatch.cpp
index 43ef2ec..5e5d412 100644
--- a/src/gpu/batches/GrDrawBatch.cpp
+++ b/src/gpu/batches/GrDrawBatch.cpp
@@ -7,7 +7,7 @@
 
 #include "GrDrawBatch.h"
 
-GrDrawBatch::GrDrawBatch(uint32_t classID) : INHERITED(classID), fPipelineInstalled(false) { }
+GrDrawBatch::GrDrawBatch() : fPipelineInstalled(false) { }
 
 GrDrawBatch::~GrDrawBatch() {
     if (fPipelineInstalled) {
diff --git a/src/gpu/batches/GrDrawBatch.h b/src/gpu/batches/GrDrawBatch.h
index 93326ef..f7c206d 100644
--- a/src/gpu/batches/GrDrawBatch.h
+++ b/src/gpu/batches/GrDrawBatch.h
@@ -40,7 +40,7 @@
 public:
     class Target;
 
-    GrDrawBatch(uint32_t classID);
+    GrDrawBatch();
     ~GrDrawBatch() override;
 
     virtual void getInvariantOutputColor(GrInitInvariantOutput* out) const = 0;
diff --git a/src/gpu/batches/GrDrawPathBatch.cpp b/src/gpu/batches/GrDrawPathBatch.cpp
index c56c4ad..a47e665 100644
--- a/src/gpu/batches/GrDrawPathBatch.cpp
+++ b/src/gpu/batches/GrDrawPathBatch.cpp
@@ -57,10 +57,11 @@
 
 GrDrawPathRangeBatch::GrDrawPathRangeBatch(const SkMatrix& viewMatrix, const SkMatrix& localMatrix,
                                            GrColor color, GrPathRangeDraw* pathRangeDraw)
-    : INHERITED(ClassID(), viewMatrix, color)
+    : INHERITED(viewMatrix, color)
     , fDraws(4)
     , fLocalMatrix(localMatrix) {
     SkDEBUGCODE(pathRangeDraw->fUsedInBatch = true;)
+    this->initClassID<GrDrawPathRangeBatch>();
     fDraws.addToHead(SkRef(pathRangeDraw));
     fTotalPathCount = pathRangeDraw->count();
     // Don't compute a bounding box. For dst copy texture, we'll opt instead for it to just copy
diff --git a/src/gpu/batches/GrDrawPathBatch.h b/src/gpu/batches/GrDrawPathBatch.h
index 228ad86..71ef9d4 100644
--- a/src/gpu/batches/GrDrawPathBatch.h
+++ b/src/gpu/batches/GrDrawPathBatch.h
@@ -30,9 +30,8 @@
     void setStencilSettings(const GrStencilSettings& stencil) { fStencilSettings = stencil; }
 
 protected:
-    GrDrawPathBatchBase(uint32_t classID, const SkMatrix& viewMatrix, GrColor initialColor)
-        : INHERITED(classID)
-        , fViewMatrix(viewMatrix)
+    GrDrawPathBatchBase(const SkMatrix& viewMatrix, GrColor initialColor)
+        : fViewMatrix(viewMatrix)
         , fColor(initialColor) {}
 
     const GrStencilSettings& stencilSettings() const { return fStencilSettings; }
@@ -56,8 +55,6 @@
 
 class GrDrawPathBatch final : public GrDrawPathBatchBase {
 public:
-    DEFINE_BATCH_CLASS_ID
-
     // This can't return a more abstract type because we install the stencil settings late :(
     static GrDrawPathBatchBase* Create(const SkMatrix& viewMatrix, GrColor color,
                                        const GrPath* path) {
@@ -70,10 +67,11 @@
 
 private:
     GrDrawPathBatch(const SkMatrix& viewMatrix, GrColor color, const GrPath* path)
-        : INHERITED(ClassID(), viewMatrix, color)
+        : INHERITED(viewMatrix, color)
         , fPath(path) {
         fBounds = path->getBounds();
         viewMatrix.mapRect(&fBounds);
+        this->initClassID<GrDrawPathBatch>();
     }
 
     bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { return false; }
@@ -149,9 +147,7 @@
 // Template this if we decide to support index types other than 16bit
 class GrDrawPathRangeBatch final : public GrDrawPathBatchBase {
 public:
-    DEFINE_BATCH_CLASS_ID
-
-    // This can't return a more abstract type because we install the stencil settings late :(
+    // This can't return a more abstracet type because we install the stencil settings late :(
     static GrDrawPathBatchBase* Create(const SkMatrix& viewMatrix, const SkMatrix& localMatrix,
                                        GrColor color, GrPathRangeDraw* pathRangeDraw) {
         return SkNEW_ARGS(GrDrawPathRangeBatch, (viewMatrix, localMatrix, color, pathRangeDraw));
diff --git a/src/gpu/batches/GrDrawVerticesBatch.cpp b/src/gpu/batches/GrDrawVerticesBatch.cpp
index 33bed0d..f79b685 100644
--- a/src/gpu/batches/GrDrawVerticesBatch.cpp
+++ b/src/gpu/batches/GrDrawVerticesBatch.cpp
@@ -45,8 +45,8 @@
                                          const SkPoint* positions, int vertexCount,
                                          const uint16_t* indices, int indexCount,
                                          const GrColor* colors, const SkPoint* localCoords,
-                                         const SkRect& bounds)
-    : INHERITED(ClassID()) {
+                                         const SkRect& bounds) {
+    this->initClassID<GrDrawVerticesBatch>();
     SkASSERT(positions);
 
     fBatch.fViewMatrix = viewMatrix;
diff --git a/src/gpu/batches/GrDrawVerticesBatch.h b/src/gpu/batches/GrDrawVerticesBatch.h
index 49e93c8..aaa7b09 100644
--- a/src/gpu/batches/GrDrawVerticesBatch.h
+++ b/src/gpu/batches/GrDrawVerticesBatch.h
@@ -20,8 +20,6 @@
 
 class GrDrawVerticesBatch : public GrVertexBatch {
 public:
-    DEFINE_BATCH_CLASS_ID
-
     struct Geometry {
         GrColor fColor;
         SkTDArray<SkPoint> fPositions;
@@ -93,8 +91,6 @@
 
     BatchTracker fBatch;
     SkSTArray<1, Geometry, true> fGeoData;
-
-    typedef GrVertexBatch INHERITED;
 };
 
 #endif
diff --git a/src/gpu/batches/GrStencilPathBatch.h b/src/gpu/batches/GrStencilPathBatch.h
index a0dcadb..9f6740a 100644
--- a/src/gpu/batches/GrStencilPathBatch.h
+++ b/src/gpu/batches/GrStencilPathBatch.h
@@ -17,8 +17,6 @@
 
 class GrStencilPathBatch final : public GrBatch {
 public:
-    DEFINE_BATCH_CLASS_ID
-
     static GrBatch* Create(const SkMatrix& viewMatrix,
                            bool useHWAA,
                            const GrStencilSettings& stencil,
@@ -45,13 +43,13 @@
                        const GrScissorState& scissor,
                        GrRenderTarget* renderTarget,
                        const GrPath* path)
-    : INHERITED(ClassID())
-    , fViewMatrix(viewMatrix)
+    : fViewMatrix(viewMatrix)
     , fUseHWAA(useHWAA)
     , fStencil(stencil)
     , fScissor(scissor)
     , fRenderTarget(renderTarget)
     , fPath(path) {
+        this->initClassID<GrStencilPathBatch>();
         fBounds = path->getBounds();
     }
 
@@ -71,8 +69,6 @@
     GrScissorState                                          fScissor;
     GrPendingIOResource<GrRenderTarget, kWrite_GrIOType>    fRenderTarget;
     GrPendingIOResource<const GrPath, kRead_GrIOType>       fPath;
-
-    typedef GrBatch INHERITED;
 };
 
 #endif
diff --git a/src/gpu/batches/GrStrokeRectBatch.cpp b/src/gpu/batches/GrStrokeRectBatch.cpp
index 20c754c..766302b 100644
--- a/src/gpu/batches/GrStrokeRectBatch.cpp
+++ b/src/gpu/batches/GrStrokeRectBatch.cpp
@@ -10,8 +10,9 @@
 #include "GrBatchFlushState.h"
 #include "SkRandom.h"
 
-GrStrokeRectBatch::GrStrokeRectBatch(const Geometry& geometry, bool snapToPixelCenters)
-    : INHERITED(ClassID()) {
+GrStrokeRectBatch::GrStrokeRectBatch(const Geometry& geometry, bool snapToPixelCenters) {
+    this->initClassID<GrStrokeRectBatch>();
+
     fBatch.fHairline = geometry.fStrokeWidth == 0;
 
     fGeoData.push_back(geometry);
diff --git a/src/gpu/batches/GrStrokeRectBatch.h b/src/gpu/batches/GrStrokeRectBatch.h
index b1cb8d4..b374ea8 100644
--- a/src/gpu/batches/GrStrokeRectBatch.h
+++ b/src/gpu/batches/GrStrokeRectBatch.h
@@ -14,8 +14,6 @@
 
 class GrStrokeRectBatch : public GrVertexBatch {
 public:
-    DEFINE_BATCH_CLASS_ID
-
     struct Geometry {
         GrColor fColor;
         SkMatrix fViewMatrix;
@@ -76,8 +74,6 @@
 
     BatchTracker fBatch;
     SkSTArray<1, Geometry, true> fGeoData;
-
-    typedef GrVertexBatch INHERITED;
 };
 
 #endif
diff --git a/src/gpu/batches/GrTInstanceBatch.h b/src/gpu/batches/GrTInstanceBatch.h
index 014ec12..e314959 100644
--- a/src/gpu/batches/GrTInstanceBatch.h
+++ b/src/gpu/batches/GrTInstanceBatch.h
@@ -40,8 +40,6 @@
 template <typename Impl>
 class GrTInstanceBatch : public GrVertexBatch {
 public:
-    DEFINE_BATCH_CLASS_ID
-
     typedef typename Impl::Geometry Geometry;
 
     static GrTInstanceBatch* Create() { return new GrTInstanceBatch; }
@@ -74,7 +72,9 @@
     }
 
 private:
-    GrTInstanceBatch() : INHERITED(ClassID()) {
+    GrTInstanceBatch() {
+        this->initClassID<GrTInstanceBatch<Impl>>();
+
         // Push back an initial geometry
         fGeoData.push_back();
     }
@@ -136,8 +136,6 @@
 
     GrPipelineOptimizations fOpts;
     SkSTArray<1, Geometry, true> fGeoData;
-
-    typedef GrVertexBatch INHERITED;
 };
 
 #endif
diff --git a/src/gpu/batches/GrTessellatingPathRenderer.cpp b/src/gpu/batches/GrTessellatingPathRenderer.cpp
index 901d383..46fa280 100644
--- a/src/gpu/batches/GrTessellatingPathRenderer.cpp
+++ b/src/gpu/batches/GrTessellatingPathRenderer.cpp
@@ -1385,7 +1385,6 @@
 
 class TessellatingPathBatch : public GrVertexBatch {
 public:
-    DEFINE_BATCH_CLASS_ID
 
     static GrDrawBatch* Create(const GrColor& color,
                                const SkPath& path,
@@ -1588,12 +1587,13 @@
                           const GrStrokeInfo& stroke,
                           const SkMatrix& viewMatrix,
                           const SkRect& clipBounds)
-      : INHERITED(ClassID())
-      , fColor(color)
+      : fColor(color)
       , fPath(path)
       , fStroke(stroke)
       , fViewMatrix(viewMatrix)
       , fClipBounds(clipBounds) {
+        this->initClassID<TessellatingPathBatch>();
+
         fBounds = path.getBounds();
         if (!stroke.isFillStyle()) {
             SkScalar radius = SkScalarHalf(stroke.getWidth());
@@ -1614,8 +1614,6 @@
     SkMatrix                fViewMatrix;
     SkRect                  fClipBounds; // in source space
     GrPipelineOptimizations fPipelineInfo;
-
-    typedef GrVertexBatch INHERITED;
 };
 
 bool GrTessellatingPathRenderer::onDrawPath(const DrawPathArgs& args) {
diff --git a/src/gpu/batches/GrTestBatch.h b/src/gpu/batches/GrTestBatch.h
index 02881c9..085b184 100644
--- a/src/gpu/batches/GrTestBatch.h
+++ b/src/gpu/batches/GrTestBatch.h
@@ -50,8 +50,7 @@
     }
 
 protected:
-    GrTestBatch(uint32_t classID, const GrGeometryProcessor* gp, const SkRect& bounds)
-        : INHERITED(classID) {
+    GrTestBatch(const GrGeometryProcessor* gp, const SkRect& bounds) {
         fGeometryProcessor.reset(SkRef(gp));
 
         this->setBounds(bounds);
@@ -83,8 +82,6 @@
 
     SkAutoTUnref<const GrGeometryProcessor> fGeometryProcessor;
     BatchTracker fBatch;
-
-    typedef GrVertexBatch INHERITED;
 };
 
 #endif
diff --git a/src/gpu/batches/GrVertexBatch.cpp b/src/gpu/batches/GrVertexBatch.cpp
index 9ffe518..6e2c157 100644
--- a/src/gpu/batches/GrVertexBatch.cpp
+++ b/src/gpu/batches/GrVertexBatch.cpp
@@ -9,7 +9,7 @@
 #include "GrBatchFlushState.h"
 #include "GrResourceProvider.h"
 
-GrVertexBatch::GrVertexBatch(uint32_t classID) : INHERITED(classID), fDrawArrays(1) {}
+GrVertexBatch::GrVertexBatch() : fDrawArrays(1) {}
 
 void GrVertexBatch::onPrepare(GrBatchFlushState* state) {
     Target target(state, this);
diff --git a/src/gpu/batches/GrVertexBatch.h b/src/gpu/batches/GrVertexBatch.h
index 8922c30..e2265bc 100644
--- a/src/gpu/batches/GrVertexBatch.h
+++ b/src/gpu/batches/GrVertexBatch.h
@@ -24,7 +24,7 @@
 public:
     class Target;
 
-    GrVertexBatch(uint32_t classID);
+    GrVertexBatch();
 
 protected:
     /** Helper for rendering instances using an instanced index index buffer. This class creates the
diff --git a/src/gpu/effects/GrDashingEffect.cpp b/src/gpu/effects/GrDashingEffect.cpp
index 106ee49..3ca4c7a 100644
--- a/src/gpu/effects/GrDashingEffect.cpp
+++ b/src/gpu/effects/GrDashingEffect.cpp
@@ -245,9 +245,8 @@
 
 class DashBatch : public GrVertexBatch {
 public:
-    DEFINE_BATCH_CLASS_ID
-
     struct Geometry {
+        GrColor fColor;
         SkMatrix fViewMatrix;
         SkMatrix fSrcRotInv;
         SkPoint fPtsRot[2];
@@ -256,7 +255,6 @@
         SkScalar fIntervals[2];
         SkScalar fParallelScale;
         SkScalar fPerpendicularScale;
-        GrColor fColor;
     };
 
     static GrDrawBatch* Create(const Geometry& geometry, SkPaint::Cap cap, DashAAMode aaMode,
@@ -277,8 +275,8 @@
     SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
 
 private:
-    DashBatch(const Geometry& geometry, SkPaint::Cap cap, DashAAMode aaMode, bool fullDash)
-        : INHERITED(ClassID()) {
+    DashBatch(const Geometry& geometry, SkPaint::Cap cap, DashAAMode aaMode, bool fullDash) {
+        this->initClassID<DashBatch>();
         fGeoData.push_back(geometry);
 
         fBatch.fAAMode = aaMode;
@@ -676,8 +674,6 @@
 
     BatchTracker fBatch;
     SkSTArray<1, Geometry, true> fGeoData;
-
-    typedef GrVertexBatch INHERITED;
 };
 
 static GrDrawBatch* create_batch(GrColor color, const SkMatrix& viewMatrix, const SkPoint pts[2],
diff --git a/tests/GrPorterDuffTest.cpp b/tests/GrPorterDuffTest.cpp
index a61ab548..1328272a 100644
--- a/tests/GrPorterDuffTest.cpp
+++ b/tests/GrPorterDuffTest.cpp
@@ -1093,13 +1093,7 @@
 }
 
 static void test_lcd_coverage_fallback_case(skiatest::Reporter* reporter, const GrCaps& caps) {
-    class TestLCDCoverageBatch: public GrVertexBatch {
-    public:
-        DEFINE_BATCH_CLASS_ID
-
-        TestLCDCoverageBatch() : INHERITED(ClassID()) {}
-
-    private:
+    class : public GrVertexBatch {
         void getInvariantOutputColor(GrInitInvariantOutput* out) const override {
             out->setKnownFourComponents(GrColorPackRGBA(123, 45, 67, 221));
         }
@@ -1114,7 +1108,6 @@
         bool onCombineIfPossible(GrBatch*, const GrCaps&) override  { return false; }
         void onPrepareDraws(Target*) override {};
 
-        typedef GrVertexBatch INHERITED;
     } testLCDCoverageBatch;
 
     GrProcOptInfo colorPOI, covPOI;