remove duplicate SkTRegistry definition



git-svn-id: http://skia.googlecode.com/svn/trunk@78 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/bench/RectBench.cpp b/bench/RectBench.cpp
index 13239f1..ba01375 100644
--- a/bench/RectBench.cpp
+++ b/bench/RectBench.cpp
@@ -3,6 +3,7 @@
 #include "SkPaint.h"
 #include "SkRandom.h"
 #include "SkString.h"
+#include "SkTRegistry.h"
 
 class RectBench : public SkBenchmark {
 public:
@@ -106,29 +107,29 @@
     virtual const char* onGetName() { return fName; }
 };
 
-static SkBenchmark* RectFactory1() { return SkNEW_ARGS(RectBench, (1)); }
-static SkBenchmark* RectFactory2() { return SkNEW_ARGS(RectBench, (3)); }
-static SkBenchmark* OvalFactory1() { return SkNEW_ARGS(OvalBench, (1)); }
-static SkBenchmark* OvalFactory2() { return SkNEW_ARGS(OvalBench, (3)); }
-static SkBenchmark* RRectFactory1() { return SkNEW_ARGS(RRectBench, (1)); }
-static SkBenchmark* RRectFactory2() { return SkNEW_ARGS(RRectBench, (3)); }
-static SkBenchmark* PointsFactory() {
+static SkBenchmark* RectFactory1(void*) { return SkNEW_ARGS(RectBench, (1)); }
+static SkBenchmark* RectFactory2(void*) { return SkNEW_ARGS(RectBench, (3)); }
+static SkBenchmark* OvalFactory1(void*) { return SkNEW_ARGS(OvalBench, (1)); }
+static SkBenchmark* OvalFactory2(void*) { return SkNEW_ARGS(OvalBench, (3)); }
+static SkBenchmark* RRectFactory1(void*) { return SkNEW_ARGS(RRectBench, (1)); }
+static SkBenchmark* RRectFactory2(void*) { return SkNEW_ARGS(RRectBench, (3)); }
+static SkBenchmark* PointsFactory(void*) {
     return SkNEW_ARGS(PointsBench, (SkCanvas::kPoints_PointMode, "points"));
 }
-static SkBenchmark* LinesFactory() {
+static SkBenchmark* LinesFactory(void*) {
     return SkNEW_ARGS(PointsBench, (SkCanvas::kLines_PointMode, "lines"));
 }
-static SkBenchmark* PolygonFactory() {
+static SkBenchmark* PolygonFactory(void*) {
     return SkNEW_ARGS(PointsBench, (SkCanvas::kPolygon_PointMode, "polygon"));
 }
 
-static SkTRegistry<SkBenchmark> gRectReg1(RectFactory1);
-static SkTRegistry<SkBenchmark> gRectReg2(RectFactory2);
-static SkTRegistry<SkBenchmark> gOvalReg1(OvalFactory1);
-static SkTRegistry<SkBenchmark> gOvalReg2(OvalFactory2);
-static SkTRegistry<SkBenchmark> gRRectReg1(RRectFactory1);
-static SkTRegistry<SkBenchmark> gRRectReg2(RRectFactory2);
-static SkTRegistry<SkBenchmark> gPointsReg(PointsFactory);
-static SkTRegistry<SkBenchmark> gLinesReg(LinesFactory);
-static SkTRegistry<SkBenchmark> gPolygonReg(PolygonFactory);
+static SkTRegistry<SkBenchmark*, void*> gRectReg1(RectFactory1);
+static SkTRegistry<SkBenchmark*, void*> gRectReg2(RectFactory2);
+static SkTRegistry<SkBenchmark*, void*> gOvalReg1(OvalFactory1);
+static SkTRegistry<SkBenchmark*, void*> gOvalReg2(OvalFactory2);
+static SkTRegistry<SkBenchmark*, void*> gRRectReg1(RRectFactory1);
+static SkTRegistry<SkBenchmark*, void*> gRRectReg2(RRectFactory2);
+static SkTRegistry<SkBenchmark*, void*> gPointsReg(PointsFactory);
+static SkTRegistry<SkBenchmark*, void*> gLinesReg(LinesFactory);
+static SkTRegistry<SkBenchmark*, void*> gPolygonReg(PolygonFactory);
 
diff --git a/bench/SkBenchmark.h b/bench/SkBenchmark.h
index 00dfb84..87bf67a 100644
--- a/bench/SkBenchmark.h
+++ b/bench/SkBenchmark.h
@@ -41,31 +41,5 @@
     return p;
 }
 
-///////////////////////////////////////////////////////////////////////////////
-
-template <typename T> class SkTRegistry : SkNoncopyable {
-public:
-    typedef T* (*Factory)();
-    
-    SkTRegistry(Factory fact) {
-        fFact = fact;
-        fChain = gHead;
-        gHead = this;
-    }
-    
-    static const SkTRegistry* Head() { return gHead; }
-    
-    SkTRegistry* next() const { return fChain; }
-    Factory factory() const { return fFact; }
-    
-private:
-    Factory   fFact;
-    SkTRegistry* fChain;
-    
-    static SkTRegistry* gHead;
-};
-
-template <typename T> SkTRegistry<T>* SkTRegistry<T>::gHead;
-
 #endif
 
diff --git a/bench/main.cpp b/bench/main.cpp
index d9bd577..25ab73a 100644
--- a/bench/main.cpp
+++ b/bench/main.cpp
@@ -1,13 +1,12 @@
-#define SAVE_FILE
-
 #include "SkCanvas.h"
 #include "SkImageEncoder.h"
 #include "SkString.h"
 #include "SkTime.h"
+#include "SkTRegistry.h"
 
 #include "SkBenchmark.h"
 
-typedef SkTRegistry<SkBenchmark> BenchRegistry;
+typedef SkTRegistry<SkBenchmark*, void*> BenchRegistry;
 
 class Iter {
 public:
@@ -19,7 +18,7 @@
         if (fBench) {
             BenchRegistry::Factory f = fBench->factory();
             fBench = fBench->next();
-            return f();
+            return f(0);
         }
         return NULL;
     }
@@ -46,7 +45,6 @@
 
 static void saveFile(const char name[], const char config[], const char dir[],
                      const SkBitmap& bm) {
-#ifdef SAVE_FILE
     SkBitmap copy;
     if (!bm.copyTo(&copy, SkBitmap::kARGB_8888_Config)) {
         return;
@@ -59,7 +57,6 @@
     ::remove(str.c_str());
     SkImageEncoder::EncodeFile(str.c_str(), copy, SkImageEncoder::kPNG_Type,
                                100);
-#endif
 }
 
 static void performClip(SkCanvas* canvas, int w, int h) {