| OLD | NEW |
| 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 //////////////////////////////////////////////////////////////////////////////// | 5 //////////////////////////////////////////////////////////////////////////////// |
| 6 // Threading considerations: | 6 // Threading considerations: |
| 7 // | 7 // |
| 8 // This class is designed to meet various threading guarantees starting from the | 8 // This class is designed to meet various threading guarantees starting from the |
| 9 // ones imposed by NetworkChangeNotifier: | 9 // ones imposed by NetworkChangeNotifier: |
| 10 // - The notifier can be constructed on any thread. | 10 // - The notifier can be constructed on any thread. |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 : base::Thread("DnsConfigService"), | 74 : base::Thread("DnsConfigService"), |
| 75 address_tracker_(base::Bind(base::DoNothing), | 75 address_tracker_(base::Bind(base::DoNothing), |
| 76 base::Bind(base::DoNothing), | 76 base::Bind(base::DoNothing), |
| 77 // We're only interested in tunnel interface changes. | 77 // We're only interested in tunnel interface changes. |
| 78 base::Bind(NotifyNetworkChangeNotifierObservers)) {} | 78 base::Bind(NotifyNetworkChangeNotifierObservers)) {} |
| 79 | 79 |
| 80 virtual ~DnsConfigServiceThread() { | 80 virtual ~DnsConfigServiceThread() { |
| 81 Stop(); | 81 Stop(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 virtual void Init() OVERRIDE { | 84 virtual void Init() override { |
| 85 address_tracker_.Init(); | 85 address_tracker_.Init(); |
| 86 dns_config_service_ = DnsConfigService::CreateSystemService(); | 86 dns_config_service_ = DnsConfigService::CreateSystemService(); |
| 87 dns_config_service_->WatchConfig( | 87 dns_config_service_->WatchConfig( |
| 88 base::Bind(&NetworkChangeNotifier::SetDnsConfig)); | 88 base::Bind(&NetworkChangeNotifier::SetDnsConfig)); |
| 89 } | 89 } |
| 90 | 90 |
| 91 virtual void CleanUp() OVERRIDE { | 91 virtual void CleanUp() override { |
| 92 dns_config_service_.reset(); | 92 dns_config_service_.reset(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 static void NotifyNetworkChangeNotifierObservers() { | 95 static void NotifyNetworkChangeNotifierObservers() { |
| 96 NetworkChangeNotifier::NotifyObserversOfIPAddressChange(); | 96 NetworkChangeNotifier::NotifyObserversOfIPAddressChange(); |
| 97 NetworkChangeNotifier::NotifyObserversOfConnectionTypeChange(); | 97 NetworkChangeNotifier::NotifyObserversOfConnectionTypeChange(); |
| 98 } | 98 } |
| 99 | 99 |
| 100 private: | 100 private: |
| 101 scoped_ptr<DnsConfigService> dns_config_service_; | 101 scoped_ptr<DnsConfigService> dns_config_service_; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 // so delay IPAddressChanged so they get merged with the following | 141 // so delay IPAddressChanged so they get merged with the following |
| 142 // ConnectionTypeChanged signal. | 142 // ConnectionTypeChanged signal. |
| 143 params.ip_address_offline_delay_ = base::TimeDelta::FromSeconds(1); | 143 params.ip_address_offline_delay_ = base::TimeDelta::FromSeconds(1); |
| 144 params.ip_address_online_delay_ = base::TimeDelta::FromSeconds(1); | 144 params.ip_address_online_delay_ = base::TimeDelta::FromSeconds(1); |
| 145 params.connection_type_offline_delay_ = base::TimeDelta::FromSeconds(0); | 145 params.connection_type_offline_delay_ = base::TimeDelta::FromSeconds(0); |
| 146 params.connection_type_online_delay_ = base::TimeDelta::FromSeconds(0); | 146 params.connection_type_online_delay_ = base::TimeDelta::FromSeconds(0); |
| 147 return params; | 147 return params; |
| 148 } | 148 } |
| 149 | 149 |
| 150 } // namespace net | 150 } // namespace net |
| OLD | NEW |