Commit 70405149 authored by Anna Malova's avatar Anna Malova Committed by Commit Bot

Convert DnsConfigService to use RepeatingCallback.

Bug: 1007815
Change-Id: I2eef21c585df6441715e188fcc816735b125b828
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2091532
Commit-Queue: Matt Menke <mmenke@chromium.org>
Reviewed-by: default avatarMatt Menke <mmenke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#747929}
parent aa6fd572
......@@ -27,7 +27,7 @@ class NET_EXPORT_PRIVATE DnsConfigService {
public:
// Callback interface for the client, called on the same thread as
// ReadConfig() and WatchConfig().
typedef base::Callback<void(const DnsConfig& config)> CallbackType;
typedef base::RepeatingCallback<void(const DnsConfig& config)> CallbackType;
// DHCP and user-induced changes are on the order of seconds, so 150ms should
// not add perceivable delay. On the other hand, config readers should finish
......
......@@ -61,8 +61,8 @@ class DnsConfigServiceTest : public TestWithTaskEnvironment {
void SetUp() override {
service_.reset(new TestDnsConfigService());
service_->WatchConfig(base::Bind(&DnsConfigServiceTest::OnConfigChanged,
base::Unretained(this)));
service_->WatchConfig(base::BindRepeating(
&DnsConfigServiceTest::OnConfigChanged, base::Unretained(this)));
EXPECT_FALSE(last_config_.IsValid());
}
......
......@@ -296,7 +296,7 @@ HostsParseWinResult AddLocalhostEntries(DnsHosts* hosts) {
// Watches a single registry key for changes.
class RegistryWatcher {
public:
typedef base::Callback<void(bool succeeded)> CallbackType;
typedef base::RepeatingCallback<void(bool succeeded)> CallbackType;
RegistryWatcher() {}
~RegistryWatcher() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); }
......@@ -607,9 +607,8 @@ class DnsConfigServiceWin::Watcher
~Watcher() override { NetworkChangeNotifier::RemoveIPAddressObserver(this); }
bool Watch() {
RegistryWatcher::CallbackType callback =
base::Bind(&DnsConfigServiceWin::OnConfigChanged,
base::Unretained(service_));
RegistryWatcher::CallbackType callback = base::BindRepeating(
&DnsConfigServiceWin::OnConfigChanged, base::Unretained(service_));
bool success = true;
......@@ -635,8 +634,8 @@ class DnsConfigServiceWin::Watcher
policy_watcher_.Watch(kPolicyPath, callback);
if (!hosts_watcher_.Watch(GetHostsPath(), false,
base::Bind(&Watcher::OnHostsChanged,
base::Unretained(this)))) {
base::BindRepeating(&Watcher::OnHostsChanged,
base::Unretained(this)))) {
UMA_HISTOGRAM_ENUMERATION("AsyncDNS.WatchStatus",
DNS_CONFIG_WATCH_FAILED_TO_START_HOSTS,
DNS_CONFIG_WATCH_MAX);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment