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

Unified Diff: src/core/SkFlattenableSerialization.cpp

Issue 44573002: Enabling validation code in serialization and adding serialization to fuzzer (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fixed SkValidatingReadBuffer's constructor Created 7 years, 2 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
« no previous file with comments | « samplecode/SampleFilterFuzz.cpp ('k') | src/core/SkValidatingReadBuffer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkFlattenableSerialization.cpp
diff --git a/src/core/SkFlattenableSerialization.cpp b/src/core/SkFlattenableSerialization.cpp
index c6870749e9d74f51caca647daba7507a2e5c0461..b98d935ca7d4ba4dfa48036f6ab17715f66336ab 100644
--- a/src/core/SkFlattenableSerialization.cpp
+++ b/src/core/SkFlattenableSerialization.cpp
@@ -8,14 +8,12 @@
#include "SkFlattenableSerialization.h"
#include "SkData.h"
-#include "SkFlattenable.h"
-#include "SkImageFilter.h"
-#include "SkOrderedReadBuffer.h"
+#include "SkValidatingReadBuffer.h"
#include "SkOrderedWriteBuffer.h"
-SkData* SkSerializeFlattenable(SkFlattenable* flattenable) {
+SkData* SkValidatingSerializeFlattenable(SkFlattenable* flattenable) {
SkOrderedWriteBuffer writer(1024);
- writer.setFlags(SkOrderedWriteBuffer::kCrossProcess_Flag);
+ writer.setFlags(SkOrderedWriteBuffer::kValidation_Flag);
writer.writeFlattenable(flattenable);
uint32_t size = writer.bytesWritten();
void* data = sk_malloc_throw(size);
@@ -23,8 +21,8 @@ SkData* SkSerializeFlattenable(SkFlattenable* flattenable) {
return SkData::NewFromMalloc(data, size);
}
-// TODO: this guy should be renamed to ImageFilter, or take SkFlattenable::Type as a parameter.
-SkFlattenable* SkDeserializeFlattenable(const void* data, size_t size) {
- SkOrderedReadBuffer buffer(data, size);
- return buffer.readImageFilter();
+SkFlattenable* SkValidatingDeserializeFlattenable(const void* data, size_t size,
+ SkFlattenable::Type type) {
+ SkValidatingReadBuffer buffer(data, size);
+ return buffer.readFlattenable(type);
}
« no previous file with comments | « samplecode/SampleFilterFuzz.cpp ('k') | src/core/SkValidatingReadBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698