diff options
author | alexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-12 01:31:19 +0000 |
---|---|---|
committer | alexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-12 01:31:19 +0000 |
commit | 2fb3134e9e1ec13a3695dcc89bfd24a41da2de33 (patch) | |
tree | e287559ae13a8a3c8f691b267d0239c41343d8d3 | |
parent | 42aa0831433b15eb45b868fe97725ba4b27b3f9a (diff) | |
download | chromium_src-2fb3134e9e1ec13a3695dcc89bfd24a41da2de33.zip chromium_src-2fb3134e9e1ec13a3695dcc89bfd24a41da2de33.tar.gz chromium_src-2fb3134e9e1ec13a3695dcc89bfd24a41da2de33.tar.bz2 |
[Chromoting] Do not post an updated host configuration unless the configuration has actually changed.
BUG=134694
Review URL: https://chromiumcodereview.appspot.com/10910206
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@156199 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | remoting/host/config_file_watcher.cc | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/remoting/host/config_file_watcher.cc b/remoting/host/config_file_watcher.cc index 584bf90..1f19900 100644 --- a/remoting/host/config_file_watcher.cc +++ b/remoting/host/config_file_watcher.cc @@ -4,6 +4,8 @@ #include "remoting/host/config_file_watcher.h" +#include <string> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/files/file_path_watcher.h" @@ -50,6 +52,7 @@ class ConfigFileWatcherImpl // Reads the configuration file and passes it to the delegate. void ReloadConfig(); + std::string config_; FilePath config_path_; scoped_ptr<base::DelayTimer<ConfigFileWatcherImpl> > config_updated_timer_; @@ -177,10 +180,14 @@ void ConfigFileWatcherImpl::ReloadConfig() { return; } - main_task_runner_->PostTask( - FROM_HERE, - base::Bind(&ConfigFileWatcher::Delegate::OnConfigUpdated, delegate_, - config)); + // Post an updated configuration only if it has actually changed. + if (config_ != config) { + config_ = config; + main_task_runner_->PostTask( + FROM_HERE, + base::Bind(&ConfigFileWatcher::Delegate::OnConfigUpdated, delegate_, + config_)); + } } } // namespace remoting |