| Index: src/core/SkValidatingReadBuffer.cpp
|
| diff --git a/src/core/SkValidatingReadBuffer.cpp b/src/core/SkValidatingReadBuffer.cpp
|
| index ad4b6c409e6a0adca7c85b87c69a59089ac76779..95c4d196bea34234084b17d1d981ee6339d9d842 100644
|
| --- a/src/core/SkValidatingReadBuffer.cpp
|
| +++ b/src/core/SkValidatingReadBuffer.cpp
|
| @@ -236,28 +236,26 @@ SkFlattenable* SkValidatingReadBuffer::readFlattenable(SkFlattenable::Type type)
|
| return nullptr;
|
| }
|
|
|
| - SkFlattenable::Factory factory = SkFlattenable::NameToFactory(cname);
|
| - if (nullptr == factory) {
|
| - return nullptr; // writer failed to give us the flattenable
|
| + // Get the factory for this flattenable.
|
| + SkFlattenable::Factory factory = getCustomFactory(cname);
|
| + if (!factory) {
|
| + factory = SkFlattenable::NameToFactory(cname);
|
| + if (!factory) {
|
| + return nullptr; // writer failed to give us the flattenable
|
| + }
|
| }
|
|
|
| // if we get here, factory may still be null, but if that is the case, the
|
| // failure was ours, not the writer.
|
| sk_sp<SkFlattenable> obj;
|
| uint32_t sizeRecorded = this->readUInt();
|
| - if (factory) {
|
| - size_t offset = fReader.offset();
|
| - obj = (*factory)(*this);
|
| - // check that we read the amount we expected
|
| - size_t sizeRead = fReader.offset() - offset;
|
| - this->validate(sizeRecorded == sizeRead);
|
| - if (fError) {
|
| - obj = nullptr;
|
| - }
|
| - } else {
|
| - // we must skip the remaining data
|
| - this->skip(sizeRecorded);
|
| - SkASSERT(false);
|
| + size_t offset = fReader.offset();
|
| + obj = (*factory)(*this);
|
| + // check that we read the amount we expected
|
| + size_t sizeRead = fReader.offset() - offset;
|
| + this->validate(sizeRecorded == sizeRead);
|
| + if (fError) {
|
| + obj = nullptr;
|
| }
|
| return obj.release();
|
| }
|
|
|