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

Side by Side Diff: net/android/network_change_notifier_android.cc

Issue 11360108: Start calculating new combined NetworkChangeNotifier signal (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Switch to default argument constructor Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/android/network_change_notifier_android.h ('k') | net/base/net_log_event_type_list.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 NetworkChangeNotifier::NotifyObserversOfConnectionTypeChange(); 78 NetworkChangeNotifier::NotifyObserversOfConnectionTypeChange();
79 } 79 }
80 80
81 // static 81 // static
82 bool NetworkChangeNotifierAndroid::Register(JNIEnv* env) { 82 bool NetworkChangeNotifierAndroid::Register(JNIEnv* env) {
83 return NetworkChangeNotifierDelegateAndroid::Register(env); 83 return NetworkChangeNotifierDelegateAndroid::Register(env);
84 } 84 }
85 85
86 NetworkChangeNotifierAndroid::NetworkChangeNotifierAndroid( 86 NetworkChangeNotifierAndroid::NetworkChangeNotifierAndroid(
87 NetworkChangeNotifierDelegateAndroid* delegate) 87 NetworkChangeNotifierDelegateAndroid* delegate)
88 : delegate_(delegate) { 88 : NetworkChangeNotifier(NetworkChangeCalculatorParamsAndroid()),
89 delegate_(delegate) {
89 SetConnectionType(NetworkChangeNotifier::CONNECTION_UNKNOWN); 90 SetConnectionType(NetworkChangeNotifier::CONNECTION_UNKNOWN);
90 delegate_->AddObserver(this); 91 delegate_->AddObserver(this);
91 } 92 }
92 93
94 // static
95 NetworkChangeNotifier::NetworkChangeCalculatorParams
96 NetworkChangeNotifierAndroid::NetworkChangeCalculatorParamsAndroid() {
97 NetworkChangeCalculatorParams params;
98 // IPAddressChanged is produced immediately prior to ConnectionTypeChanged
99 // so delay IPAddressChanged so they get merged with the following
100 // ConnectionTypeChanged signal.
101 params.ip_address_offline_delay_ = base::TimeDelta::FromSeconds(1);
102 params.ip_address_online_delay_ = base::TimeDelta::FromSeconds(1);
103 params.connection_type_offline_delay_ = base::TimeDelta::FromSeconds(0);
104 params.connection_type_online_delay_ = base::TimeDelta::FromSeconds(0);
105 return params;
106 }
107
93 void NetworkChangeNotifierAndroid::SetConnectionType( 108 void NetworkChangeNotifierAndroid::SetConnectionType(
94 ConnectionType new_connection_type) { 109 ConnectionType new_connection_type) {
95 base::AutoLock auto_lock(connection_type_lock_); 110 base::AutoLock auto_lock(connection_type_lock_);
96 connection_type_ = new_connection_type; 111 connection_type_ = new_connection_type;
97 } 112 }
98 113
99 } // namespace net 114 } // namespace net
OLDNEW
« no previous file with comments | « net/android/network_change_notifier_android.h ('k') | net/base/net_log_event_type_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698