diff --git a/include/core/SkImage.h b/include/core/SkImage.h
index 8fdd9b1..89e3181 100644
--- a/include/core/SkImage.h
+++ b/include/core/SkImage.h
@@ -37,6 +37,8 @@
  */
 class SkImage : public SkRefCnt {
 public:
+    SK_DECLARE_INST_COUNT(SkImage)
+
     enum ColorType {
         kAlpha_8_ColorType,
         kRGB_565_ColorType,
diff --git a/include/core/SkInstCnt.h b/include/core/SkInstCnt.h
index 72227c9..9be51ea 100644
--- a/include/core/SkInstCnt.h
+++ b/include/core/SkInstCnt.h
@@ -27,14 +27,20 @@
 // The non-root classes just register themselves with their parent
 #define SK_DECLARE_INST_COUNT(className)                                    \
     SK_DECLARE_INST_COUNT_INTERNAL(className,                               \
-                                INHERITED::AddInstChild(CheckInstanceCount);)
+                               INHERITED::AddInstChild(CheckInstanceCount);,\
+                               /**/)
+
+#define SK_DECLARE_INST_COUNT_TEMPLATE(className)                           \
+    SK_DECLARE_INST_COUNT_INTERNAL(className,                               \
+                              INHERITED::AddInstChild(CheckInstanceCount);, \
+                              typename)
 
 // The root classes registers a function to print out the memory stats when
 // the app ends
 #define SK_DECLARE_INST_COUNT_ROOT(className)                               \
-    SK_DECLARE_INST_COUNT_INTERNAL(className, atexit(exitPrint);)
+    SK_DECLARE_INST_COUNT_INTERNAL(className, atexit(exitPrint);, /**/)
 
-#define SK_DECLARE_INST_COUNT_INTERNAL(className, initStep)                 \
+#define SK_DECLARE_INST_COUNT_INTERNAL(className, initStep, templateType)   \
     class SkInstanceCountHelper {                                           \
     public:                                                                 \
         typedef int (*PFCheckInstCnt)(int level, bool cleanUp);             \
@@ -93,7 +99,7 @@
         return SkInstanceCountHelper::gInstanceCount;                       \
     }                                                                       \
                                                                             \
-    static void AddInstChild(SkInstanceCountHelper::PFCheckInstCnt          \
+    static void AddInstChild(templateType SkInstanceCountHelper::PFCheckInstCnt \
                                                        childCheckInstCnt) { \
         if (CheckInstanceCount != childCheckInstCnt &&                      \
             NULL != SkInstanceCountHelper::gChildren) {                     \
@@ -109,6 +115,7 @@
 
 #else
 #define SK_DECLARE_INST_COUNT(className)
+#define SK_DECLARE_INST_COUNT_TEMPLATE(className)
 #define SK_DECLARE_INST_COUNT_ROOT(className)
 #define SK_DEFINE_INST_COUNT(className)
 #endif
diff --git a/include/core/SkSurface.h b/include/core/SkSurface.h
index 0c20d4a..884045f 100644
--- a/include/core/SkSurface.h
+++ b/include/core/SkSurface.h
@@ -26,6 +26,8 @@
  */
 class SkSurface : public SkRefCnt {
 public:
+    SK_DECLARE_INST_COUNT(SkSurface)
+
     /**
      *  Create a new surface, using the specified pixels/rowbytes as its
      *  backend.
diff --git a/include/utils/SkBoundaryPatch.h b/include/utils/SkBoundaryPatch.h
index 9d4b5ad..7997cf8 100644
--- a/include/utils/SkBoundaryPatch.h
+++ b/include/utils/SkBoundaryPatch.h
@@ -13,6 +13,8 @@
 
 class SkBoundary : public SkRefCnt {
 public:
+    SK_DECLARE_INST_COUNT(SkBoundary)
+
     // These must be 0, 1, 2, 3 for efficiency in the subclass implementations
     enum Edge {
         kTop    = 0,
@@ -22,6 +24,9 @@
     };
     // Edge index goes clockwise around the boundary, beginning at the "top"
     virtual SkPoint eval(Edge, SkScalar unitInterval) = 0;
+
+private:
+    typedef SkRefCnt INHERITED;
 };
 
 class SkBoundaryPatch {
diff --git a/include/utils/SkLayer.h b/include/utils/SkLayer.h
index 9cba463..70fa01b 100644
--- a/include/utils/SkLayer.h
+++ b/include/utils/SkLayer.h
@@ -23,6 +23,8 @@
 class SkLayer : public SkRefCnt {
 
 public:
+    SK_DECLARE_INST_COUNT(SkLayer)
+
     SkLayer();
     SkLayer(const SkLayer&);
     virtual ~SkLayer();
diff --git a/include/views/SkEventSink.h b/include/views/SkEventSink.h
index 69981fa..8ef92b4 100644
--- a/include/views/SkEventSink.h
+++ b/include/views/SkEventSink.h
@@ -21,7 +21,9 @@
 */
 class SkEventSink : public SkRefCnt {
 public:
-            SkEventSink();
+    SK_DECLARE_INST_COUNT(SkEventSink)
+
+             SkEventSink();
     virtual ~SkEventSink();
 
     /**
@@ -103,6 +105,8 @@
 
     // for our private link-list
     SkEventSink*    fNextSink;
+
+    typedef SkRefCnt INHERITED;
 };
 
 #endif
diff --git a/include/views/SkView.h b/include/views/SkView.h
index 1241cab..de497dd 100644
--- a/include/views/SkView.h
+++ b/include/views/SkView.h
@@ -254,11 +254,15 @@
     */
     class Artist : public SkRefCnt {
     public:
+        SK_DECLARE_INST_COUNT(Artist)
+
         void draw(SkView*, SkCanvas*);
         void inflate(const SkDOM&, const SkDOM::Node*);
     protected:
         virtual void onDraw(SkView*, SkCanvas*) = 0;
         virtual void onInflate(const SkDOM&, const SkDOM::Node*);
+    private:
+        typedef SkRefCnt INHERITED;
     };
     /** Return the artist attached to this view (or null). The artist's reference
         count is not affected.
@@ -278,11 +282,15 @@
     */
     class Layout : public SkRefCnt {
     public:
+        SK_DECLARE_INST_COUNT(Layout)
+
         void layoutChildren(SkView* parent);
         void inflate(const SkDOM&, const SkDOM::Node*);
     protected:
         virtual void onLayoutChildren(SkView* parent) = 0;
         virtual void onInflate(const SkDOM&, const SkDOM::Node*);
+    private:
+        typedef SkRefCnt INHERITED;
     };
 
     /** Return the layout attached to this view (or null). The layout's reference
diff --git a/include/views/animated/SkWidgetViews.h b/include/views/animated/SkWidgetViews.h
index 295c101..93adeef 100644
--- a/include/views/animated/SkWidgetViews.h
+++ b/include/views/animated/SkWidgetViews.h
@@ -289,6 +289,8 @@
 
 class SkListSource : public SkRefCnt {
 public:
+    SK_DECLARE_INST_COUNT(SkListSource)
+
     virtual int countFields();
     virtual void getFieldName(int index, SkString* field);
     /** Return the index of the named field, or -1 if not found */
@@ -300,6 +302,8 @@
     virtual bool prepareWidgetEvent(SkEvent*, int rowIndex);
     
     static SkListSource* Factory(const char name[]);
+private:
+    typedef SkRefCnt INHERITED;
 };
 
 #endif
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index e237ac5..254d209 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -38,6 +38,8 @@
 #include "SkGPipe.h"
 #include "SamplePipeControllers.h"
 
+SK_DEFINE_INST_COUNT(SampleWindow::DeviceManager)
+
 extern SampleView* CreateSamplePictFileView(const char filename[]);
 
 class PictFileFactory : public SkViewFactory {
diff --git a/samplecode/SampleApp.h b/samplecode/SampleApp.h
index 00353b2..cb4446f 100644
--- a/samplecode/SampleApp.h
+++ b/samplecode/SampleApp.h
@@ -54,6 +54,8 @@
      */
     class DeviceManager : public SkRefCnt {
     public:
+        SK_DECLARE_INST_COUNT(DeviceManager)
+
         virtual void setUpBackend(SampleWindow* win, int msaaSampleCount) = 0;
 
         virtual void tearDownBackend(SampleWindow* win) = 0;
@@ -79,6 +81,8 @@
 
         // return the GrRenderTarget backing gpu devices (NULL if not built with GPU support)
         virtual GrRenderTarget* getGrRenderTarget() = 0;
+    private:
+        typedef SkRefCnt INHERITED;
     };
 
     SampleWindow(void* hwnd, int argc, char** argv, DeviceManager*);
diff --git a/src/core/SkBitmapHeap.cpp b/src/core/SkBitmapHeap.cpp
index 7caf1a5..1867af2 100644
--- a/src/core/SkBitmapHeap.cpp
+++ b/src/core/SkBitmapHeap.cpp
@@ -12,6 +12,9 @@
 #include "SkFlattenableBuffers.h"
 #include "SkTSearch.h"
 
+SK_DEFINE_INST_COUNT(SkBitmapHeapReader)
+SK_DEFINE_INST_COUNT(SkBitmapHeap::ExternalStorage)
+
 SkBitmapHeapEntry::SkBitmapHeapEntry()
     : fSlot(-1)
     , fRefCount(0)
diff --git a/src/core/SkBitmapHeap.h b/src/core/SkBitmapHeap.h
index a16727b..61e1dd9 100644
--- a/src/core/SkBitmapHeap.h
+++ b/src/core/SkBitmapHeap.h
@@ -52,6 +52,8 @@
 
 class SkBitmapHeapReader : public SkRefCnt {
 public:
+    SK_DECLARE_INST_COUNT(SkBitmapHeapReader)
+
     SkBitmapHeapReader() : INHERITED() {}
     virtual SkBitmap* getBitmap(int32_t slot) const = 0;
     virtual void releaseRef(int32_t slot) = 0;
@@ -67,7 +69,12 @@
 public:
     class ExternalStorage : public SkRefCnt {
      public:
+        SK_DECLARE_INST_COUNT(ExternalStorage)
+
         virtual bool insert(const SkBitmap& bitmap, int32_t slot) = 0;
+
+     private:
+        typedef SkRefCnt INHERITED;
     };
 
     static const int32_t UNLIMITED_SIZE = -1;
diff --git a/src/core/SkMaskGamma.h b/src/core/SkMaskGamma.h
index 7498f64..f3fab03 100644
--- a/src/core/SkMaskGamma.h
+++ b/src/core/SkMaskGamma.h
@@ -105,6 +105,8 @@
  */
 template <int R_LUM_BITS, int G_LUM_BITS, int B_LUM_BITS> class SkTMaskGamma : public SkRefCnt {
 public:
+    SK_DECLARE_INST_COUNT_TEMPLATE(SkTMaskGamma)
+
     /**
      * Creates tables to convert linear alpha values to gamma correcting alpha
      * values.
@@ -151,6 +153,8 @@
                            : (R_LUM_BITS > G_LUM_BITS ? R_LUM_BITS : G_LUM_BITS)
     };
     uint8_t fGammaTables[1 << kLuminanceBits_Max][256];
+
+    typedef SkRefCnt INHERITED;
 };
 
 /**
diff --git a/src/core/SkPictureFlat.cpp b/src/core/SkPictureFlat.cpp
index 87664ca..c66689f 100644
--- a/src/core/SkPictureFlat.cpp
+++ b/src/core/SkPictureFlat.cpp
@@ -16,6 +16,8 @@
 #include "SkTypeface.h"
 #include "SkXfermode.h"
 
+SK_DEFINE_INST_COUNT(SkFlatController)
+
 ///////////////////////////////////////////////////////////////////////////////
 
 SkTypefacePlayback::SkTypefacePlayback() : fCount(0), fArray(NULL) {}
diff --git a/src/core/SkPictureFlat.h b/src/core/SkPictureFlat.h
index 53fd69a..b4f0625 100644
--- a/src/core/SkPictureFlat.h
+++ b/src/core/SkPictureFlat.h
@@ -158,6 +158,8 @@
 
 class SkFlatController : public SkRefCnt {
 public:
+    SK_DECLARE_INST_COUNT(SkFlatController)
+
     SkFlatController();
     virtual ~SkFlatController();
     /**
@@ -244,6 +246,8 @@
     SkTypefacePlayback* fTypefacePlayback;
     SkNamedFactorySet*  fFactorySet;
     uint32_t            fWriteBufferFlags;
+
+    typedef SkRefCnt INHERITED;
 };
 
 class SkFlatData {
diff --git a/src/core/SkPtrRecorder.cpp b/src/core/SkPtrRecorder.cpp
index 169944a..6ee58f8 100644
--- a/src/core/SkPtrRecorder.cpp
+++ b/src/core/SkPtrRecorder.cpp
@@ -9,6 +9,7 @@
 #include "SkTSearch.h"
 
 SK_DEFINE_INST_COUNT(SkPtrSet)
+SK_DEFINE_INST_COUNT(SkNamedFactorySet)
 
 void SkPtrSet::reset() {
     Pair* p = fList.begin();
diff --git a/src/core/SkPtrRecorder.h b/src/core/SkPtrRecorder.h
index 8a48325..c4c0bd8 100644
--- a/src/core/SkPtrRecorder.h
+++ b/src/core/SkPtrRecorder.h
@@ -123,6 +123,8 @@
  */
 class SkNamedFactorySet : public SkRefCnt {
 public:
+    SK_DECLARE_INST_COUNT(SkNamedFactorySet)
+
     SkNamedFactorySet();
     
     /**
@@ -142,6 +144,8 @@
     int                    fNextAddedFactory;
     SkFactorySet           fFactorySet;
     SkTDArray<const char*> fNames;
+
+    typedef SkRefCnt INHERITED;
 };
 
 #endif
diff --git a/src/core/SkScalerContext.cpp b/src/core/SkScalerContext.cpp
index 3fbcf3b..e2725ff 100644
--- a/src/core/SkScalerContext.cpp
+++ b/src/core/SkScalerContext.cpp
@@ -22,6 +22,8 @@
 #include "SkStroke.h"
 #include "SkThread.h"
 
+SK_DEFINE_INST_COUNT(SkMaskGamma)
+
 #define ComputeBWRowBytes(width)        (((unsigned)(width) + 7) >> 3)
 
 void SkGlyph::toMask(SkMask* mask) const {
@@ -301,9 +303,9 @@
         }
     }
 
-	if (SkMask::kARGB32_Format != glyph->fMaskFormat) {
-		glyph->fMaskFormat = fRec.fMaskFormat;
-	}
+    if (SkMask::kARGB32_Format != glyph->fMaskFormat) {
+        glyph->fMaskFormat = fRec.fMaskFormat;
+    }
 
     if (fMaskFilter) {
         SkMask      src, dst;
@@ -764,10 +766,10 @@
 extern SkScalerContext* SkCreateColorScalerContext(const SkDescriptor* desc);
 
 SkScalerContext* SkScalerContext::Create(const SkDescriptor* desc) {
-	SkScalerContext* c = NULL;  //SkCreateColorScalerContext(desc);
-	if (NULL == c) {
-		c = SkFontHost::CreateScalerContext(desc);
-	}
+    SkScalerContext* c = NULL;  //SkCreateColorScalerContext(desc);
+    if (NULL == c) {
+        c = SkFontHost::CreateScalerContext(desc);
+    }
     if (NULL == c) {
         c = SkNEW_ARGS(SkScalerContext_Empty, (desc));
     }
diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp
index a8693e5..b6fc489 100644
--- a/src/image/SkImage.cpp
+++ b/src/image/SkImage.cpp
@@ -10,6 +10,8 @@
 #include "SkBitmap.h"
 #include "SkCanvas.h"
 
+SK_DEFINE_INST_COUNT(SkImage)
+
 static SkImage_Base* asIB(SkImage* image) {
     return static_cast<SkImage_Base*>(image);
 }
diff --git a/src/image/SkSurface.cpp b/src/image/SkSurface.cpp
index e7695c9..299a8d2 100644
--- a/src/image/SkSurface.cpp
+++ b/src/image/SkSurface.cpp
@@ -9,6 +9,8 @@
 #include "SkImagePriv.h"
 #include "SkCanvas.h"
 
+SK_DEFINE_INST_COUNT(SkSurface)
+
 ///////////////////////////////////////////////////////////////////////////////
 
 SkSurface_Base::SkSurface_Base(int width, int height) : INHERITED(width, height) {
diff --git a/src/utils/SkBoundaryPatch.cpp b/src/utils/SkBoundaryPatch.cpp
index 37f59b4..c305c8b 100644
--- a/src/utils/SkBoundaryPatch.cpp
+++ b/src/utils/SkBoundaryPatch.cpp
@@ -7,6 +7,8 @@
  */
 #include "SkBoundaryPatch.h"
 
+SK_DEFINE_INST_COUNT(SkBoundary)
+
 SkBoundaryPatch::SkBoundaryPatch() : fBoundary(NULL) {}
 
 SkBoundaryPatch::~SkBoundaryPatch() {
diff --git a/src/utils/SkLayer.cpp b/src/utils/SkLayer.cpp
index a311cef..54f1840 100644
--- a/src/utils/SkLayer.cpp
+++ b/src/utils/SkLayer.cpp
@@ -15,6 +15,8 @@
     static int gLayerAllocCount;
 #endif
 
+SK_DEFINE_INST_COUNT(SkLayer)
+
 ///////////////////////////////////////////////////////////////////////////////
 
 SkLayer::SkLayer() {
diff --git a/src/views/SkEventSink.cpp b/src/views/SkEventSink.cpp
index 20d8cdf..8f39156 100644
--- a/src/views/SkEventSink.cpp
+++ b/src/views/SkEventSink.cpp
@@ -14,6 +14,8 @@
 #include "SkThread.h"
 #include "SkTime.h"
 
+SK_DEFINE_INST_COUNT(SkEventSink)
+
 class SkEventSink_Globals {
 public:
     SkEventSink_Globals() {
diff --git a/src/views/SkView.cpp b/src/views/SkView.cpp
index 855d6a9..dae47d6 100644
--- a/src/views/SkView.cpp
+++ b/src/views/SkView.cpp
@@ -8,52 +8,55 @@
 #include "SkView.h"
 #include "SkCanvas.h"
 
+SK_DEFINE_INST_COUNT(SkView::Artist)
+SK_DEFINE_INST_COUNT(SkView::Layout)
+
 ////////////////////////////////////////////////////////////////////////
 
 SkView::SkView(uint32_t flags) : fFlags(SkToU8(flags))
 {
-	fWidth = fHeight = 0;
-	fLoc.set(0, 0);
-	fParent = fFirstChild = fNextSibling = fPrevSibling = NULL;
+    fWidth = fHeight = 0;
+    fLoc.set(0, 0);
+    fParent = fFirstChild = fNextSibling = fPrevSibling = NULL;
     fMatrix.setIdentity();
-	fContainsFocus = 0;
+    fContainsFocus = 0;
 }
 
 SkView::~SkView()
 {
-	this->detachAllChildren();
+    this->detachAllChildren();
 }
 
 void SkView::setFlags(uint32_t flags)
 {
-	SkASSERT((flags & ~kAllFlagMasks) == 0);
+    SkASSERT((flags & ~kAllFlagMasks) == 0);
 
-	uint32_t diff = fFlags ^ flags;
+    uint32_t diff = fFlags ^ flags;
 
-	if (diff & kVisible_Mask)
-		this->inval(NULL);
+    if (diff & kVisible_Mask)
+        this->inval(NULL);
 
-	fFlags = SkToU8(flags);
+    fFlags = SkToU8(flags);
 
-	if (diff & kVisible_Mask)
-	{
-		this->inval(NULL);
-	}
+    if (diff & kVisible_Mask)
+    {
+        this->inval(NULL);
+    }
 }
 
 void SkView::setVisibleP(bool pred)
 {
-	this->setFlags(SkSetClearShift(fFlags, pred, kVisible_Shift));
+    this->setFlags(SkSetClearShift(fFlags, pred, kVisible_Shift));
 }
 
 void SkView::setEnabledP(bool pred)
 {
-	this->setFlags(SkSetClearShift(fFlags, pred, kEnabled_Shift));
+    this->setFlags(SkSetClearShift(fFlags, pred, kEnabled_Shift));
 }
 
 void SkView::setFocusableP(bool pred)
 {
-	this->setFlags(SkSetClearShift(fFlags, pred, kFocusable_Shift));
+    this->setFlags(SkSetClearShift(fFlags, pred, kFocusable_Shift));
 }
 
 void SkView::setClipToBounds(bool pred) {
@@ -62,34 +65,34 @@
 
 void SkView::setSize(SkScalar width, SkScalar height)
 {
-	width = SkMaxScalar(0, width);
-	height = SkMaxScalar(0, height);
+    width = SkMaxScalar(0, width);
+    height = SkMaxScalar(0, height);
 
-	if (fWidth != width || fHeight != height)
-	{
-		this->inval(NULL);
-		fWidth = width;
-		fHeight = height;
-		this->inval(NULL);
-		this->onSizeChange();
-		this->invokeLayout();
-	}
+    if (fWidth != width || fHeight != height)
+    {
+        this->inval(NULL);
+        fWidth = width;
+        fHeight = height;
+        this->inval(NULL);
+        this->onSizeChange();
+        this->invokeLayout();
+    }
 }
 
 void SkView::setLoc(SkScalar x, SkScalar y)
 {
-	if (fLoc.fX != x || fLoc.fY != y)
-	{
-		this->inval(NULL);
-		fLoc.set(x, y);
+    if (fLoc.fX != x || fLoc.fY != y)
+    {
         this->inval(NULL);
-	}
+        fLoc.set(x, y);
+        this->inval(NULL);
+    }
 }
 
 void SkView::offset(SkScalar dx, SkScalar dy)
 {
-	if (dx || dy)
-		this->setLoc(fLoc.fX + dx, fLoc.fY + dy);
+    if (dx || dy)
+        this->setLoc(fLoc.fX + dx, fLoc.fY + dy);
 }
 
 void SkView::setLocalMatrix(const SkMatrix& matrix) 
@@ -101,16 +104,16 @@
 
 void SkView::draw(SkCanvas* canvas)
 {
-	if (fWidth && fHeight && this->isVisible())
-	{
-		SkRect	r;
-		r.set(fLoc.fX, fLoc.fY, fLoc.fX + fWidth, fLoc.fY + fHeight);
-		if (this->isClipToBounds() &&
+    if (fWidth && fHeight && this->isVisible())
+    {
+        SkRect	r;
+        r.set(fLoc.fX, fLoc.fY, fLoc.fX + fWidth, fLoc.fY + fHeight);
+        if (this->isClipToBounds() &&
             canvas->quickReject(r, SkCanvas::kBW_EdgeType)) {
                 return;
         }
 
-		SkAutoCanvasRestore	as(canvas, true);
+        SkAutoCanvasRestore	as(canvas, true);
 
         if (this->isClipToBounds()) {
             canvas->clipRect(r);
@@ -124,30 +127,30 @@
         }
 
         int sc = canvas->save();
-		this->onDraw(canvas);
+        this->onDraw(canvas);
         canvas->restoreToCount(sc);
 
         if (fParent) {
             fParent->afterChild(this, canvas);
         }
         
-		B2FIter	iter(this);
-		SkView*	child;
+        B2FIter	iter(this);
+        SkView*	child;
 
         SkCanvas* childCanvas = this->beforeChildren(canvas);
 
-		while ((child = iter.next()) != NULL)
-			child->draw(childCanvas);
+        while ((child = iter.next()) != NULL)
+            child->draw(childCanvas);
         
         this->afterChildren(canvas);
-	}
+    }
 }
 
 void SkView::inval(SkRect* rect) {
-	SkView*	view = this;
+    SkView*	view = this;
     SkRect storage;
 
-	for (;;) {
+    for (;;) {
         if (!view->isVisible()) {
             return;
         }
@@ -164,7 +167,7 @@
             return;
         }
 
-		SkView* parent = view->fParent;
+        SkView* parent = view->fParent;
         if (parent == NULL) {
             return;
         }
@@ -173,139 +176,139 @@
             rect->offset(view->fLoc.fX, view->fLoc.fY);
         }
         view = parent;
-	}
+    }
 }
 
 ////////////////////////////////////////////////////////////////////////////
 
 bool SkView::setFocusView(SkView* fv)
 {
-	SkView* view = this;
-	
-	do {
-		if (view->onSetFocusView(fv))
-			return true;
-	} while ((view = view->fParent) != NULL);
-	return false;
+    SkView* view = this;
+    
+    do {
+        if (view->onSetFocusView(fv))
+            return true;
+    } while ((view = view->fParent) != NULL);
+    return false;
 }
 
 SkView* SkView::getFocusView() const
 {
-	SkView*			focus = NULL;
-	const SkView*	view = this;
-	do {
-		if (view->onGetFocusView(&focus))
-			break;
-	} while ((view = view->fParent) != NULL);
-	return focus;
+    SkView*			focus = NULL;
+    const SkView*	view = this;
+    do {
+        if (view->onGetFocusView(&focus))
+            break;
+    } while ((view = view->fParent) != NULL);
+    return focus;
 }
 
 bool SkView::hasFocus() const
 {
-	return this == this->getFocusView();
+    return this == this->getFocusView();
 }
 
 bool SkView::acceptFocus()
 {
-	return this->isFocusable() && this->setFocusView(this);
+    return this->isFocusable() && this->setFocusView(this);
 }
 
 /*
-	Try to give focus to this view, or its children
+    Try to give focus to this view, or its children
 */
 SkView* SkView::acceptFocus(FocusDirection dir)
 {
-	if (dir == kNext_FocusDirection)
-	{
-		if (this->acceptFocus())
-			return this;
+    if (dir == kNext_FocusDirection)
+    {
+        if (this->acceptFocus())
+            return this;
 
-		B2FIter	iter(this);
-		SkView*	child, *focus;
-		while ((child = iter.next()) != NULL)
-			if ((focus = child->acceptFocus(dir)) != NULL)
-				return focus;
-	}
-	else // prev
-	{
-		F2BIter	iter(this);
-		SkView*	child, *focus;
-		while ((child = iter.next()) != NULL)
-			if ((focus = child->acceptFocus(dir)) != NULL)
-				return focus;
+        B2FIter	iter(this);
+        SkView*	child, *focus;
+        while ((child = iter.next()) != NULL)
+            if ((focus = child->acceptFocus(dir)) != NULL)
+                return focus;
+    }
+    else // prev
+    {
+        F2BIter	iter(this);
+        SkView*	child, *focus;
+        while ((child = iter.next()) != NULL)
+            if ((focus = child->acceptFocus(dir)) != NULL)
+                return focus;
 
-		if (this->acceptFocus())
-			return this;
-	}
+        if (this->acceptFocus())
+            return this;
+    }
 
-	return NULL;
+    return NULL;
 }
 
 SkView* SkView::moveFocus(FocusDirection dir)
 {
-	SkView* focus = this->getFocusView();
+    SkView* focus = this->getFocusView();
 
-	if (focus == NULL)
-	{	// start with the root
-		focus = this;
-		while (focus->fParent)
-			focus = focus->fParent;
-	}
+    if (focus == NULL)
+    {	// start with the root
+        focus = this;
+        while (focus->fParent)
+            focus = focus->fParent;
+    }
 
-	SkView*	child, *parent;
+    SkView*	child, *parent;
 
-	if (dir == kNext_FocusDirection)
-	{
-		parent = focus;
-		child = focus->fFirstChild;
-		if (child)
-			goto FIRST_CHILD;
-		else
-			goto NEXT_SIB;
+    if (dir == kNext_FocusDirection)
+    {
+        parent = focus;
+        child = focus->fFirstChild;
+        if (child)
+            goto FIRST_CHILD;
+        else
+            goto NEXT_SIB;
 
-		do {
-			while (child != parent->fFirstChild)
-			{
-	FIRST_CHILD:
-				if ((focus = child->acceptFocus(dir)) != NULL)
-					return focus;
-				child = child->fNextSibling;
-			}
-	NEXT_SIB:
-			child = parent->fNextSibling;
-			parent = parent->fParent;
-		} while (parent != NULL);
-	}
-	else	// prevfocus
-	{
-		parent = focus->fParent;
-		if (parent == NULL)	// we're the root
-			return focus->acceptFocus(dir);
-		else
-		{
-			child = focus;
-			while (parent)
-			{
-				while (child != parent->fFirstChild)
-				{
-					child = child->fPrevSibling;
-					if ((focus = child->acceptFocus(dir)) != NULL)
-						return focus;
-				}
-				if (parent->acceptFocus())
-					return parent;
+        do {
+            while (child != parent->fFirstChild)
+            {
+    FIRST_CHILD:
+                if ((focus = child->acceptFocus(dir)) != NULL)
+                    return focus;
+                child = child->fNextSibling;
+            }
+    NEXT_SIB:
+            child = parent->fNextSibling;
+            parent = parent->fParent;
+        } while (parent != NULL);
+    }
+    else	// prevfocus
+    {
+        parent = focus->fParent;
+        if (parent == NULL)	// we're the root
+            return focus->acceptFocus(dir);
+        else
+        {
+            child = focus;
+            while (parent)
+            {
+                while (child != parent->fFirstChild)
+                {
+                    child = child->fPrevSibling;
+                    if ((focus = child->acceptFocus(dir)) != NULL)
+                        return focus;
+                }
+                if (parent->acceptFocus())
+                    return parent;
 
-				child = parent;
-				parent = parent->fParent;
-			}
-		}
-	}
-	return NULL;
+                child = parent;
+                parent = parent->fParent;
+            }
+        }
+    }
+    return NULL;
 }
 
 void SkView::onFocusChange(bool gainFocusP)
 {
-	this->inval(NULL);
+    this->inval(NULL);
 }
 
 ////////////////////////////////////////////////////////////////////////////
@@ -321,52 +324,52 @@
 
 SkView::Click::~Click()
 {
-	this->resetType();
+    this->resetType();
 }
 
 void SkView::Click::resetType()
 {
-	if (fWeOwnTheType)
-	{
-		sk_free(fType);
-		fWeOwnTheType = false;
-	}
-	fType = NULL;
+    if (fWeOwnTheType)
+    {
+        sk_free(fType);
+        fWeOwnTheType = false;
+    }
+    fType = NULL;
 }
 
 bool SkView::Click::isType(const char type[]) const
 {
-	const char* t = fType;
+    const char* t = fType;
 
-	if (type == t)
-		return true;
+    if (type == t)
+        return true;
 
-	if (type == NULL)
-		type = "";
-	if (t == NULL)
-		t = "";
-	return !strcmp(t, type);
+    if (type == NULL)
+        type = "";
+    if (t == NULL)
+        t = "";
+    return !strcmp(t, type);
 }
 
 void SkView::Click::setType(const char type[])
 {
-	this->resetType();
-	fType = (char*)type;
+    this->resetType();
+    fType = (char*)type;
 }
 
 void SkView::Click::copyType(const char type[])
 {
-	if (fType != type)
-	{
-		this->resetType();
-		if (type)
-		{
-			size_t	len = strlen(type) + 1;
-			fType = (char*)sk_malloc_throw(len);
-			memcpy(fType, type, len);
-			fWeOwnTheType = true;
-		}
-	}
+    if (fType != type)
+    {
+        this->resetType();
+        if (type)
+        {
+            size_t	len = strlen(type) + 1;
+            fType = (char*)sk_malloc_throw(len);
+            memcpy(fType, type, len);
+            fWeOwnTheType = true;
+        }
+    }
 }
 
 SkView::Click* SkView::findClickHandler(SkScalar x, SkScalar y)
@@ -469,18 +472,18 @@
 //////////////////////////////////////////////////////////////////////
 
 void SkView::invokeLayout() {
-	SkView::Layout* layout = this->getLayout();
+    SkView::Layout* layout = this->getLayout();
 
-	if (layout) {
-		layout->layoutChildren(this);
+    if (layout) {
+        layout->layoutChildren(this);
     }
 }
 
 void SkView::onDraw(SkCanvas* canvas) {
-	Artist* artist = this->getArtist();
+    Artist* artist = this->getArtist();
 
-	if (artist) {
-		artist->draw(this, canvas);
+    if (artist) {
+        artist->draw(this, canvas);
     }
 }
 
@@ -491,23 +494,23 @@
 }
 
 SkView::Click* SkView::onFindClickHandler(SkScalar x, SkScalar y) {
-	return NULL;
+    return NULL;
 }
 
 bool SkView::onClick(Click*) {
-	return false;
+    return false;
 }
 
 bool SkView::handleInval(const SkRect*) {
-	return false;
+    return false;
 }
 
 //////////////////////////////////////////////////////////////////////
 
 void SkView::getLocalBounds(SkRect* bounds) const
 {
-	if (bounds)
-		bounds->set(0, 0, fWidth, fHeight);
+    if (bounds)
+        bounds->set(0, 0, fWidth, fHeight);
 }
 
 //////////////////////////////////////////////////////////////////////
@@ -515,110 +518,110 @@
 
 void SkView::detachFromParent_NoLayout()
 {
-	if (fParent == NULL)
-		return;
+    if (fParent == NULL)
+        return;
 
-	if (fContainsFocus)
-		(void)this->setFocusView(NULL);
+    if (fContainsFocus)
+        (void)this->setFocusView(NULL);
 
-	this->inval(NULL);
+    this->inval(NULL);
 
-	SkView*	next = NULL;
+    SkView*	next = NULL;
 
-	if (fNextSibling != this)	// do we have any siblings
-	{
-		fNextSibling->fPrevSibling = fPrevSibling;
-		fPrevSibling->fNextSibling = fNextSibling;
-		next = fNextSibling;
-	}
+    if (fNextSibling != this)	// do we have any siblings
+    {
+        fNextSibling->fPrevSibling = fPrevSibling;
+        fPrevSibling->fNextSibling = fNextSibling;
+        next = fNextSibling;
+    }
 
-	if (fParent->fFirstChild == this)
-		fParent->fFirstChild = next;
+    if (fParent->fFirstChild == this)
+        fParent->fFirstChild = next;
 
-	fParent = fNextSibling = fPrevSibling = NULL;
+    fParent = fNextSibling = fPrevSibling = NULL;
 
-	this->unref();
+    this->unref();
 }
 
 void SkView::detachFromParent()
 {
-	SkView* parent = fParent;
+    SkView* parent = fParent;
 
-	if (parent)
-	{
-		this->detachFromParent_NoLayout();
-		parent->invokeLayout();
-	}
+    if (parent)
+    {
+        this->detachFromParent_NoLayout();
+        parent->invokeLayout();
+    }
 }
 
 SkView* SkView::attachChildToBack(SkView* child)
 {
-	SkASSERT(child != this);
+    SkASSERT(child != this);
 
-	if (child == NULL || fFirstChild == child)
-		goto DONE;
+    if (child == NULL || fFirstChild == child)
+        goto DONE;
 
-	child->ref();
-	child->detachFromParent_NoLayout();
+    child->ref();
+    child->detachFromParent_NoLayout();
 
-	if (fFirstChild == NULL)
-	{
-		child->fNextSibling = child;
-		child->fPrevSibling = child;
-	}
-	else
-	{
-		child->fNextSibling = fFirstChild;
-		child->fPrevSibling = fFirstChild->fPrevSibling;
-		fFirstChild->fPrevSibling->fNextSibling = child;
-		fFirstChild->fPrevSibling = child;
-	}
+    if (fFirstChild == NULL)
+    {
+        child->fNextSibling = child;
+        child->fPrevSibling = child;
+    }
+    else
+    {
+        child->fNextSibling = fFirstChild;
+        child->fPrevSibling = fFirstChild->fPrevSibling;
+        fFirstChild->fPrevSibling->fNextSibling = child;
+        fFirstChild->fPrevSibling = child;
+    }
 
-	fFirstChild = child;
-	child->fParent = this;
-	child->inval(NULL);
+    fFirstChild = child;
+    child->fParent = this;
+    child->inval(NULL);
 
-	this->invokeLayout();
+    this->invokeLayout();
 DONE:
-	return child;
+    return child;
 }
 
 SkView* SkView::attachChildToFront(SkView* child)
 {
-	SkASSERT(child != this);
+    SkASSERT(child != this);
 
-	if (child == NULL || (fFirstChild && fFirstChild->fPrevSibling == child))
-		goto DONE;
+    if (child == NULL || (fFirstChild && fFirstChild->fPrevSibling == child))
+        goto DONE;
 
-	child->ref();
-	child->detachFromParent_NoLayout();
+    child->ref();
+    child->detachFromParent_NoLayout();
 
-	if (fFirstChild == NULL)
-	{
-		fFirstChild = child;
-		child->fNextSibling = child;
-		child->fPrevSibling = child;
-	}
-	else
-	{
-		child->fNextSibling = fFirstChild;
-		child->fPrevSibling = fFirstChild->fPrevSibling;
-		fFirstChild->fPrevSibling->fNextSibling = child;
-		fFirstChild->fPrevSibling = child;
-	}
+    if (fFirstChild == NULL)
+    {
+        fFirstChild = child;
+        child->fNextSibling = child;
+        child->fPrevSibling = child;
+    }
+    else
+    {
+        child->fNextSibling = fFirstChild;
+        child->fPrevSibling = fFirstChild->fPrevSibling;
+        fFirstChild->fPrevSibling->fNextSibling = child;
+        fFirstChild->fPrevSibling = child;
+    }
 
-	child->fParent = this;
-	child->inval(NULL);
+    child->fParent = this;
+    child->inval(NULL);
 
-	this->invokeLayout();
+    this->invokeLayout();
 DONE:
-	return child;
+    return child;
 }
 
 void SkView::detachAllChildren()
 {
-	while (fFirstChild)
-		fFirstChild->detachFromParent_NoLayout();
+    while (fFirstChild)
+        fFirstChild->detachFromParent_NoLayout();
 }
 
 void SkView::localToGlobal(SkMatrix* matrix) const
@@ -655,84 +658,84 @@
 //////////////////////////////////////////////////////////////////
 
 /*	Even if the subclass overrides onInflate, they should always be
-	sure to call the inherited method, so that we get called.
+    sure to call the inherited method, so that we get called.
 */
 void SkView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
 {
-	SkScalar x, y;
+    SkScalar x, y;
 
-	x = this->locX();
-	y = this->locY();
-	(void)dom.findScalar(node, "x", &x);
-	(void)dom.findScalar(node, "y", &y);
-	this->setLoc(x, y);
+    x = this->locX();
+    y = this->locY();
+    (void)dom.findScalar(node, "x", &x);
+    (void)dom.findScalar(node, "y", &y);
+    this->setLoc(x, y);
 
-	x = this->width();
-	y = this->height();
-	(void)dom.findScalar(node, "width", &x);
-	(void)dom.findScalar(node, "height", &y);
-	this->setSize(x, y);
+    x = this->width();
+    y = this->height();
+    (void)dom.findScalar(node, "width", &x);
+    (void)dom.findScalar(node, "height", &y);
+    this->setSize(x, y);
 
-	// inflate the flags
+    // inflate the flags
 
-	static const char* gFlagNames[] = {
-		"visible", "enabled", "focusable", "flexH", "flexV"
-	};
-	SkASSERT(SK_ARRAY_COUNT(gFlagNames) == kFlagShiftCount);
+    static const char* gFlagNames[] = {
+        "visible", "enabled", "focusable", "flexH", "flexV"
+    };
+    SkASSERT(SK_ARRAY_COUNT(gFlagNames) == kFlagShiftCount);
 
-	bool     b;
-	uint32_t flags = this->getFlags();
-	for (unsigned i = 0; i < SK_ARRAY_COUNT(gFlagNames); i++)
-		if (dom.findBool(node, gFlagNames[i], &b))
-			flags = SkSetClearShift(flags, b, i);
-	this->setFlags(flags);
+    bool     b;
+    uint32_t flags = this->getFlags();
+    for (unsigned i = 0; i < SK_ARRAY_COUNT(gFlagNames); i++)
+        if (dom.findBool(node, gFlagNames[i], &b))
+            flags = SkSetClearShift(flags, b, i);
+    this->setFlags(flags);
 }
 
 void SkView::inflate(const SkDOM& dom, const SkDOM::Node* node)
 {
-	this->onInflate(dom, node);
+    this->onInflate(dom, node);
 }
 
 void SkView::onPostInflate(const SkTDict<SkView*>&)
 {
-	// override in subclass as needed
+    // override in subclass as needed
 }
 
 void SkView::postInflate(const SkTDict<SkView*>& dict)
 {
-	this->onPostInflate(dict);
+    this->onPostInflate(dict);
 
-	B2FIter	iter(this);
-	SkView*	child;
-	while ((child = iter.next()) != NULL)
-		child->postInflate(dict);
+    B2FIter	iter(this);
+    SkView*	child;
+    while ((child = iter.next()) != NULL)
+        child->postInflate(dict);
 }
 
 //////////////////////////////////////////////////////////////////
 
 SkView* SkView::sendEventToParents(const SkEvent& evt)
 {
-	SkView* parent = fParent;
+    SkView* parent = fParent;
     
-	while (parent)
-	{
-		if (parent->doEvent(evt))
-			return parent;
-		parent = parent->fParent;
-	}
-	return NULL;
+    while (parent)
+    {
+        if (parent->doEvent(evt))
+            return parent;
+        parent = parent->fParent;
+    }
+    return NULL;
 }
 
 SkView* SkView::sendQueryToParents(SkEvent* evt) {
-	SkView* parent = fParent;
+    SkView* parent = fParent;
     
-	while (parent) {
-		if (parent->doQuery(evt)) {
-			return parent;
+    while (parent) {
+        if (parent->doQuery(evt)) {
+            return parent;
         }
-		parent = parent->fParent;
-	}
-	return NULL;
+        parent = parent->fParent;
+    }
+    return NULL;
 }
 
 //////////////////////////////////////////////////////////////////
@@ -740,42 +743,42 @@
 
 SkView::F2BIter::F2BIter(const SkView* parent)
 {
-	fFirstChild = parent ? parent->fFirstChild : NULL;
-	fChild = fFirstChild ? fFirstChild->fPrevSibling : NULL;
+    fFirstChild = parent ? parent->fFirstChild : NULL;
+    fChild = fFirstChild ? fFirstChild->fPrevSibling : NULL;
 }
 
 SkView*	SkView::F2BIter::next()
 {
-	SkView* curr = fChild;
+    SkView* curr = fChild;
 
-	if (fChild)
-	{
-		if (fChild == fFirstChild)
-			fChild = NULL;
-		else
-			fChild = fChild->fPrevSibling;
-	}
-	return curr;
+    if (fChild)
+    {
+        if (fChild == fFirstChild)
+            fChild = NULL;
+        else
+            fChild = fChild->fPrevSibling;
+    }
+    return curr;
 }
 
 SkView::B2FIter::B2FIter(const SkView* parent)
 {
-	fFirstChild = parent ? parent->fFirstChild : NULL;
-	fChild = fFirstChild;
+    fFirstChild = parent ? parent->fFirstChild : NULL;
+    fChild = fFirstChild;
 }
 
 SkView*	SkView::B2FIter::next()
 {
-	SkView* curr = fChild;
+    SkView* curr = fChild;
 
-	if (fChild)
-	{
-		SkView* next = fChild->fNextSibling;
-		if (next == fFirstChild)
-			next = NULL;
-		fChild = next;
-	}
-	return curr;
+    if (fChild)
+    {
+        SkView* next = fChild->fNextSibling;
+        if (next == fFirstChild)
+            next = NULL;
+        fChild = next;
+    }
+    return curr;
 }
 
 //////////////////////////////////////////////////////////////////
@@ -785,58 +788,58 @@
 
 static inline void show_if_nonzero(const char name[], SkScalar value)
 {
-	if (value)
-		SkDebugf("%s=\"%g\"", name, value/65536.);
+    if (value)
+        SkDebugf("%s=\"%g\"", name, value/65536.);
 }
 
 static void tab(int level)
 {
-	for (int i = 0; i < level; i++)
-		SkDebugf("    ");
+    for (int i = 0; i < level; i++)
+        SkDebugf("    ");
 }
 
 static void dumpview(const SkView* view, int level, bool recurse)
 {
-	tab(level);
+    tab(level);
 
-	SkDebugf("<view");
-	show_if_nonzero(" x", view->locX());
-	show_if_nonzero(" y", view->locY());
-	show_if_nonzero(" width", view->width());
-	show_if_nonzero(" height", view->height());
+    SkDebugf("<view");
+    show_if_nonzero(" x", view->locX());
+    show_if_nonzero(" y", view->locY());
+    show_if_nonzero(" width", view->width());
+    show_if_nonzero(" height", view->height());
 
-	if (recurse)
-	{
-		SkView::B2FIter	iter(view);
-		SkView*			child;
-		bool			noChildren = true;
+    if (recurse)
+    {
+        SkView::B2FIter	iter(view);
+        SkView*			child;
+        bool			noChildren = true;
 
-		while ((child = iter.next()) != NULL)
-		{
-			if (noChildren)
-				SkDebugf(">\n");
-			noChildren = false;
-			dumpview(child, level + 1, true);
-		}
+        while ((child = iter.next()) != NULL)
+        {
+            if (noChildren)
+                SkDebugf(">\n");
+            noChildren = false;
+            dumpview(child, level + 1, true);
+        }
 
-		if (!noChildren)
-		{
-			tab(level);
-			SkDebugf("</view>\n");
-		}
-		else
-			goto ONELINER;
-	}
-	else
-	{
-	ONELINER:
-		SkDebugf(" />\n");
-	}
+        if (!noChildren)
+        {
+            tab(level);
+            SkDebugf("</view>\n");
+        }
+        else
+            goto ONELINER;
+    }
+    else
+    {
+    ONELINER:
+        SkDebugf(" />\n");
+    }
 }
 
 void SkView::dump(bool recurse) const
 {
-	dumpview(this, 0, recurse);
+    dumpview(this, 0, recurse);
 }
 
 #endif
diff --git a/src/views/animated/SkWidgetViews.cpp b/src/views/animated/SkWidgetViews.cpp
index 007a36f..ee03b7b 100644
--- a/src/views/animated/SkWidgetViews.cpp
+++ b/src/views/animated/SkWidgetViews.cpp
@@ -15,79 +15,81 @@
 /*
 I have moved this to SkWidgetViews.h
 enum SkinEnum {
-	kButton_SkinEnum,
-	kProgress_SkinEnum,
-	kScroll_SkinEnum,
-	kStaticText_SkinEnum,
-	
-	kSkinEnumCount
+    kButton_SkinEnum,
+    kProgress_SkinEnum,
+    kScroll_SkinEnum,
+    kStaticText_SkinEnum,
+    
+    kSkinEnumCount
 };
 */
 
+SK_DEFINE_INST_COUNT(SkListSource)
+
 const char* get_skin_enum_path(SkinEnum se)
 {
-	SkASSERT((unsigned)se < kSkinEnumCount);
+    SkASSERT((unsigned)se < kSkinEnumCount);
 
-	static const char* gSkinPaths[] = {
+    static const char* gSkinPaths[] = {
             "common/default/default/skins/border3.xml",
             "common/default/default/skins/button.xml",
             "common/default/default/skins/progressBar.xml",
             "common/default/default/skins/scrollBar.xml",
             "common/default/default/skins/statictextpaint.xml"
-	};
+    };
 
-	return gSkinPaths[se];
+    return gSkinPaths[se];
 }
 
 void init_skin_anim(const char path[], SkAnimator* anim)
 {
-	SkASSERT(path && anim);
+    SkASSERT(path && anim);
 
-	SkFILEStream	stream(path);
+    SkFILEStream	stream(path);
 
-	if (!stream.isValid())
-	{
-		SkDEBUGF(("init_skin_anim: loading skin failed <%s>\n", path));
-		sk_throw();
-	}
+    if (!stream.isValid())
+    {
+        SkDEBUGF(("init_skin_anim: loading skin failed <%s>\n", path));
+        sk_throw();
+    }
 
-	if (!anim->decodeStream(&stream))
-	{
-		SkDEBUGF(("init_skin_anim: decoding skin failed <%s>\n", path));
-		sk_throw();
-	}
+    if (!anim->decodeStream(&stream))
+    {
+        SkDEBUGF(("init_skin_anim: decoding skin failed <%s>\n", path));
+        sk_throw();
+    }
 }
 
 void init_skin_anim(SkinEnum se, SkAnimator* anim)
 {
-	init_skin_anim(get_skin_enum_path(se), anim);
+    init_skin_anim(get_skin_enum_path(se), anim);
 }
 
 void init_skin_paint(SkinEnum se, SkPaint* paint)
 {
-	SkASSERT(paint);
+    SkASSERT(paint);
 
-	SkAnimator	anim;
-	SkCanvas	canvas;
-	
-	init_skin_anim(se, &anim);
-	anim.draw(&canvas, paint, 0);
+    SkAnimator	anim;
+    SkCanvas	canvas;
+    
+    init_skin_anim(se, &anim);
+    anim.draw(&canvas, paint, 0);
 }
 
 void inflate_paint(const SkDOM& dom, const SkDOM::Node* node, SkPaint* paint)
 {
-	SkASSERT(paint);
+    SkASSERT(paint);
 
-	SkAnimator	anim;
-	SkCanvas	canvas;
-	
-	if (!anim.decodeDOM(dom, node))
-	{
-		SkDEBUGF(("inflate_paint: decoding dom failed\n"));
-		SkDEBUGCODE(dom.dump(node);)
-		sk_throw();
-	}	
-	anim.draw(&canvas, paint, 0);
+    SkAnimator	anim;
+    SkCanvas	canvas;
+    
+    if (!anim.decodeDOM(dom, node))
+    {
+        SkDEBUGF(("inflate_paint: decoding dom failed\n"));
+        SkDEBUGCODE(dom.dump(node);)
+        sk_throw();
+    }	
+    anim.draw(&canvas, paint, 0);
 }
 
 ////////////////////////////////////////////////////////////////////////////////////////
@@ -98,99 +100,99 @@
 
 const char* SkWidgetView::getLabel() const
 {
-	return fLabel.c_str();
+    return fLabel.c_str();
 }
-	
+    
 void SkWidgetView::getLabel(SkString* label) const
 {
-	if (label)
-		*label = fLabel;
+    if (label)
+        *label = fLabel;
 }
 
 void SkWidgetView::setLabel(const char label[])
 {
-	this->setLabel(label, label ? strlen(label) : 0);
+    this->setLabel(label, label ? strlen(label) : 0);
 }
 
 void SkWidgetView::setLabel(const char label[], size_t len)
 {
-	if ((label == NULL && fLabel.size() != 0) || !fLabel.equals(label, len))
-	{
-		SkString	tmp(label, len);
+    if ((label == NULL && fLabel.size() != 0) || !fLabel.equals(label, len))
+    {
+        SkString	tmp(label, len);
 
-		this->onLabelChange(fLabel.c_str(), tmp.c_str());
-		fLabel.swap(tmp);
-	}
+        this->onLabelChange(fLabel.c_str(), tmp.c_str());
+        fLabel.swap(tmp);
+    }
 }
 
 void SkWidgetView::setLabel(const SkString& label)
 {
-	if (fLabel != label)
-	{
-		this->onLabelChange(fLabel.c_str(), label.c_str());
-		fLabel = label;
-	}
+    if (fLabel != label)
+    {
+        this->onLabelChange(fLabel.c_str(), label.c_str());
+        fLabel = label;
+    }
 }
 
 bool SkWidgetView::postWidgetEvent()
 {
-	if (!fEvent.isType(""))
-	{
-		SkEvent	evt(fEvent);	// make a copy since onPrepareWidgetEvent may edit the event
+    if (!fEvent.isType(""))
+    {
+        SkEvent	evt(fEvent);	// make a copy since onPrepareWidgetEvent may edit the event
 
-		if (this->onPrepareWidgetEvent(&evt))
-		{
-			SkDEBUGCODE(evt.dump("SkWidgetView::postWidgetEvent");)
+        if (this->onPrepareWidgetEvent(&evt))
+        {
+            SkDEBUGCODE(evt.dump("SkWidgetView::postWidgetEvent");)
 
-			this->postToListeners(evt);	// wonder if this should return true if there are > 0 listeners...
-			return true;
-		}
-	}
-	return false;
+            this->postToListeners(evt);	// wonder if this should return true if there are > 0 listeners...
+            return true;
+        }
+    }
+    return false;
 }
 
 /*virtual*/ void SkWidgetView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
 {
-	this->INHERITED::onInflate(dom, node);
+    this->INHERITED::onInflate(dom, node);
 
-	const char* label = dom.findAttr(node, "label");
-	if (label)
-		this->setLabel(label);
-		
-	if ((node = dom.getFirstChild(node, "event")) != NULL)
-		fEvent.inflate(dom, node);
+    const char* label = dom.findAttr(node, "label");
+    if (label)
+        this->setLabel(label);
+        
+    if ((node = dom.getFirstChild(node, "event")) != NULL)
+        fEvent.inflate(dom, node);
 }
 
 /*virtual*/ void SkWidgetView::onLabelChange(const char oldLabel[], const char newLabel[])
 {
-	this->inval(NULL);
+    this->inval(NULL);
 }
 
 static const char gWidgetEventSinkIDSlotName[] = "sk-widget-sinkid-slot";
 
 /*virtual*/ bool SkWidgetView::onPrepareWidgetEvent(SkEvent* evt)
 {
-	evt->setS32(gWidgetEventSinkIDSlotName, this->getSinkID());
-	return true;
+    evt->setS32(gWidgetEventSinkIDSlotName, this->getSinkID());
+    return true;
 }
 
 SkEventSinkID SkWidgetView::GetWidgetEventSinkID(const SkEvent& evt)
 {
-	int32_t	sinkID;
-	
-	return evt.findS32(gWidgetEventSinkIDSlotName, &sinkID) ? (SkEventSinkID)sinkID : 0;
+    int32_t	sinkID;
+    
+    return evt.findS32(gWidgetEventSinkIDSlotName, &sinkID) ? (SkEventSinkID)sinkID : 0;
 }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
 /*virtual*/ bool SkButtonView::onEvent(const SkEvent& evt)
 {
-	if (evt.isType(SK_EventType_Key) && evt.getFast32() == kOK_SkKey)
-	{
-		this->postWidgetEvent();
-		return true;
-	}
-	return this->INHERITED::onEvent(evt);
+    if (evt.isType(SK_EventType_Key) && evt.getFast32() == kOK_SkKey)
+    {
+        this->postWidgetEvent();
+        return true;
+    }
+    return this->INHERITED::onEvent(evt);
 }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -201,50 +203,50 @@
 
 void SkCheckButtonView::setCheckState(CheckState state)
 {
-	SkASSERT((unsigned)state <= kUnknown_CheckState);
-	
-	if (fCheckState != state)
-	{
-		this->onCheckStateChange(this->getCheckState(), state);
-		fCheckState = SkToU8(state);
-	}
+    SkASSERT((unsigned)state <= kUnknown_CheckState);
+    
+    if (fCheckState != state)
+    {
+        this->onCheckStateChange(this->getCheckState(), state);
+        fCheckState = SkToU8(state);
+    }
 }
-	
+    
 /*virtual*/ void SkCheckButtonView::onCheckStateChange(CheckState oldState, CheckState newState)
 {
-	this->inval(NULL);
+    this->inval(NULL);
 }
 
 /*virtual*/ void SkCheckButtonView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
 {
-	this->INHERITED::onInflate(dom, node);
-	
-	int index = dom.findList(node, "check-state", "off,on,unknown");
-	if (index >= 0)
-		this->setCheckState((CheckState)index);
+    this->INHERITED::onInflate(dom, node);
+    
+    int index = dom.findList(node, "check-state", "off,on,unknown");
+    if (index >= 0)
+        this->setCheckState((CheckState)index);
 }
 
 static const char gCheckStateSlotName[] = "sk-checkbutton-check-slot";
 
 /*virtual*/ bool SkCheckButtonView::onPrepareWidgetEvent(SkEvent* evt)
 {
-	// could check if we're "disabled", and return false...
+    // could check if we're "disabled", and return false...
 
-	evt->setS32(gCheckStateSlotName, this->getCheckState());
-	return true;
+    evt->setS32(gCheckStateSlotName, this->getCheckState());
+    return true;
 }
 
 bool SkCheckButtonView::GetWidgetEventCheckState(const SkEvent& evt, CheckState* state)
 {
-	int32_t	state32;
-	
-	if (evt.findS32(gCheckStateSlotName, &state32))
-	{
-		if (state)
-			*state = (CheckState)state32;
-		return true;
-	}
-	return false;
+    int32_t	state32;
+    
+    if (evt.findS32(gCheckStateSlotName, &state32))
+    {
+        if (state)
+            *state = (CheckState)state32;
+        return true;
+    }
+    return false;
 }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -256,93 +258,93 @@
 
 class SkAnimButtonView : public SkButtonView {
 public:
-	SkAnimButtonView()
-	{
-		fAnim.setHostEventSink(this);
-		init_skin_anim(kButton_SkinEnum, &fAnim);
-	}
+    SkAnimButtonView()
+    {
+        fAnim.setHostEventSink(this);
+        init_skin_anim(kButton_SkinEnum, &fAnim);
+    }
 
 protected:
-	virtual void onLabelChange(const char oldLabel[], const char newLabel[])
-	{
-		this->INHERITED::onLabelChange(oldLabel, newLabel);
+    virtual void onLabelChange(const char oldLabel[], const char newLabel[])
+    {
+        this->INHERITED::onLabelChange(oldLabel, newLabel);
 
-		SkEvent evt("user");
-		evt.setString("id", "setLabel");
-		evt.setString("LABEL", newLabel);
-		fAnim.doUserEvent(evt);
-	}
-	
-	virtual void onFocusChange(bool gainFocus)
-	{
-		this->INHERITED::onFocusChange(gainFocus);
+        SkEvent evt("user");
+        evt.setString("id", "setLabel");
+        evt.setString("LABEL", newLabel);
+        fAnim.doUserEvent(evt);
+    }
+    
+    virtual void onFocusChange(bool gainFocus)
+    {
+        this->INHERITED::onFocusChange(gainFocus);
 
-		SkEvent evt("user");
-		evt.setString("id", "setFocus");
-		evt.setS32("FOCUS", gainFocus);
-		fAnim.doUserEvent(evt);
-	}
+        SkEvent evt("user");
+        evt.setString("id", "setFocus");
+        evt.setS32("FOCUS", gainFocus);
+        fAnim.doUserEvent(evt);
+    }
 
-	virtual void onSizeChange()
-	{
-		this->INHERITED::onSizeChange();
+    virtual void onSizeChange()
+    {
+        this->INHERITED::onSizeChange();
 
-		SkEvent evt("user");
-		evt.setString("id", "setDim");
-		evt.setScalar("dimX", this->width());
-		evt.setScalar("dimY", this->height());
-		fAnim.doUserEvent(evt);
-	}
+        SkEvent evt("user");
+        evt.setString("id", "setDim");
+        evt.setScalar("dimX", this->width());
+        evt.setScalar("dimY", this->height());
+        fAnim.doUserEvent(evt);
+    }
 
-	virtual void onDraw(SkCanvas* canvas)
-	{
-		SkPaint						paint;		
-		SkAnimator::DifferenceType	diff = fAnim.draw(canvas, &paint, SkTime::GetMSecs());
-		
-		if (diff == SkAnimator::kDifferent)
-			this->inval(NULL);
-		else if (diff == SkAnimator::kPartiallyDifferent)
-		{
-			SkRect	bounds;
-			fAnim.getInvalBounds(&bounds);
-			this->inval(&bounds);
-		}
-	}
-	
-	virtual bool onEvent(const SkEvent& evt)
-	{
-		if (evt.isType(SK_EventType_Inval))
-		{
-			this->inval(NULL);
-			return true;
-		}
-		if (evt.isType("recommendDim"))
-		{
-			SkScalar	height;
-			
-			if (evt.findScalar("y", &height))
-				this->setHeight(height);
-			return true;
-		}
-		return this->INHERITED::onEvent(evt);
-	}
-	
-	virtual bool onPrepareWidgetEvent(SkEvent* evt)
-	{
-		if (this->INHERITED::onPrepareWidgetEvent(evt))
-		{
-			SkEvent	e("user");
-			e.setString("id", "handlePress");
-			(void)fAnim.doUserEvent(e);
-			return true;
-		}
-		return false;
-	}
+    virtual void onDraw(SkCanvas* canvas)
+    {
+        SkPaint						paint;		
+        SkAnimator::DifferenceType	diff = fAnim.draw(canvas, &paint, SkTime::GetMSecs());
+        
+        if (diff == SkAnimator::kDifferent)
+            this->inval(NULL);
+        else if (diff == SkAnimator::kPartiallyDifferent)
+        {
+            SkRect	bounds;
+            fAnim.getInvalBounds(&bounds);
+            this->inval(&bounds);
+        }
+    }
+    
+    virtual bool onEvent(const SkEvent& evt)
+    {
+        if (evt.isType(SK_EventType_Inval))
+        {
+            this->inval(NULL);
+            return true;
+        }
+        if (evt.isType("recommendDim"))
+        {
+            SkScalar	height;
+            
+            if (evt.findScalar("y", &height))
+                this->setHeight(height);
+            return true;
+        }
+        return this->INHERITED::onEvent(evt);
+    }
+    
+    virtual bool onPrepareWidgetEvent(SkEvent* evt)
+    {
+        if (this->INHERITED::onPrepareWidgetEvent(evt))
+        {
+            SkEvent	e("user");
+            e.setString("id", "handlePress");
+            (void)fAnim.doUserEvent(e);
+            return true;
+        }
+        return false;
+    }
 
 private:
-	SkAnimator	fAnim;
-	
-	typedef SkButtonView INHERITED;
+    SkAnimator	fAnim;
+    
+    typedef SkButtonView INHERITED;
 };
 
 ////////////////////////////////////////////////////////////////////////////////////////////
@@ -350,26 +352,26 @@
 
 SkView* SkWidgetFactory(const char name[])
 {
-	if (name == NULL)
-		return NULL;
-	
-	// must be in the same order as the SkSkinWidgetEnum is declared
-	static const char* gNames[] = {
-		"sk-border",
-		"sk-button",
-		"sk-image",
-		"sk-list",
-		"sk-progress",
-		"sk-scroll",
-		"sk-text"
-		
-	};
+    if (name == NULL)
+        return NULL;
+    
+    // must be in the same order as the SkSkinWidgetEnum is declared
+    static const char* gNames[] = {
+        "sk-border",
+        "sk-button",
+        "sk-image",
+        "sk-list",
+        "sk-progress",
+        "sk-scroll",
+        "sk-text"
+        
+    };
 
-	for (size_t i = 0; i < SK_ARRAY_COUNT(gNames); i++)
-		if (!strcmp(gNames[i], name))
-			return SkWidgetFactory((SkWidgetEnum)i);
+    for (size_t i = 0; i < SK_ARRAY_COUNT(gNames); i++)
+        if (!strcmp(gNames[i], name))
+            return SkWidgetFactory((SkWidgetEnum)i);
 
-	return NULL;
+    return NULL;
 }
 
 #include "SkImageView.h"
@@ -379,24 +381,24 @@
 
 SkView* SkWidgetFactory(SkWidgetEnum sw)
 {
-	switch (sw) {
-	case kBorder_WidgetEnum:
-		return new SkBorderView;
-	case kButton_WidgetEnum:
-		return new SkAnimButtonView;
-	case kImage_WidgetEnum:
-		return new SkImageView;
-	case kList_WidgetEnum:
-		return new SkListView;
-	case kProgress_WidgetEnum:
-		return new SkProgressBarView;
-	case kScroll_WidgetEnum:
-		return new SkScrollBarView;
-	case kText_WidgetEnum:
-		return new SkStaticTextView;
-	default:
-		SkDEBUGFAIL("unknown enum passed to SkWidgetFactory");
-		break;
-	}
-	return NULL;
+    switch (sw) {
+    case kBorder_WidgetEnum:
+        return new SkBorderView;
+    case kButton_WidgetEnum:
+        return new SkAnimButtonView;
+    case kImage_WidgetEnum:
+        return new SkImageView;
+    case kList_WidgetEnum:
+        return new SkListView;
+    case kProgress_WidgetEnum:
+        return new SkProgressBarView;
+    case kScroll_WidgetEnum:
+        return new SkScrollBarView;
+    case kText_WidgetEnum:
+        return new SkStaticTextView;
+    default:
+        SkDEBUGFAIL("unknown enum passed to SkWidgetFactory");
+        break;
+    }
+    return NULL;
 }
diff --git a/tests/AAClipTest.cpp b/tests/AAClipTest.cpp
index bf52b01..c5e82ba 100644
--- a/tests/AAClipTest.cpp
+++ b/tests/AAClipTest.cpp
@@ -337,6 +337,9 @@
     SkMask ma, mb;
     copyToMask(a, &ma);
     copyToMask(b, &mb);
+    SkAutoMaskFreeImage aCleanUp(ma.fImage);
+    SkAutoMaskFreeImage bCleanUp(mb.fImage);
+
     return ma == mb;
 }
 
diff --git a/tests/RefDictTest.cpp b/tests/RefDictTest.cpp
index 83d1aef..38a990a 100644
--- a/tests/RefDictTest.cpp
+++ b/tests/RefDictTest.cpp
@@ -9,8 +9,14 @@
 #include "SkRefDict.h"
 
 class TestRC : public SkRefCnt {
+public:
+    SK_DECLARE_INST_COUNT(TestRC)
+private:
+    typedef SkRefCnt INHERITED;
 };
 
+SK_DEFINE_INST_COUNT(TestRC)
+
 static void TestRefDict(skiatest::Reporter* reporter) {
     TestRC    data0, data1;
     SkRefDict dict;
diff --git a/tests/Test.cpp b/tests/Test.cpp
index 0441ab0..deb8348 100644
--- a/tests/Test.cpp
+++ b/tests/Test.cpp
@@ -16,6 +16,8 @@
 class GrContext;
 #endif
 
+SK_DEFINE_INST_COUNT(skiatest::Reporter)
+
 using namespace skiatest;
 
 Reporter::Reporter() {
diff --git a/tests/Test.h b/tests/Test.h
index 4ca1971..2396d6f 100644
--- a/tests/Test.h
+++ b/tests/Test.h
@@ -21,6 +21,7 @@
 
     class Reporter : public SkRefCnt {
     public:
+        SK_DECLARE_INST_COUNT(Reporter)
         Reporter();
 
         enum Result {
diff --git a/tests/UtilsTest.cpp b/tests/UtilsTest.cpp
index f1b1ea9..1c2f870 100644
--- a/tests/UtilsTest.cpp
+++ b/tests/UtilsTest.cpp
@@ -14,13 +14,19 @@
 
 class RefClass : public SkRefCnt {
 public:
+    SK_DECLARE_INST_COUNT(RefClass)
+
     RefClass(int n) : fN(n) {}
     int get() const { return fN; }
 
 private:
     int fN;
+
+    typedef SkRefCnt INHERITED;
 };
 
+SK_DEFINE_INST_COUNT(RefClass)
+
 static void test_refptr(skiatest::Reporter* reporter) {
     RefClass* r0 = new RefClass(0);
 
