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

Side by Side Diff: net/base/network_change_notifier.cc

Issue 11270039: Add NetworkChangeNotifier connectivity events to the NetLog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
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 #include "net/base/network_change_notifier.h" 5 #include "net/base/network_change_notifier.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/synchronization/lock.h" 8 #include "base/synchronization/lock.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 // static 245 // static
246 void NetworkChangeNotifier::GetDnsConfig(DnsConfig* config) { 246 void NetworkChangeNotifier::GetDnsConfig(DnsConfig* config) {
247 if (!g_network_change_notifier) { 247 if (!g_network_change_notifier) {
248 *config = DnsConfig(); 248 *config = DnsConfig();
249 } else { 249 } else {
250 g_network_change_notifier->network_state_->GetDnsConfig(config); 250 g_network_change_notifier->network_state_->GetDnsConfig(config);
251 } 251 }
252 } 252 }
253 253
254 // static 254 // static
255 const char* NetworkChangeNotifier::ConnectionTypeToString(
256 ConnectionType type) {
257 switch (type) {
258 case CONNECTION_UNKNOWN:
259 return "CONNECTION_UNKNOWN";
260 case CONNECTION_ETHERNET:
261 return "CONNECTION_ETHERNET";
262 case CONNECTION_WIFI:
263 return "CONNECTION_WIFI";
264 case CONNECTION_2G:
265 return "CONNECTION_2G";
266 case CONNECTION_3G:
267 return "CONNECTION_3G";
268 case CONNECTION_4G:
269 return "CONNECTION_4G";
270 case CONNECTION_NONE:
271 return "CONNECTION_NONE";
272 }
mmenke 2012/10/25 16:25:31 To avoid regressions, I suggest putting these in a
pauljensen 2012/10/25 17:08:15 I copied the method of NetLog::EventPhaseToString(
mmenke 2012/10/25 17:34:57 Rsleevi's method is nifty, too. EventPhaseToStrin
273 NOTREACHED();
274 return NULL;
275 }
276
277 // static
255 void NetworkChangeNotifier::NotifyDataReceived(const GURL& source) { 278 void NetworkChangeNotifier::NotifyDataReceived(const GURL& source) {
256 if (!g_network_change_notifier) 279 if (!g_network_change_notifier)
257 return; 280 return;
258 g_network_change_notifier->histogram_watcher_->NotifyDataReceived(source); 281 g_network_change_notifier->histogram_watcher_->NotifyDataReceived(source);
259 } 282 }
260 283
261 // static 284 // static
262 void NetworkChangeNotifier::InitHistogramWatcher() { 285 void NetworkChangeNotifier::InitHistogramWatcher() {
263 if (!g_network_change_notifier) 286 if (!g_network_change_notifier)
264 return; 287 return;
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 DCHECK(g_network_change_notifier); 405 DCHECK(g_network_change_notifier);
383 g_network_change_notifier = NULL; 406 g_network_change_notifier = NULL;
384 } 407 }
385 408
386 NetworkChangeNotifier::DisableForTest::~DisableForTest() { 409 NetworkChangeNotifier::DisableForTest::~DisableForTest() {
387 DCHECK(!g_network_change_notifier); 410 DCHECK(!g_network_change_notifier);
388 g_network_change_notifier = network_change_notifier_; 411 g_network_change_notifier = network_change_notifier_;
389 } 412 }
390 413
391 } // namespace net 414 } // namespace net
OLDNEW
« net/base/net_log_event_type_list.h ('K') | « net/base/network_change_notifier.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698