| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/tracing/trace_config_file.h" | 5 #include "components/tracing/trace_config_file.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 &trace_config_file_content, | 80 &trace_config_file_content, |
| 81 kTraceConfigFileSizeLimit)) { | 81 kTraceConfigFileSizeLimit)) { |
| 82 return; | 82 return; |
| 83 } | 83 } |
| 84 is_enabled_ = ParseTraceConfigFileContent(trace_config_file_content); | 84 is_enabled_ = ParseTraceConfigFileContent(trace_config_file_content); |
| 85 } | 85 } |
| 86 | 86 |
| 87 TraceConfigFile::~TraceConfigFile() { | 87 TraceConfigFile::~TraceConfigFile() { |
| 88 } | 88 } |
| 89 | 89 |
| 90 bool TraceConfigFile::ParseTraceConfigFileContent(std::string content) { | 90 bool TraceConfigFile::ParseTraceConfigFileContent(const std::string& content) { |
| 91 scoped_ptr<base::Value> value(base::JSONReader::Read(content)); | 91 scoped_ptr<base::Value> value(base::JSONReader::Read(content)); |
| 92 if (!value || !value->IsType(base::Value::TYPE_DICTIONARY)) | 92 if (!value || !value->IsType(base::Value::TYPE_DICTIONARY)) |
| 93 return false; | 93 return false; |
| 94 | 94 |
| 95 scoped_ptr<base::DictionaryValue> dict( | 95 scoped_ptr<base::DictionaryValue> dict( |
| 96 static_cast<base::DictionaryValue*>(value.release())); | 96 static_cast<base::DictionaryValue*>(value.release())); |
| 97 | 97 |
| 98 base::DictionaryValue* trace_config_dict = NULL; | 98 base::DictionaryValue* trace_config_dict = NULL; |
| 99 if (!dict->GetDictionary(kTraceConfigParam, &trace_config_dict)) | 99 if (!dict->GetDictionary(kTraceConfigParam, &trace_config_dict)) |
| 100 return false; | 100 return false; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 131 } | 131 } |
| 132 | 132 |
| 133 #if !defined(OS_ANDROID) | 133 #if !defined(OS_ANDROID) |
| 134 base::FilePath TraceConfigFile::GetResultFile() const { | 134 base::FilePath TraceConfigFile::GetResultFile() const { |
| 135 DCHECK(IsEnabled()); | 135 DCHECK(IsEnabled()); |
| 136 return result_file_; | 136 return result_file_; |
| 137 } | 137 } |
| 138 #endif | 138 #endif |
| 139 | 139 |
| 140 } // namespace tracing | 140 } // namespace tracing |
| OLD | NEW |