Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(438)

Unified Diff: components/safe_json/safe_json_parser_impl.cc

Issue 2577563002: Add struct traits for base::Value. (Closed)
Patch Set: rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/safe_json/safe_json_parser_impl.cc
diff --git a/components/safe_json/safe_json_parser_impl.cc b/components/safe_json/safe_json_parser_impl.cc
index eadb80c8365ef15b43215e174e18b3ae8e978530..9538c501d29b9d7903bb146c958b6538c03c484c 100644
--- a/components/safe_json/safe_json_parser_impl.cc
+++ b/components/safe_json/safe_json_parser_impl.cc
@@ -61,28 +61,18 @@ void SafeJsonParserImpl::OnConnectionError() {
nullptr, "Connection error with the json parser process."));
}
-void SafeJsonParserImpl::OnParseDone(const base::ListValue& wrapper,
+void SafeJsonParserImpl::OnParseDone(std::unique_ptr<base::Value> result,
const base::Optional<std::string>& error) {
DCHECK(io_thread_checker_.CalledOnValidThread());
// Shut down the utility process.
mojo_json_parser_.reset();
- std::unique_ptr<base::Value> parsed_json;
- std::string error_message;
- if (!wrapper.empty()) {
- const base::Value* value = nullptr;
- CHECK(wrapper.Get(0, &value));
- parsed_json.reset(value->DeepCopy());
- } else if (error.has_value()) {
- error_message = error.value();
- }
-
// Call ReportResults() on caller's thread.
caller_task_runner_->PostTask(
FROM_HERE,
base::Bind(&SafeJsonParserImpl::ReportResults, base::Unretained(this),
- base::Passed(&parsed_json), error_message));
+ base::Passed(&result), error.value_or("")));
}
void SafeJsonParserImpl::ReportResults(std::unique_ptr<base::Value> parsed_json,
« no previous file with comments | « components/safe_json/safe_json_parser_impl.h ('k') | components/safe_json/utility/safe_json_parser_mojo_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698