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

Unified Diff: src/core/SkValidatingReadBuffer.cpp

Issue 1837913003: Add support for serializing/deserializing of SkDrawable (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add ability to specify custom flattenable factories on SkReadBuffer Created 4 years, 9 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: src/core/SkValidatingReadBuffer.cpp
diff --git a/src/core/SkValidatingReadBuffer.cpp b/src/core/SkValidatingReadBuffer.cpp
index bc5611a3e382902878ca99256f6d26ff0e80c3c2..a45c6ca9b0623f483e802667401c307f3387b8f9 100644
--- a/src/core/SkValidatingReadBuffer.cpp
+++ b/src/core/SkValidatingReadBuffer.cpp
@@ -246,6 +246,12 @@ SkFlattenable* SkValidatingReadBuffer::readFlattenable(SkFlattenable::Type type)
SkFlattenable* obj = nullptr;
uint32_t sizeRecorded = this->readUInt();
if (factory) {
+ // Check if a custom Factory has been specified for this flattenable.
+ SkFlattenable::Factory* customFactoryPtr = getCustomFactory(factory);
+ if (customFactoryPtr) {
+ factory = *customFactoryPtr;
+ }
+
size_t offset = fReader.offset();
obj = (*factory)(*this);
// check that we read the amount we expected

Powered by Google App Engine
This is Rietveld 408576698