Delete SkFlattenable::Type (part 1)

This should allow me to delete uses of SkFlattenable::Type in Chrome.
Then I'll follow up with the full delete.
https://codereview.chromium.org/1834303003/

TBR=reed@google.com

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1861013002

Review URL: https://codereview.chromium.org/1861013002
This commit is contained in:
msarett 2016-04-05 09:32:35 -07:00 committed by Commit bot
parent fc11b0afe0
commit 6b63536e91
2 changed files with 2 additions and 8 deletions

View File

@ -14,6 +14,6 @@ class SkData;
SK_API SkData* SkValidatingSerializeFlattenable(SkFlattenable*); SK_API SkData* SkValidatingSerializeFlattenable(SkFlattenable*);
SK_API SkFlattenable* SkValidatingDeserializeFlattenable(const void* data, size_t size, SK_API SkFlattenable* SkValidatingDeserializeFlattenable(const void* data, size_t size,
SkFlattenable::Type type); SkFlattenable::Type type = SkFlattenable::kSkUnused_Type);
#endif #endif

View File

@ -222,20 +222,14 @@ bool SkValidatingReadBuffer::validateAvailable(size_t size) {
return this->validate((size <= SK_MaxU32) && fReader.isAvailable(static_cast<uint32_t>(size))); return this->validate((size <= SK_MaxU32) && fReader.isAvailable(static_cast<uint32_t>(size)));
} }
SkFlattenable* SkValidatingReadBuffer::readFlattenable(SkFlattenable::Type type) { SkFlattenable* SkValidatingReadBuffer::readFlattenable(SkFlattenable::Type) {
SkString name; SkString name;
this->readString(&name); this->readString(&name);
if (fError) { if (fError) {
return nullptr; return nullptr;
} }
// Is this the type we wanted ?
const char* cname = name.c_str(); const char* cname = name.c_str();
SkFlattenable::Type baseType;
if (!SkFlattenable::NameToType(cname, &baseType) || (baseType != type)) {
return nullptr;
}
SkFlattenable::Factory factory = SkFlattenable::NameToFactory(cname); SkFlattenable::Factory factory = SkFlattenable::NameToFactory(cname);
if (nullptr == factory) { if (nullptr == factory) {
return nullptr; // writer failed to give us the flattenable return nullptr; // writer failed to give us the flattenable