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

Unified Diff: net/base/network_change_notifier_linux.cc

Issue 11360108: Start calculating new combined NetworkChangeNotifier signal (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address szym's first round of comments Created 8 years, 1 month 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
Index: net/base/network_change_notifier_linux.cc
diff --git a/net/base/network_change_notifier_linux.cc b/net/base/network_change_notifier_linux.cc
index a3753a96c1e27df910e751ae88a95d21ddbedf3f..64f0d28deddecc12c3a02eb2945764d002bb6bac 100644
--- a/net/base/network_change_notifier_linux.cc
+++ b/net/base/network_change_notifier_linux.cc
@@ -306,7 +306,8 @@ NetworkChangeNotifierLinux* NetworkChangeNotifierLinux::CreateForTest(
}
NetworkChangeNotifierLinux::NetworkChangeNotifierLinux(dbus::Bus* bus)
- : notifier_thread_(new Thread(bus)) {
+ : NetworkChangeNotifier(NetworkChangeCalculatorParamsLinux()),
+ notifier_thread_(new Thread(bus)) {
// We create this notifier thread because the notification implementation
// needs a MessageLoopForIO, and there's no guarantee that
// MessageLoop::current() meets that criterion.
@@ -320,6 +321,20 @@ NetworkChangeNotifierLinux::~NetworkChangeNotifierLinux() {
notifier_thread_->Stop();
}
+// static
+NetworkChangeNotifier::NetworkChangeCalculatorParams
+NetworkChangeNotifierLinux::NetworkChangeCalculatorParamsLinux() {
+ NetworkChangeCalculatorParams params;
+ // Delay values arrived at by simple experimentation and adjusted so as to
+ // produce a single signal when switching between network connections.
+ params.ip_address_offline_delay_ = base::TimeDelta::FromMilliseconds(1500);
+ params.ip_address_online_delay_ = base::TimeDelta::FromMilliseconds(500);
+ params.connection_type_offline_delay_ =
+ base::TimeDelta::FromMilliseconds(1500);
+ params.connection_type_online_delay_ = base::TimeDelta::FromMilliseconds(500);
+ return params;
+}
+
NetworkChangeNotifier::ConnectionType
NetworkChangeNotifierLinux::GetCurrentConnectionType() const {
return notifier_thread_->GetCurrentConnectionType();

Powered by Google App Engine
This is Rietveld 408576698