aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar msarett <msarett@google.com>2016-04-05 12:00:49 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-04-05 12:00:49 -0700
commitbe243d4737bb5601984e1d1c4e72e2a6c0788edf (patch)
treebaabe5f265e3259f70a0529a717da0b958ace56c /src/core
parent5605b56afa5bd89f3148b397318b616fccfd4004 (diff)
Revert of Delete SkFlattenable::Type (part 1) (patchset #1 id:1 of https://codereview.chromium.org/1861013002/ )
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
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkValidatingReadBuffer.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/core/SkValidatingReadBuffer.cpp b/src/core/SkValidatingReadBuffer.cpp
index c80192f8b2..ad4b6c409e 100644
--- a/src/core/SkValidatingReadBuffer.cpp
+++ b/src/core/SkValidatingReadBuffer.cpp
@@ -222,14 +222,20 @@ bool SkValidatingReadBuffer::validateAvailable(size_t size) {
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