Constify SkFlattenable::getFactory().

This allows us to also constify the argument of
SkFlattenableWriteBuffer::writeFlattenable() - which I've recently found
myself const-casting for no apparent good reason.

R=bungeman@google.com, mtklein@google.com, reed@google.com

Author: fmalita@chromium.org

Review URL: https://codereview.chromium.org/29143005

git-svn-id: http://skia.googlecode.com/svn/trunk/include@11862 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/core/SkFlattenable.h b/core/SkFlattenable.h
index 58e69fd..6cc76db 100644
--- a/core/SkFlattenable.h
+++ b/core/SkFlattenable.h
@@ -27,10 +27,10 @@
     }
 
 #define SK_DECLARE_UNFLATTENABLE_OBJECT() \
-    virtual Factory getFactory() SK_OVERRIDE { return NULL; }
+    virtual Factory getFactory() const SK_OVERRIDE { return NULL; }
 
 #define SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(flattenable) \
-    virtual Factory getFactory() SK_OVERRIDE { return CreateProc; } \
+    virtual Factory getFactory() const SK_OVERRIDE { return CreateProc; } \
     static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) { \
         return SkNEW_ARGS(flattenable, (buffer)); \
     }
@@ -53,7 +53,7 @@
      to recreate your class given a buffer (previously written to by your
      override of flatten().
      */
-    virtual Factory getFactory() = 0;
+    virtual Factory getFactory() const = 0;
 
     static Factory NameToFactory(const char name[]);
     static const char* FactoryToName(Factory);
diff --git a/core/SkFlattenableBuffers.h b/core/SkFlattenableBuffers.h
index 51016c7..d71f7c0 100644
--- a/core/SkFlattenableBuffers.h
+++ b/core/SkFlattenableBuffers.h
@@ -182,7 +182,7 @@
                                     SkPaint::TextEncoding encoding) = 0;
 
     // common data structures
-    virtual void writeFlattenable(SkFlattenable* flattenable) = 0;
+    virtual void writeFlattenable(const SkFlattenable* flattenable) = 0;
     virtual void writeColor(const SkColor& color) = 0;
     virtual void writeColorArray(const SkColor* color, uint32_t count) = 0;
     virtual void writePoint(const SkPoint& point) = 0;
@@ -222,7 +222,7 @@
 
 protected:
     // A helper function so that each subclass does not have to be a friend of SkFlattenable
-    void flattenObject(SkFlattenable* obj, SkFlattenableWriteBuffer& buffer);
+    void flattenObject(const SkFlattenable* obj, SkFlattenableWriteBuffer& buffer);
 
     uint32_t fFlags;
 };
diff --git a/effects/SkDashPathEffect.h b/effects/SkDashPathEffect.h
index 9c0775d..4e83f45 100644
--- a/effects/SkDashPathEffect.h
+++ b/effects/SkDashPathEffect.h
@@ -47,7 +47,7 @@
                           const SkStrokeRec&, const SkMatrix&,
                           const SkRect*) const SK_OVERRIDE;
 
-    virtual Factory getFactory() SK_OVERRIDE;
+    virtual Factory getFactory() const SK_OVERRIDE;
 
     static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);