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

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

Issue 11415066: FilePathWatcher::Watch() - Listen for sub directory changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added more test cases Created 8 years 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 | « net/dns/dns_config_service_win.cc ('k') | remoting/host/policy_hack/policy_watcher_linux.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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 // Create the timer that will be used for delayed-reading the configuration 115 // Create the timer that will be used for delayed-reading the configuration
116 // file. 116 // file.
117 config_updated_timer_.reset(new base::DelayTimer<ConfigFileWatcherImpl>( 117 config_updated_timer_.reset(new base::DelayTimer<ConfigFileWatcherImpl>(
118 FROM_HERE, base::TimeDelta::FromSeconds(2), this, 118 FROM_HERE, base::TimeDelta::FromSeconds(2), this,
119 &ConfigFileWatcherImpl::ReloadConfig)); 119 &ConfigFileWatcherImpl::ReloadConfig));
120 120
121 // Start watching the configuration file. 121 // Start watching the configuration file.
122 config_watcher_.reset(new base::files::FilePathWatcher()); 122 config_watcher_.reset(new base::files::FilePathWatcher());
123 config_path_ = config_path; 123 config_path_ = config_path;
124 if (!config_watcher_->Watch( 124 if (!config_watcher_->Watch(
125 config_path_, 125 config_path_, false,
126 base::Bind(&ConfigFileWatcherImpl::OnConfigUpdated, this))) { 126 base::Bind(&ConfigFileWatcherImpl::OnConfigUpdated, this))) {
127 LOG(ERROR) << "Couldn't watch file '" << config_path_.value() << "'"; 127 LOG(ERROR) << "Couldn't watch file '" << config_path_.value() << "'";
128 main_task_runner_->PostTask( 128 main_task_runner_->PostTask(
129 FROM_HERE, 129 FROM_HERE,
130 base::Bind(&ConfigFileWatcher::Delegate::OnConfigWatcherError, 130 base::Bind(&ConfigFileWatcher::Delegate::OnConfigWatcherError,
131 delegate_)); 131 delegate_));
132 return; 132 return;
133 } 133 }
134 134
135 // Force reloading of the configuration file at least once. 135 // Force reloading of the configuration file at least once.
136 ReloadConfig(); 136 ReloadConfig();
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 if (config_ != config) { 184 if (config_ != config) {
185 config_ = config; 185 config_ = config;
186 main_task_runner_->PostTask( 186 main_task_runner_->PostTask(
187 FROM_HERE, 187 FROM_HERE,
188 base::Bind(&ConfigFileWatcher::Delegate::OnConfigUpdated, delegate_, 188 base::Bind(&ConfigFileWatcher::Delegate::OnConfigUpdated, delegate_,
189 config_)); 189 config_));
190 } 190 }
191 } 191 }
192 192
193 } // namespace remoting 193 } // namespace remoting
OLDNEW
« no previous file with comments | « net/dns/dns_config_service_win.cc ('k') | remoting/host/policy_hack/policy_watcher_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698