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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 DLOG(WARNING) << "Use default trace config."; | 75 DLOG(WARNING) << "Use default trace config."; |
76 return; | 76 return; |
77 } | 77 } |
78 | 78 |
79 if (!base::PathExists(trace_config_file)) { | 79 if (!base::PathExists(trace_config_file)) { |
80 DLOG(WARNING) << "The trace config file does not exist."; | 80 DLOG(WARNING) << "The trace config file does not exist."; |
81 return; | 81 return; |
82 } | 82 } |
83 | 83 |
84 std::string trace_config_file_content; | 84 std::string trace_config_file_content; |
85 if (!base::ReadFileToString(trace_config_file, | 85 if (!base::ReadFileToStringWithMaxSize(trace_config_file, |
86 &trace_config_file_content, | 86 &trace_config_file_content, |
87 kTraceConfigFileSizeLimit)) { | 87 kTraceConfigFileSizeLimit)) { |
88 DLOG(WARNING) << "Cannot read the trace config file correctly."; | 88 DLOG(WARNING) << "Cannot read the trace config file correctly."; |
89 return; | 89 return; |
90 } | 90 } |
91 is_enabled_ = ParseTraceConfigFileContent(trace_config_file_content); | 91 is_enabled_ = ParseTraceConfigFileContent(trace_config_file_content); |
92 if (!is_enabled_) | 92 if (!is_enabled_) |
93 DLOG(WARNING) << "Cannot parse the trace config file correctly."; | 93 DLOG(WARNING) << "Cannot parse the trace config file correctly."; |
94 } | 94 } |
95 | 95 |
96 TraceConfigFile::~TraceConfigFile() { | 96 TraceConfigFile::~TraceConfigFile() { |
97 } | 97 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 } | 140 } |
141 | 141 |
142 #if !defined(OS_ANDROID) | 142 #if !defined(OS_ANDROID) |
143 base::FilePath TraceConfigFile::GetResultFile() const { | 143 base::FilePath TraceConfigFile::GetResultFile() const { |
144 DCHECK(IsEnabled()); | 144 DCHECK(IsEnabled()); |
145 return result_file_; | 145 return result_file_; |
146 } | 146 } |
147 #endif | 147 #endif |
148 | 148 |
149 } // namespace tracing | 149 } // namespace tracing |
OLD | NEW |