Reason for revert:
See sugoi's comment.
Original issue's description:
> 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
>
> Committed: https://skia.googlesource.com/skia/+/
6b63536e917d86028630199c4eef4aa1597292ce
TBR=reed@google.com,mtklein@google.com,sugoi@chromium.org,senorblanco@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review URL: https://codereview.chromium.org/
1860693005
SK_API SkData* SkValidatingSerializeFlattenable(SkFlattenable*);
SK_API SkFlattenable* SkValidatingDeserializeFlattenable(const void* data, size_t size,
- SkFlattenable::Type type = SkFlattenable::kSkUnused_Type);
+ SkFlattenable::Type type);
#endif
return this->validate((size <= SK_MaxU32) && fReader.isAvailable(static_cast<uint32_t>(size)));
}
-SkFlattenable* SkValidatingReadBuffer::readFlattenable(SkFlattenable::Type) {
+SkFlattenable* SkValidatingReadBuffer::readFlattenable(SkFlattenable::Type 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