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

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

Issue 649763002: git cl format the second third of the net/base directory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months 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
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 <limits> 7 #include <limits>
8 8
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 class MockNetworkChangeNotifier : public NetworkChangeNotifier { 46 class MockNetworkChangeNotifier : public NetworkChangeNotifier {
47 public: 47 public:
48 virtual ConnectionType GetCurrentConnectionType() const override { 48 virtual ConnectionType GetCurrentConnectionType() const override {
49 return CONNECTION_UNKNOWN; 49 return CONNECTION_UNKNOWN;
50 } 50 }
51 }; 51 };
52 52
53 } // namespace 53 } // namespace
54 54
55 // The main observer class that records UMAs for network events. 55 // The main observer class that records UMAs for network events.
56 class HistogramWatcher 56 class HistogramWatcher : public NetworkChangeNotifier::ConnectionTypeObserver,
57 : public NetworkChangeNotifier::ConnectionTypeObserver, 57 public NetworkChangeNotifier::IPAddressObserver,
58 public NetworkChangeNotifier::IPAddressObserver, 58 public NetworkChangeNotifier::DNSObserver,
59 public NetworkChangeNotifier::DNSObserver, 59 public NetworkChangeNotifier::NetworkChangeObserver {
60 public NetworkChangeNotifier::NetworkChangeObserver {
61 public: 60 public:
62 HistogramWatcher() 61 HistogramWatcher()
63 : last_ip_address_change_(base::TimeTicks::Now()), 62 : last_ip_address_change_(base::TimeTicks::Now()),
64 last_connection_change_(base::TimeTicks::Now()), 63 last_connection_change_(base::TimeTicks::Now()),
65 last_dns_change_(base::TimeTicks::Now()), 64 last_dns_change_(base::TimeTicks::Now()),
66 last_network_change_(base::TimeTicks::Now()), 65 last_network_change_(base::TimeTicks::Now()),
67 last_connection_type_(NetworkChangeNotifier::CONNECTION_UNKNOWN), 66 last_connection_type_(NetworkChangeNotifier::CONNECTION_UNKNOWN),
68 offline_packets_received_(0), 67 offline_packets_received_(0),
69 bytes_read_since_last_connection_change_(0), 68 bytes_read_since_last_connection_change_(0),
70 peak_kbps_since_last_connection_change_(0) {} 69 peak_kbps_since_last_connection_change_(0) {}
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 break; 230 break;
232 } 231 }
233 232
234 if (type != NetworkChangeNotifier::CONNECTION_NONE) { 233 if (type != NetworkChangeNotifier::CONNECTION_NONE) {
235 UMA_HISTOGRAM_MEDIUM_TIMES("NCN.OnlineChange", state_duration); 234 UMA_HISTOGRAM_MEDIUM_TIMES("NCN.OnlineChange", state_duration);
236 235
237 if (offline_packets_received_) { 236 if (offline_packets_received_) {
238 if ((now - last_offline_packet_received_) < 237 if ((now - last_offline_packet_received_) <
239 base::TimeDelta::FromSeconds(5)) { 238 base::TimeDelta::FromSeconds(5)) {
240 // We can compare this sum with the sum of NCN.OfflineDataRecv. 239 // We can compare this sum with the sum of NCN.OfflineDataRecv.
241 UMA_HISTOGRAM_COUNTS_10000( 240 UMA_HISTOGRAM_COUNTS_10000("NCN.OfflineDataRecvAny5sBeforeOnline",
242 "NCN.OfflineDataRecvAny5sBeforeOnline", 241 offline_packets_received_);
243 offline_packets_received_);
244 } 242 }
245 243
246 UMA_HISTOGRAM_MEDIUM_TIMES("NCN.OfflineDataRecvUntilOnline", 244 UMA_HISTOGRAM_MEDIUM_TIMES("NCN.OfflineDataRecvUntilOnline",
247 now - last_offline_packet_received_); 245 now - last_offline_packet_received_);
248 } 246 }
249 } else { 247 } else {
250 UMA_HISTOGRAM_MEDIUM_TIMES("NCN.OfflineChange", state_duration); 248 UMA_HISTOGRAM_MEDIUM_TIMES("NCN.OfflineChange", state_duration);
251 } 249 }
252 250
253 NetworkChangeNotifier::LogOperatorCodeHistogram(type); 251 NetworkChangeNotifier::LogOperatorCodeHistogram(type);
254 252
255 UMA_HISTOGRAM_MEDIUM_TIMES( 253 UMA_HISTOGRAM_MEDIUM_TIMES("NCN.IPAddressChangeToConnectionTypeChange",
256 "NCN.IPAddressChangeToConnectionTypeChange", 254 now - last_ip_address_change_);
257 now - last_ip_address_change_);
258 255
259 offline_packets_received_ = 0; 256 offline_packets_received_ = 0;
260 bytes_read_since_last_connection_change_ = 0; 257 bytes_read_since_last_connection_change_ = 0;
261 peak_kbps_since_last_connection_change_ = 0; 258 peak_kbps_since_last_connection_change_ = 0;
262 last_connection_type_ = type; 259 last_connection_type_ = type;
263 polling_interval_ = base::TimeDelta::FromSeconds(1); 260 polling_interval_ = base::TimeDelta::FromSeconds(1);
264 } 261 }
265 262
266 // NetworkChangeNotifier::DNSObserver implementation. 263 // NetworkChangeNotifier::DNSObserver implementation.
267 virtual void OnDNSChanged() override { 264 virtual void OnDNSChanged() override {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 return; 312 return;
316 313
317 UMA_HISTOGRAM_MEDIUM_TIMES("NCN.OfflineDataRecv", 314 UMA_HISTOGRAM_MEDIUM_TIMES("NCN.OfflineDataRecv",
318 now - last_connection_change_); 315 now - last_connection_change_);
319 offline_packets_received_++; 316 offline_packets_received_++;
320 last_offline_packet_received_ = now; 317 last_offline_packet_received_ = now;
321 318
322 if ((now - last_polled_connection_) > polling_interval_) { 319 if ((now - last_polled_connection_) > polling_interval_) {
323 polling_interval_ *= 2; 320 polling_interval_ *= 2;
324 last_polled_connection_ = now; 321 last_polled_connection_ = now;
325 last_polled_connection_type_ = 322 last_polled_connection_type_ = NetworkChangeNotifier::GetConnectionType();
326 NetworkChangeNotifier::GetConnectionType();
327 } 323 }
328 if (last_polled_connection_type_ == 324 if (last_polled_connection_type_ ==
329 NetworkChangeNotifier::CONNECTION_NONE) { 325 NetworkChangeNotifier::CONNECTION_NONE) {
330 UMA_HISTOGRAM_MEDIUM_TIMES("NCN.PollingOfflineDataRecv", 326 UMA_HISTOGRAM_MEDIUM_TIMES("NCN.PollingOfflineDataRecv",
331 now - last_connection_change_); 327 now - last_connection_change_);
332 } 328 }
333 } 329 }
334 330
335 private: 331 private:
336 static base::TimeDelta SinceLast(base::TimeTicks *last_time) { 332 static base::TimeDelta SinceLast(base::TimeTicks* last_time) {
337 base::TimeTicks current_time = base::TimeTicks::Now(); 333 base::TimeTicks current_time = base::TimeTicks::Now();
338 base::TimeDelta delta = current_time - *last_time; 334 base::TimeDelta delta = current_time - *last_time;
339 *last_time = current_time; 335 *last_time = current_time;
340 return delta; 336 return delta;
341 } 337 }
342 338
343 base::TimeTicks last_ip_address_change_; 339 base::TimeTicks last_ip_address_change_;
344 base::TimeTicks last_connection_change_; 340 base::TimeTicks last_connection_change_;
345 base::TimeTicks last_dns_change_; 341 base::TimeTicks last_dns_change_;
346 base::TimeTicks last_network_change_; 342 base::TimeTicks last_network_change_;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 DCHECK(thread_checker_.CalledOnValidThread()); 424 DCHECK(thread_checker_.CalledOnValidThread());
429 DCHECK(g_network_change_notifier); 425 DCHECK(g_network_change_notifier);
430 RemoveConnectionTypeObserver(this); 426 RemoveConnectionTypeObserver(this);
431 RemoveIPAddressObserver(this); 427 RemoveIPAddressObserver(this);
432 } 428 }
433 429
434 // NetworkChangeNotifier::IPAddressObserver implementation. 430 // NetworkChangeNotifier::IPAddressObserver implementation.
435 virtual void OnIPAddressChanged() override { 431 virtual void OnIPAddressChanged() override {
436 DCHECK(thread_checker_.CalledOnValidThread()); 432 DCHECK(thread_checker_.CalledOnValidThread());
437 base::TimeDelta delay = last_announced_connection_type_ == CONNECTION_NONE 433 base::TimeDelta delay = last_announced_connection_type_ == CONNECTION_NONE
438 ? params_.ip_address_offline_delay_ : params_.ip_address_online_delay_; 434 ? params_.ip_address_offline_delay_
435 : params_.ip_address_online_delay_;
439 // Cancels any previous timer. 436 // Cancels any previous timer.
440 timer_.Start(FROM_HERE, delay, this, &NetworkChangeCalculator::Notify); 437 timer_.Start(FROM_HERE, delay, this, &NetworkChangeCalculator::Notify);
441 } 438 }
442 439
443 // NetworkChangeNotifier::ConnectionTypeObserver implementation. 440 // NetworkChangeNotifier::ConnectionTypeObserver implementation.
444 virtual void OnConnectionTypeChanged(ConnectionType type) override { 441 virtual void OnConnectionTypeChanged(ConnectionType type) override {
445 DCHECK(thread_checker_.CalledOnValidThread()); 442 DCHECK(thread_checker_.CalledOnValidThread());
446 pending_connection_type_ = type; 443 pending_connection_type_ = type;
447 base::TimeDelta delay = last_announced_connection_type_ == CONNECTION_NONE 444 base::TimeDelta delay = last_announced_connection_type_ == CONNECTION_NONE
448 ? params_.connection_type_offline_delay_ 445 ? params_.connection_type_offline_delay_
449 : params_.connection_type_online_delay_; 446 : params_.connection_type_online_delay_;
450 // Cancels any previous timer. 447 // Cancels any previous timer.
451 timer_.Start(FROM_HERE, delay, this, &NetworkChangeCalculator::Notify); 448 timer_.Start(FROM_HERE, delay, this, &NetworkChangeCalculator::Notify);
452 } 449 }
453 450
454 private: 451 private:
455 void Notify() { 452 void Notify() {
456 DCHECK(thread_checker_.CalledOnValidThread()); 453 DCHECK(thread_checker_.CalledOnValidThread());
457 // Don't bother signaling about dead connections. 454 // Don't bother signaling about dead connections.
458 if (have_announced_ && 455 if (have_announced_ &&
459 (last_announced_connection_type_ == CONNECTION_NONE) && 456 (last_announced_connection_type_ == CONNECTION_NONE) &&
(...skipping 26 matching lines...) Expand all
486 DISALLOW_COPY_AND_ASSIGN(NetworkChangeCalculator); 483 DISALLOW_COPY_AND_ASSIGN(NetworkChangeCalculator);
487 }; 484 };
488 485
489 NetworkChangeNotifier::~NetworkChangeNotifier() { 486 NetworkChangeNotifier::~NetworkChangeNotifier() {
490 network_change_calculator_.reset(); 487 network_change_calculator_.reset();
491 DCHECK_EQ(this, g_network_change_notifier); 488 DCHECK_EQ(this, g_network_change_notifier);
492 g_network_change_notifier = NULL; 489 g_network_change_notifier = NULL;
493 } 490 }
494 491
495 // static 492 // static
496 void NetworkChangeNotifier::SetFactory( 493 void NetworkChangeNotifier::SetFactory(NetworkChangeNotifierFactory* factory) {
497 NetworkChangeNotifierFactory* factory) {
498 CHECK(!g_network_change_notifier_factory); 494 CHECK(!g_network_change_notifier_factory);
499 g_network_change_notifier_factory = factory; 495 g_network_change_notifier_factory = factory;
500 } 496 }
501 497
502 // static 498 // static
503 NetworkChangeNotifier* NetworkChangeNotifier::Create() { 499 NetworkChangeNotifier* NetworkChangeNotifier::Create() {
504 if (g_network_change_notifier_factory) 500 if (g_network_change_notifier_factory)
505 return g_network_change_notifier_factory->CreateInstance(); 501 return g_network_change_notifier_factory->CreateInstance();
506 502
507 #if defined(OS_WIN) 503 #if defined(OS_WIN)
508 NetworkChangeNotifierWin* network_change_notifier = 504 NetworkChangeNotifierWin* network_change_notifier =
509 new NetworkChangeNotifierWin(); 505 new NetworkChangeNotifierWin();
510 network_change_notifier->WatchForAddressChange(); 506 network_change_notifier->WatchForAddressChange();
511 return network_change_notifier; 507 return network_change_notifier;
512 #elif defined(OS_CHROMEOS) || defined(OS_ANDROID) 508 #elif defined(OS_CHROMEOS) || defined(OS_ANDROID)
513 // ChromeOS and Android builds MUST use their own class factory. 509 // ChromeOS and Android builds MUST use their own class factory.
514 #if !defined(OS_CHROMEOS) 510 #if !defined(OS_CHROMEOS)
515 // TODO(oshima): ash_shell do not have access to chromeos'es 511 // TODO(oshima): ash_shell do not have access to chromeos'es
516 // notifier yet. Re-enable this when chromeos'es notifier moved to 512 // notifier yet. Re-enable this when chromeos'es notifier moved to
517 // chromeos root directory. crbug.com/119298. 513 // chromeos root directory. crbug.com/119298.
518 CHECK(false); 514 CHECK(false);
519 #endif 515 #endif
520 return NULL; 516 return NULL;
521 #elif defined(OS_LINUX) 517 #elif defined(OS_LINUX)
522 return NetworkChangeNotifierLinux::Create(); 518 return NetworkChangeNotifierLinux::Create();
523 #elif defined(OS_MACOSX) 519 #elif defined(OS_MACOSX)
524 return new NetworkChangeNotifierMac(); 520 return new NetworkChangeNotifierMac();
525 #else 521 #else
526 NOTIMPLEMENTED(); 522 NOTIMPLEMENTED();
527 return NULL; 523 return NULL;
528 #endif 524 #endif
529 } 525 }
530 526
531 // static 527 // static
532 NetworkChangeNotifier::ConnectionType 528 NetworkChangeNotifier::ConnectionType
533 NetworkChangeNotifier::GetConnectionType() { 529 NetworkChangeNotifier::GetConnectionType() {
534 return g_network_change_notifier ? 530 return g_network_change_notifier
535 g_network_change_notifier->GetCurrentConnectionType() : 531 ? g_network_change_notifier->GetCurrentConnectionType()
536 CONNECTION_UNKNOWN; 532 : CONNECTION_UNKNOWN;
537 } 533 }
538 534
539 // static 535 // static
540 double NetworkChangeNotifier::GetMaxBandwidth() { 536 double NetworkChangeNotifier::GetMaxBandwidth() {
541 return g_network_change_notifier ? 537 return g_network_change_notifier
542 g_network_change_notifier->GetCurrentMaxBandwidth() : 538 ? g_network_change_notifier->GetCurrentMaxBandwidth()
543 std::numeric_limits<double>::infinity(); 539 : std::numeric_limits<double>::infinity();
544 } 540 }
545 541
546 // static 542 // static
547 void NetworkChangeNotifier::GetDnsConfig(DnsConfig* config) { 543 void NetworkChangeNotifier::GetDnsConfig(DnsConfig* config) {
548 if (!g_network_change_notifier) { 544 if (!g_network_change_notifier) {
549 *config = DnsConfig(); 545 *config = DnsConfig();
550 } else { 546 } else {
551 g_network_change_notifier->network_state_->GetDnsConfig(config); 547 g_network_change_notifier->network_state_->GetDnsConfig(config);
552 } 548 }
553 } 549 }
554 550
555 // static 551 // static
556 const char* NetworkChangeNotifier::ConnectionTypeToString( 552 const char* NetworkChangeNotifier::ConnectionTypeToString(ConnectionType type) {
557 ConnectionType type) { 553 static const char* kConnectionTypeNames[] = {"CONNECTION_UNKNOWN",
558 static const char* kConnectionTypeNames[] = { 554 "CONNECTION_ETHERNET",
559 "CONNECTION_UNKNOWN", 555 "CONNECTION_WIFI",
560 "CONNECTION_ETHERNET", 556 "CONNECTION_2G",
561 "CONNECTION_WIFI", 557 "CONNECTION_3G",
562 "CONNECTION_2G", 558 "CONNECTION_4G",
563 "CONNECTION_3G", 559 "CONNECTION_NONE",
564 "CONNECTION_4G", 560 "CONNECTION_BLUETOOTH"};
davidben 2014/10/10 20:24:16 This is probably also better as before, but no str
565 "CONNECTION_NONE", 561 COMPILE_ASSERT(arraysize(kConnectionTypeNames) ==
566 "CONNECTION_BLUETOOTH" 562 NetworkChangeNotifier::CONNECTION_LAST + 1,
567 }; 563 ConnectionType_name_count_mismatch);
568 COMPILE_ASSERT(
569 arraysize(kConnectionTypeNames) ==
570 NetworkChangeNotifier::CONNECTION_LAST + 1,
571 ConnectionType_name_count_mismatch);
572 if (type < CONNECTION_UNKNOWN || type > CONNECTION_LAST) { 564 if (type < CONNECTION_UNKNOWN || type > CONNECTION_LAST) {
573 NOTREACHED(); 565 NOTREACHED();
574 return "CONNECTION_INVALID"; 566 return "CONNECTION_INVALID";
575 } 567 }
576 return kConnectionTypeNames[type]; 568 return kConnectionTypeNames[type];
577 } 569 }
578 570
579 // static 571 // static
580 void NetworkChangeNotifier::NotifyDataReceived(const URLRequest& request, 572 void NetworkChangeNotifier::NotifyDataReceived(const URLRequest& request,
581 int bytes_read) { 573 int bytes_read) {
(...skipping 23 matching lines...) Expand all
605 // static 597 // static
606 void NetworkChangeNotifier::LogOperatorCodeHistogram(ConnectionType type) { 598 void NetworkChangeNotifier::LogOperatorCodeHistogram(ConnectionType type) {
607 #if defined(OS_ANDROID) 599 #if defined(OS_ANDROID)
608 // On a connection type change to 2/3/4G, log the network operator MCC/MNC. 600 // On a connection type change to 2/3/4G, log the network operator MCC/MNC.
609 // Log zero in other cases. 601 // Log zero in other cases.
610 unsigned mcc_mnc = 0; 602 unsigned mcc_mnc = 0;
611 if (type == NetworkChangeNotifier::CONNECTION_2G || 603 if (type == NetworkChangeNotifier::CONNECTION_2G ||
612 type == NetworkChangeNotifier::CONNECTION_3G || 604 type == NetworkChangeNotifier::CONNECTION_3G ||
613 type == NetworkChangeNotifier::CONNECTION_4G) { 605 type == NetworkChangeNotifier::CONNECTION_4G) {
614 // Log zero if not perfectly converted. 606 // Log zero if not perfectly converted.
615 if (!base::StringToUint( 607 if (!base::StringToUint(net::android::GetTelephonyNetworkOperator(),
616 net::android::GetTelephonyNetworkOperator(), &mcc_mnc)) { 608 &mcc_mnc)) {
617 mcc_mnc = 0; 609 mcc_mnc = 0;
618 } 610 }
619 } 611 }
620 UMA_HISTOGRAM_SPARSE_SLOWLY("NCN.NetworkOperatorMCCMNC", mcc_mnc); 612 UMA_HISTOGRAM_SPARSE_SLOWLY("NCN.NetworkOperatorMCCMNC", mcc_mnc);
621 #endif 613 #endif
622 } 614 }
623 615
624 #if defined(OS_LINUX) 616 #if defined(OS_LINUX)
625 // static 617 // static
626 const internal::AddressTrackerLinux* 618 const internal::AddressTrackerLinux*
627 NetworkChangeNotifier::GetAddressTracker() { 619 NetworkChangeNotifier::GetAddressTracker() {
628 return g_network_change_notifier ? 620 return g_network_change_notifier
629 g_network_change_notifier->GetAddressTrackerInternal() : NULL; 621 ? g_network_change_notifier->GetAddressTrackerInternal()
622 : NULL;
630 } 623 }
631 #endif 624 #endif
632 625
633 // static 626 // static
634 bool NetworkChangeNotifier::IsOffline() { 627 bool NetworkChangeNotifier::IsOffline() {
635 return GetConnectionType() == CONNECTION_NONE; 628 return GetConnectionType() == CONNECTION_NONE;
636 } 629 }
637 630
638 // static 631 // static
639 bool NetworkChangeNotifier::IsConnectionCellular(ConnectionType type) { 632 bool NetworkChangeNotifier::IsConnectionCellular(ConnectionType type) {
640 bool is_cellular = false; 633 bool is_cellular = false;
641 switch (type) { 634 switch (type) {
642 case CONNECTION_2G: 635 case CONNECTION_2G:
643 case CONNECTION_3G: 636 case CONNECTION_3G:
644 case CONNECTION_4G: 637 case CONNECTION_4G:
645 is_cellular = true; 638 is_cellular = true;
646 break; 639 break;
647 case CONNECTION_UNKNOWN: 640 case CONNECTION_UNKNOWN:
648 case CONNECTION_ETHERNET: 641 case CONNECTION_ETHERNET:
649 case CONNECTION_WIFI: 642 case CONNECTION_WIFI:
650 case CONNECTION_NONE: 643 case CONNECTION_NONE:
651 case CONNECTION_BLUETOOTH: 644 case CONNECTION_BLUETOOTH:
652 is_cellular = false; 645 is_cellular = false;
653 break; 646 break;
654 } 647 }
655 return is_cellular; 648 return is_cellular;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 } 733 }
741 734
742 // static 735 // static
743 void NetworkChangeNotifier::SetTestNotificationsOnly(bool test_only) { 736 void NetworkChangeNotifier::SetTestNotificationsOnly(bool test_only) {
744 if (g_network_change_notifier) 737 if (g_network_change_notifier)
745 g_network_change_notifier->test_notifications_only_ = test_only; 738 g_network_change_notifier->test_notifications_only_ = test_only;
746 } 739 }
747 740
748 NetworkChangeNotifier::NetworkChangeNotifier( 741 NetworkChangeNotifier::NetworkChangeNotifier(
749 const NetworkChangeCalculatorParams& params 742 const NetworkChangeCalculatorParams& params
750 /*= NetworkChangeCalculatorParams()*/) 743 /*= NetworkChangeCalculatorParams()*/)
davidben 2014/10/10 20:24:16 This comment should probably have stayed indented,
751 : ip_address_observer_list_( 744 : ip_address_observer_list_(new ObserverListThreadSafe<IPAddressObserver>(
752 new ObserverListThreadSafe<IPAddressObserver>( 745 ObserverListBase<IPAddressObserver>::NOTIFY_EXISTING_ONLY)),
753 ObserverListBase<IPAddressObserver>::NOTIFY_EXISTING_ONLY)),
754 connection_type_observer_list_( 746 connection_type_observer_list_(
755 new ObserverListThreadSafe<ConnectionTypeObserver>( 747 new ObserverListThreadSafe<ConnectionTypeObserver>(
756 ObserverListBase<ConnectionTypeObserver>::NOTIFY_EXISTING_ONLY)), 748 ObserverListBase<ConnectionTypeObserver>::NOTIFY_EXISTING_ONLY)),
757 resolver_state_observer_list_( 749 resolver_state_observer_list_(new ObserverListThreadSafe<DNSObserver>(
758 new ObserverListThreadSafe<DNSObserver>( 750 ObserverListBase<DNSObserver>::NOTIFY_EXISTING_ONLY)),
759 ObserverListBase<DNSObserver>::NOTIFY_EXISTING_ONLY)),
760 network_change_observer_list_( 751 network_change_observer_list_(
761 new ObserverListThreadSafe<NetworkChangeObserver>( 752 new ObserverListThreadSafe<NetworkChangeObserver>(
762 ObserverListBase<NetworkChangeObserver>::NOTIFY_EXISTING_ONLY)), 753 ObserverListBase<NetworkChangeObserver>::NOTIFY_EXISTING_ONLY)),
763 network_state_(new NetworkState()), 754 network_state_(new NetworkState()),
764 network_change_calculator_(new NetworkChangeCalculator(params)), 755 network_change_calculator_(new NetworkChangeCalculator(params)),
765 test_notifications_only_(false) { 756 test_notifications_only_(false) {
766 DCHECK(!g_network_change_notifier); 757 DCHECK(!g_network_change_notifier);
767 g_network_change_notifier = this; 758 g_network_change_notifier = this;
768 network_change_calculator_->Init(); 759 network_change_calculator_->Init();
769 } 760 }
770 761
771 #if defined(OS_LINUX) 762 #if defined(OS_LINUX)
772 const internal::AddressTrackerLinux* 763 const internal::AddressTrackerLinux*
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 DCHECK(g_network_change_notifier); 842 DCHECK(g_network_change_notifier);
852 g_network_change_notifier = NULL; 843 g_network_change_notifier = NULL;
853 } 844 }
854 845
855 NetworkChangeNotifier::DisableForTest::~DisableForTest() { 846 NetworkChangeNotifier::DisableForTest::~DisableForTest() {
856 DCHECK(!g_network_change_notifier); 847 DCHECK(!g_network_change_notifier);
857 g_network_change_notifier = network_change_notifier_; 848 g_network_change_notifier = network_change_notifier_;
858 } 849 }
859 850
860 } // namespace net 851 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698