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

Unified Diff: remoting/host/config_file_watcher.cc

Issue 10910206: [Chromoting] Do not post updated host configuration unless the configuration has actually changed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/config_file_watcher.cc
diff --git a/remoting/host/config_file_watcher.cc b/remoting/host/config_file_watcher.cc
index 584bf901feb9c585fc2e632a1c57a9e5b545b058..1f19900b311463c50a67cbf3d44539b463b9bc25 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698