Commit ceea2b06 authored by Brett Wilson's avatar Brett Wilson Committed by Commit Bot

Remove JSON_DETACHABLE_CHILDREN option.

We previously removed the optimization that this option turned off but
forgot to remove the option. It currently does nothing, so removing it
is a no-op.

Change-Id: Iefe122b9351dbe06f88fec098d4267b789b8e786
Reviewed-on: https://chromium-review.googlesource.com/578245
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: default avatarJan Wilken Dörrie <jdoerrie@chromium.org>
Cr-Commit-Position: refs/heads/master@{#488156}
parent 6ee78f52
...@@ -50,16 +50,10 @@ enum JSONParserOptions { ...@@ -50,16 +50,10 @@ enum JSONParserOptions {
// Allows commas to exist after the last element in structures. // Allows commas to exist after the last element in structures.
JSON_ALLOW_TRAILING_COMMAS = 1 << 0, JSON_ALLOW_TRAILING_COMMAS = 1 << 0,
// The parser can perform optimizations by placing hidden data in the root of
// the JSON object, which speeds up certain operations on children. However,
// if the child is Remove()d from root, it would result in use-after-free
// unless it is DeepCopy()ed or this option is used.
JSON_DETACHABLE_CHILDREN = 1 << 1,
// If set the parser replaces invalid characters with the Unicode replacement // If set the parser replaces invalid characters with the Unicode replacement
// character (U+FFFD). If not set, invalid characters trigger a hard error and // character (U+FFFD). If not set, invalid characters trigger a hard error and
// parsing fails. // parsing fails.
JSON_REPLACE_INVALID_CHARACTERS = 1 << 2, JSON_REPLACE_INVALID_CHARACTERS = 1 << 1,
}; };
class BASE_EXPORT JSONReader { class BASE_EXPORT JSONReader {
......
...@@ -606,7 +606,7 @@ TEST(JSONReaderTest, StringOptimizations) { ...@@ -606,7 +606,7 @@ TEST(JSONReaderTest, StringOptimizations) {
" \"b\"" " \"b\""
" ]" " ]"
"}", "}",
JSON_DETACHABLE_CHILDREN); JSON_PARSE_RFC);
ASSERT_TRUE(root); ASSERT_TRUE(root);
DictionaryValue* root_dict = nullptr; DictionaryValue* root_dict = nullptr;
......
...@@ -192,8 +192,8 @@ void TraceEventTestFixture::OnTraceDataCollected( ...@@ -192,8 +192,8 @@ void TraceEventTestFixture::OnTraceDataCollected(
trace_buffer_.AddFragment(events_str->data()); trace_buffer_.AddFragment(events_str->data());
trace_buffer_.Finish(); trace_buffer_.Finish();
std::unique_ptr<Value> root = base::JSONReader::Read( std::unique_ptr<Value> root =
json_output_.json_output, JSON_PARSE_RFC | JSON_DETACHABLE_CHILDREN); base::JSONReader::Read(json_output_.json_output, JSON_PARSE_RFC);
if (!root.get()) { if (!root.get()) {
LOG(ERROR) << json_output_.json_output; LOG(ERROR) << json_output_.json_output;
......
...@@ -404,8 +404,8 @@ bool ComponentCloudPolicyStore::ParsePolicy(const std::string& data, ...@@ -404,8 +404,8 @@ bool ComponentCloudPolicyStore::ParsePolicy(const std::string& data,
PolicyMap* policy) { PolicyMap* policy) {
std::string json_reader_error_message; std::string json_reader_error_message;
std::unique_ptr<base::Value> json = base::JSONReader::ReadAndReturnError( std::unique_ptr<base::Value> json = base::JSONReader::ReadAndReturnError(
data, base::JSON_PARSE_RFC | base::JSON_DETACHABLE_CHILDREN, data, base::JSON_PARSE_RFC, nullptr /* error_code_out */,
nullptr /* error_code_out */, &json_reader_error_message); &json_reader_error_message);
base::DictionaryValue* dict = nullptr; base::DictionaryValue* dict = nullptr;
if (!json) { if (!json) {
LOG(ERROR) << "Invalid JSON blob: " << json_reader_error_message; LOG(ERROR) << "Invalid JSON blob: " << json_reader_error_message;
......
...@@ -39,11 +39,11 @@ std::unique_ptr<base::DictionaryValue> LoadSchemaDictionary( ...@@ -39,11 +39,11 @@ std::unique_ptr<base::DictionaryValue> LoadSchemaDictionary(
const std::string& name, const std::string& name,
const base::StringPiece& schema) { const base::StringPiece& schema) {
std::string error_message; std::string error_message;
std::unique_ptr<base::Value> result(base::JSONReader::ReadAndReturnError( std::unique_ptr<base::Value> result(
schema, base::JSONReader::ReadAndReturnError(schema,
base::JSON_PARSE_RFC | base::JSON_DETACHABLE_CHILDREN, // options base::JSON_PARSE_RFC, // options
NULL, // error code NULL, // error code
&error_message)); &error_message));
// Tracking down http://crbug.com/121424 // Tracking down http://crbug.com/121424
char buf[128]; char buf[128];
......
...@@ -79,9 +79,8 @@ class TraceNetLogObserverTest : public testing::Test { ...@@ -79,9 +79,8 @@ class TraceNetLogObserverTest : public testing::Test {
trace_buffer_.Finish(); trace_buffer_.Finish();
std::unique_ptr<base::Value> trace_value; std::unique_ptr<base::Value> trace_value;
trace_value = base::JSONReader::Read( trace_value =
json_output_.json_output, base::JSONReader::Read(json_output_.json_output, base::JSON_PARSE_RFC);
base::JSON_PARSE_RFC | base::JSON_DETACHABLE_CHILDREN);
ASSERT_TRUE(trace_value) << json_output_.json_output; ASSERT_TRUE(trace_value) << json_output_.json_output;
base::ListValue* trace_events = NULL; base::ListValue* trace_events = NULL;
......
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