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

Side by Side Diff: remoting/host/config_file_watcher.cc

Issue 19579005: Move ReadFileToString to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « printing/image.cc ('k') | remoting/host/json_host_config.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "remoting/host/config_file_watcher.h" 5 #include "remoting/host/config_file_watcher.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 // If the writer moves the new configuration file into place atomically, 173 // If the writer moves the new configuration file into place atomically,
174 // this delay may not be necessary. 174 // this delay may not be necessary.
175 if (!error && config_path_ == path) 175 if (!error && config_path_ == path)
176 config_updated_timer_->Reset(); 176 config_updated_timer_->Reset();
177 } 177 }
178 178
179 void ConfigFileWatcherImpl::ReloadConfig() { 179 void ConfigFileWatcherImpl::ReloadConfig() {
180 DCHECK(io_task_runner_->BelongsToCurrentThread()); 180 DCHECK(io_task_runner_->BelongsToCurrentThread());
181 181
182 std::string config; 182 std::string config;
183 if (!file_util::ReadFileToString(config_path_, &config)) { 183 if (!base::ReadFileToString(config_path_, &config)) {
184 #if defined(OS_WIN) 184 #if defined(OS_WIN)
185 // EACCESS may indicate a locking or sharing violation. Retry a few times 185 // EACCESS may indicate a locking or sharing violation. Retry a few times
186 // before reporting an error. 186 // before reporting an error.
187 if (errno == EACCES && retries_ < kMaxRetries) { 187 if (errno == EACCES && retries_ < kMaxRetries) {
188 PLOG(WARNING) << "Failed to read '" << config_path_.value() << "'"; 188 PLOG(WARNING) << "Failed to read '" << config_path_.value() << "'";
189 189
190 retries_ += 1; 190 retries_ += 1;
191 config_updated_timer_->Reset(); 191 config_updated_timer_->Reset();
192 return; 192 return;
193 } 193 }
(...skipping 13 matching lines...) Expand all
207 if (config_ != config) { 207 if (config_ != config) {
208 config_ = config; 208 config_ = config;
209 main_task_runner_->PostTask( 209 main_task_runner_->PostTask(
210 FROM_HERE, 210 FROM_HERE,
211 base::Bind(&ConfigFileWatcher::Delegate::OnConfigUpdated, delegate_, 211 base::Bind(&ConfigFileWatcher::Delegate::OnConfigUpdated, delegate_,
212 config_)); 212 config_));
213 } 213 }
214 } 214 }
215 215
216 } // namespace remoting 216 } // namespace remoting
OLDNEW
« no previous file with comments | « printing/image.cc ('k') | remoting/host/json_host_config.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698