Commit 546db6c3 authored by Karandeep Bhatia's avatar Karandeep Bhatia Committed by Commit Bot

JsonSchemaCompiler: Remove redundant PopulateItem overloads.

PopulateItem is used when parsing arrays. We should never be parsing
arrays of optional types (which are represented as std::unique_ptr).
Remove these overloads.

BUG=None

Change-Id: Ia29ef89bd555cbfad10b92e9963e4fda431495a0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2380322
Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
Auto-Submit: Karan Bhatia <karandeepb@chromium.org>
Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#802722}
parent 0c0590bd
......@@ -39,19 +39,6 @@ bool PopulateItem(const base::Value& from,
base::string16* error);
bool PopulateItem(const base::Value& from, std::unique_ptr<base::Value>* out);
// This template is used for types generated by tools/json_schema_compiler.
template <class T>
bool PopulateItem(const base::Value& from, std::unique_ptr<T>* out) {
const base::DictionaryValue* dict = nullptr;
if (!from.GetAsDictionary(&dict))
return false;
std::unique_ptr<T> obj(new T());
if (!T::Populate(*dict, obj.get()))
return false;
*out = std::move(obj);
return true;
}
// This template is used for types generated by tools/json_schema_compiler.
template <class T>
bool PopulateItem(const base::Value& from, T* out) {
......@@ -65,19 +52,6 @@ bool PopulateItem(const base::Value& from, T* out) {
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,
std::unique_ptr<T>* out,
base::string16* error) {
std::unique_ptr<T> obj(new T());
if (!T::Populate(from, obj.get(), error))
return false;
*out = std::move(obj);
return true;
}
// This template is used for types generated by tools/json_schema_compiler with
// error generation enabled.
template <class T>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment