Adding error checks to SkRBuffer



Review URL:

git-svn-id: 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/core/SkFlattenableBuffers.h b/core/SkFlattenableBuffers.h
index 8a94bb1..575dec8 100644
--- a/core/SkFlattenableBuffers.h
+++ b/core/SkFlattenableBuffers.h
@@ -144,7 +144,15 @@
         return SkData::NewFromMalloc(buffer, len);
-    virtual void validate(bool isValid) {}
+    /** This function validates that the isValid input parameter is true
+      * If isValidating() is false, then true is always returned
+      * If isValidating() is true, then true is returned until validate() is called with isValid
+      * set to false. When isValid is false, an error flag will be set internally and, from that
+      * point on, validate() will return false. The error flag cannot be unset.
+      *
+      * @param isValid result of a test that is expected to be true
+      */
+    virtual bool validate(bool isValid);
     template <typename T> T* readFlattenableT();