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

Unified Diff: components/safe_json/safe_json_parser_message_filter.cc

Issue 1861573002: Convert the utility process JSON parser into a Mojo service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove from IPC message start. Created 4 years, 8 months 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_message_filter.cc
diff --git a/components/safe_json/safe_json_parser_message_filter.cc b/components/safe_json/safe_json_parser_message_filter.cc
deleted file mode 100644
index 5c61ca5699ddad95a763fa355525785df68bf227..0000000000000000000000000000000000000000
--- a/components/safe_json/safe_json_parser_message_filter.cc
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/safe_json/safe_json_parser_message_filter.h"
-
-#include <memory>
-#include <utility>
-
-#include "base/json/json_reader.h"
-#include "base/values.h"
-#include "components/safe_json/safe_json_parser_messages.h"
-#include "content/public/utility/utility_thread.h"
-#include "ipc/ipc_message.h"
-
-namespace {
-
-bool Send(IPC::Message* message) {
- return content::UtilityThread::Get()->Send(message);
-}
-
-} // namespace
-
-namespace safe_json {
-
-SafeJsonParserMessageFilter::SafeJsonParserMessageFilter() {
-}
-SafeJsonParserMessageFilter::~SafeJsonParserMessageFilter() {
-}
-
-bool SafeJsonParserMessageFilter::OnMessageReceived(
- const IPC::Message& message) {
- bool handled = true;
- IPC_BEGIN_MESSAGE_MAP(SafeJsonParserMessageFilter, message)
- IPC_MESSAGE_HANDLER(SafeJsonParserMsg_ParseJSON, OnParseJSON)
- IPC_MESSAGE_UNHANDLED(handled = false)
- IPC_END_MESSAGE_MAP()
-
- return handled;
-}
-
-void SafeJsonParserMessageFilter::OnParseJSON(const std::string& json) {
- int error_code;
- std::string error;
- std::unique_ptr<base::Value> value = base::JSONReader::ReadAndReturnError(
- json, base::JSON_PARSE_RFC, &error_code, &error);
- if (value) {
- base::ListValue wrapper;
- wrapper.Append(std::move(value));
- Send(new SafeJsonParserHostMsg_ParseJSON_Succeeded(wrapper));
- } else {
- Send(new SafeJsonParserHostMsg_ParseJSON_Failed(error));
- }
-
- content::UtilityThread::Get()->ReleaseProcessIfNeeded();
-}
-
-} // namespace safe_json
« no previous file with comments | « components/safe_json/safe_json_parser_message_filter.h ('k') | components/safe_json/safe_json_parser_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698