Add placement new macros to SkPostConfig, call SkNEW* from Ganesh.

TODO: unify with the placement new implementation in SkTemplatesPriv.h,
once various issues there are overcome. reed@ should be taking the lead
there.

http://codereview.appspot.com/6384043/



git-svn-id: http://skia.googlecode.com/svn/trunk@4492 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/gpu/GrContextFactory.h b/include/gpu/GrContextFactory.h
index 0a66274..65bf597 100644
--- a/include/gpu/GrContextFactory.h
+++ b/include/gpu/GrContextFactory.h
@@ -68,23 +68,23 @@
         SkAutoTUnref<GrContext> grCtx;
         switch (type) {
             case kNative_GLContextType:
-                glCtx.reset(new SkNativeGLContext());
+                glCtx.reset(SkNEW(SkNativeGLContext));
                 break;
 #ifdef SK_ANGLE
             case kANGLE_GLContextType:
-                glCtx.reset(new SkANGLEGLContext());
+                glCtx.reset(SkNEW(SkANGLEGLContext));
                 break;
 #endif
 #ifdef SK_MESA
             case kMESA_GLContextType:
-                glCtx.reset(new SkMesaGLContext());
+                glCtx.reset(SkNEW(SkMesaGLContext));
                 break;
 #endif
             case kNull_GLContextType:
-                glCtx.reset(new SkNullGLContext());
+                glCtx.reset(SkNEW(SkNullGLContext));
                 break;
             case kDebug_GLContextType:
-                glCtx.reset(new SkDebugGLContext());
+                glCtx.reset(SkNEW(SkDebugGLContext));
                 break;
         }
         static const int kBogusSize = 1;
diff --git a/include/gpu/GrProgramStageFactory.h b/include/gpu/GrProgramStageFactory.h
index c01b3f0..d133beb 100644
--- a/include/gpu/GrProgramStageFactory.h
+++ b/include/gpu/GrProgramStageFactory.h
@@ -95,7 +95,7 @@
      the object. */
     virtual GLProgramStage* createGLInstance(
                         const GrCustomStage& stage) const SK_OVERRIDE {
-        return new GLProgramStage(*this, stage);
+        return SkNEW_ARGS(GLProgramStage, (*this, stage));
     }
 
     /** This class is a singleton. This function returns the single instance.
@@ -104,7 +104,8 @@
         static SkAlignedSTStorage<1, GrTProgramStageFactory> gInstanceMem;
         static const GrTProgramStageFactory* gInstance;
         if (!gInstance) {
-            gInstance = new (gInstanceMem.get()) GrTProgramStageFactory();
+            gInstance = SkNEW_PLACEMENT(gInstanceMem.get(),
+                                        GrTProgramStageFactory);
         }
         return *gInstance;
     }