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:
parent
fc11b0afe0
commit
6b63536e91
@ -14,6 +14,6 @@ class SkData;
|
||||
|
||||
SK_API SkData* SkValidatingSerializeFlattenable(SkFlattenable*);
|
||||
SK_API SkFlattenable* SkValidatingDeserializeFlattenable(const void* data, size_t size,
|
||||
SkFlattenable::Type type);
|
||||
SkFlattenable::Type type = SkFlattenable::kSkUnused_Type);
|
||||
|
||||
#endif
|
||||
|
@ -222,20 +222,14 @@ bool SkValidatingReadBuffer::validateAvailable(size_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;
|
||||
this->readString(&name);
|
||||
if (fError) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Is this the type we wanted ?
|
||||
const char* cname = name.c_str();
|
||||
SkFlattenable::Type baseType;
|
||||
if (!SkFlattenable::NameToType(cname, &baseType) || (baseType != type)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SkFlattenable::Factory factory = SkFlattenable::NameToFactory(cname);
|
||||
if (nullptr == factory) {
|
||||
return nullptr; // writer failed to give us the flattenable
|
||||
|
Loading…
Reference in New Issue
Block a user