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 {
// Allows commas to exist after the last element in structures.
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
// character (U+FFFD). If not set, invalid characters trigger a hard error and
// parsing fails.
JSON_REPLACE_INVALID_CHARACTERS = 1 << 2,
JSON_REPLACE_INVALID_CHARACTERS = 1 << 1,
};
class BASE_EXPORT JSONReader {
......
......@@ -606,7 +606,7 @@ TEST(JSONReaderTest, StringOptimizations) {
" \"b\""
" ]"
"}",
JSON_DETACHABLE_CHILDREN);
JSON_PARSE_RFC);
ASSERT_TRUE(root);
DictionaryValue* root_dict = nullptr;
......
......@@ -192,8 +192,8 @@ void TraceEventTestFixture::OnTraceDataCollected(
trace_buffer_.AddFragment(events_str->data());
trace_buffer_.Finish();
std::unique_ptr<Value> root = base::JSONReader::Read(
json_output_.json_output, JSON_PARSE_RFC | JSON_DETACHABLE_CHILDREN);
std::unique_ptr<Value> root =
base::JSONReader::Read(json_output_.json_output, JSON_PARSE_RFC);
if (!root.get()) {
LOG(ERROR) << json_output_.json_output;
......
......@@ -404,8 +404,8 @@ bool ComponentCloudPolicyStore::ParsePolicy(const std::string& data,
PolicyMap* policy) {
std::string json_reader_error_message;
std::unique_ptr<base::Value> json = base::JSONReader::ReadAndReturnError(
data, base::JSON_PARSE_RFC | base::JSON_DETACHABLE_CHILDREN,
nullptr /* error_code_out */, &json_reader_error_message);
data, base::JSON_PARSE_RFC, nullptr /* error_code_out */,
&json_reader_error_message);
base::DictionaryValue* dict = nullptr;
if (!json) {
LOG(ERROR) << "Invalid JSON blob: " << json_reader_error_message;
......
......@@ -39,9 +39,9 @@ std::unique_ptr<base::DictionaryValue> LoadSchemaDictionary(
const std::string& name,
const base::StringPiece& schema) {
std::string error_message;
std::unique_ptr<base::Value> result(base::JSONReader::ReadAndReturnError(
schema,
base::JSON_PARSE_RFC | base::JSON_DETACHABLE_CHILDREN, // options
std::unique_ptr<base::Value> result(
base::JSONReader::ReadAndReturnError(schema,
base::JSON_PARSE_RFC, // options
NULL, // error code
&error_message));
......
......@@ -79,9 +79,8 @@ class TraceNetLogObserverTest : public testing::Test {
trace_buffer_.Finish();
std::unique_ptr<base::Value> trace_value;
trace_value = base::JSONReader::Read(
json_output_.json_output,
base::JSON_PARSE_RFC | base::JSON_DETACHABLE_CHILDREN);
trace_value =
base::JSONReader::Read(json_output_.json_output, base::JSON_PARSE_RFC);
ASSERT_TRUE(trace_value) << json_output_.json_output;
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