| Index: base/trace_event/trace_config.cc
|
| diff --git a/base/trace_event/trace_config.cc b/base/trace_event/trace_config.cc
|
| index c2c7ad792278ba34040f1c8d74720651e3d88309..d60c08124d29be4e5e65395eabec108da00cade8 100644
|
| --- a/base/trace_event/trace_config.cc
|
| +++ b/base/trace_event/trace_config.cc
|
| @@ -103,10 +103,6 @@
|
| NOTREACHED();
|
| }
|
| InitializeFromStrings(category_filter_string, trace_options_string);
|
| -}
|
| -
|
| -TraceConfig::TraceConfig(const DictionaryValue& config) {
|
| - InitializeFromConfigDict(config);
|
| }
|
|
|
| TraceConfig::TraceConfig(const std::string& config_string) {
|
| @@ -292,10 +288,18 @@
|
| excluded_categories_.push_back("*Test");
|
| }
|
|
|
| -void TraceConfig::InitializeFromConfigDict(const DictionaryValue& dict) {
|
| +void TraceConfig::InitializeFromConfigString(const std::string& config_string) {
|
| + scoped_ptr<base::Value> value(base::JSONReader::Read(config_string));
|
| + if (!value || !value->IsType(base::Value::TYPE_DICTIONARY)) {
|
| + InitializeDefault();
|
| + return;
|
| + }
|
| + scoped_ptr<base::DictionaryValue> dict(
|
| + static_cast<base::DictionaryValue*>(value.release()));
|
| +
|
| record_mode_ = RECORD_UNTIL_FULL;
|
| std::string record_mode;
|
| - if (dict.GetString(kRecordModeParam, &record_mode)) {
|
| + if (dict->GetString(kRecordModeParam, &record_mode)) {
|
| if (record_mode == kRecordUntilFull) {
|
| record_mode_ = RECORD_UNTIL_FULL;
|
| } else if (record_mode == kRecordContinuously) {
|
| @@ -308,55 +312,40 @@
|
| }
|
|
|
| bool enable_sampling;
|
| - if (!dict.GetBoolean(kEnableSamplingParam, &enable_sampling))
|
| + if (!dict->GetBoolean(kEnableSamplingParam, &enable_sampling))
|
| enable_sampling_ = false;
|
| else
|
| enable_sampling_ = enable_sampling;
|
|
|
| bool enable_systrace;
|
| - if (!dict.GetBoolean(kEnableSystraceParam, &enable_systrace))
|
| + if (!dict->GetBoolean(kEnableSystraceParam, &enable_systrace))
|
| enable_systrace_ = false;
|
| else
|
| enable_systrace_ = enable_systrace;
|
|
|
| bool enable_argument_filter;
|
| - if (!dict.GetBoolean(kEnableArgumentFilterParam, &enable_argument_filter))
|
| + if (!dict->GetBoolean(kEnableArgumentFilterParam, &enable_argument_filter))
|
| enable_argument_filter_ = false;
|
| else
|
| enable_argument_filter_ = enable_argument_filter;
|
|
|
| - const base::ListValue* category_list = nullptr;
|
| - if (dict.GetList(kIncludedCategoriesParam, &category_list))
|
| + base::ListValue* category_list = nullptr;
|
| + if (dict->GetList(kIncludedCategoriesParam, &category_list))
|
| SetCategoriesFromIncludedList(*category_list);
|
| - if (dict.GetList(kExcludedCategoriesParam, &category_list))
|
| + if (dict->GetList(kExcludedCategoriesParam, &category_list))
|
| SetCategoriesFromExcludedList(*category_list);
|
| - if (dict.GetList(kSyntheticDelaysParam, &category_list))
|
| + if (dict->GetList(kSyntheticDelaysParam, &category_list))
|
| SetSyntheticDelaysFromList(*category_list);
|
|
|
| if (IsCategoryEnabled(MemoryDumpManager::kTraceCategory)) {
|
| // If dump triggers not set, the client is using the legacy with just
|
| // category enabled. So, use the default periodic dump config.
|
| - const base::DictionaryValue* memory_dump_config = nullptr;
|
| - if (dict.GetDictionary(kMemoryDumpConfigParam, &memory_dump_config))
|
| + base::DictionaryValue* memory_dump_config = nullptr;
|
| + if (dict->GetDictionary(kMemoryDumpConfigParam, &memory_dump_config))
|
| SetMemoryDumpConfig(*memory_dump_config);
|
| else
|
| SetDefaultMemoryDumpConfig();
|
| }
|
| -}
|
| -
|
| -void TraceConfig::InitializeFromConfigString(const std::string& config_string) {
|
| - scoped_ptr<Value> value(JSONReader::Read(config_string));
|
| - if (!value)
|
| - return InitializeDefault();
|
| -
|
| - const DictionaryValue* dict = nullptr;
|
| - bool is_dict = value->GetAsDictionary(&dict);
|
| -
|
| - if (!is_dict)
|
| - return InitializeDefault();
|
| -
|
| - DCHECK(dict);
|
| - InitializeFromConfigDict(*dict);
|
| }
|
|
|
| void TraceConfig::InitializeFromStrings(
|
|
|