Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1749)

Unified Diff: include/core/SkFlattenableBuffers.h

Issue 23021015: Initial error handling code (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Added ImageFilter derived classes safety checks (retry) Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: include/core/SkFlattenableBuffers.h
diff --git a/include/core/SkFlattenableBuffers.h b/include/core/SkFlattenableBuffers.h
index 03c03f3877e6f8e3f508d29e371d5c7ebd91624e..b7c3156ecc532313fcf815528e7903b6b9a92446 100644
--- a/include/core/SkFlattenableBuffers.h
+++ b/include/core/SkFlattenableBuffers.h
@@ -41,14 +41,16 @@ public:
kCrossProcess_Flag = 1 << 0,
kScalarIsFloat_Flag = 1 << 1,
kPtrIs64Bit_Flag = 1 << 2,
+ kSecure_Flag = 1 << 3,
reed1 2013/09/03 20:25:21 I wonder if kValidating_Flag or something like tha
sugoi1 2013/09/04 18:01:10 Done.
};
void setFlags(uint32_t flags) { fFlags = flags; }
uint32_t getFlags() const { return fFlags; }
- bool isCrossProcess() const { return SkToBool(fFlags & kCrossProcess_Flag); }
+ bool isCrossProcess() const { return SkToBool(fFlags & (kCrossProcess_Flag | kSecure_Flag)); }
bool isScalarFloat() const { return SkToBool(fFlags & kScalarIsFloat_Flag); }
bool isPtr64Bit() const { return SkToBool(fFlags & kPtrIs64Bit_Flag); }
+ bool isSecure() const { return SkToBool(fFlags & kSecure_Flag); }
// primitives
virtual bool readBool() = 0;
@@ -102,6 +104,13 @@ public:
return static_cast<T*>(this->readFlattenable());
}
+ void validateData(bool isValid) {
+ fError |= !isValid;
+ }
+
+protected:
+ bool fError;
+
private:
uint32_t fFlags;
};
@@ -154,13 +163,18 @@ public:
enum Flags {
kCrossProcess_Flag = 0x01,
+ kSecure_Flag = 0x02,
};
uint32_t getFlags() const { return fFlags; }
void setFlags(uint32_t flags) { fFlags = flags; }
bool isCrossProcess() const {
- return SkToBool(fFlags & kCrossProcess_Flag);
+ return SkToBool(fFlags & (kCrossProcess_Flag | kSecure_Flag));
+ }
+
+ bool isSecure() const {
+ return SkToBool(fFlags & kSecure_Flag);
}
bool persistTypeface() const { return (fFlags & kCrossProcess_Flag) != 0; }

Powered by Google App Engine
This is Rietveld 408576698