Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Side by Side Diff: components/tracing/trace_config_file.cc

Issue 1719983005: base: Stop overloading ReadFileToString() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix errors Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « components/policy/core/common/cloud/user_cloud_policy_store.cc ('k') | content/browser/webui/web_ui_mojo_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698