| Index: tools/json_schema_compiler/util.h
|
| diff --git a/tools/json_schema_compiler/util.h b/tools/json_schema_compiler/util.h
|
| index 945f06143e5d8f00dcea9397bac7ef39a05b64eb..d5eec1b2e1c49ee415e0b7fa209148a6f0d5c5f7 100644
|
| --- a/tools/json_schema_compiler/util.h
|
| +++ b/tools/json_schema_compiler/util.h
|
| @@ -86,6 +86,20 @@ bool PopulateItem(const base::Value& from,
|
| return true;
|
| }
|
|
|
| +// This template is used for types generated by tools/json_schema_compiler with
|
| +// error generation enabled.
|
| +template <class T>
|
| +bool PopulateItem(const base::Value& from, T* out, base::string16* error) {
|
| + const base::DictionaryValue* dict = nullptr;
|
| + if (!from.GetAsDictionary(&dict))
|
| + return false;
|
| + T obj;
|
| + if (!T::Populate(*dict, &obj, error))
|
| + return false;
|
| + *out = std::move(obj);
|
| + return true;
|
| +}
|
| +
|
| // Populates |out| with |list|. Returns false if there is no list at the
|
| // specified key or if the list has anything other than |T|.
|
| template <class T>
|
| @@ -114,7 +128,7 @@ bool PopulateArrayFromList(const base::ListValue& list,
|
| for (const base::Value* value : list) {
|
| if (!PopulateItem(*value, &item, error))
|
| return false;
|
| - out->push_back(item);
|
| + out->push_back(std::move(item));
|
| }
|
|
|
| return true;
|
|
|