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

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

Issue 826973002: replace COMPILE_ASSERT with static_assert in net/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: apply fixups Created 5 years, 11 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
« no previous file with comments | « net/base/mime_sniffer.cc ('k') | net/base/prioritized_dispatcher_unittest.cc » ('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 #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 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 static const char* kConnectionTypeNames[] = { 558 static const char* kConnectionTypeNames[] = {
559 "CONNECTION_UNKNOWN", 559 "CONNECTION_UNKNOWN",
560 "CONNECTION_ETHERNET", 560 "CONNECTION_ETHERNET",
561 "CONNECTION_WIFI", 561 "CONNECTION_WIFI",
562 "CONNECTION_2G", 562 "CONNECTION_2G",
563 "CONNECTION_3G", 563 "CONNECTION_3G",
564 "CONNECTION_4G", 564 "CONNECTION_4G",
565 "CONNECTION_NONE", 565 "CONNECTION_NONE",
566 "CONNECTION_BLUETOOTH" 566 "CONNECTION_BLUETOOTH"
567 }; 567 };
568 COMPILE_ASSERT( 568 static_assert(arraysize(kConnectionTypeNames) ==
569 arraysize(kConnectionTypeNames) == 569 NetworkChangeNotifier::CONNECTION_LAST + 1,
570 NetworkChangeNotifier::CONNECTION_LAST + 1, 570 "ConnectionType name count should match");
571 ConnectionType_name_count_mismatch);
572 if (type < CONNECTION_UNKNOWN || type > CONNECTION_LAST) { 571 if (type < CONNECTION_UNKNOWN || type > CONNECTION_LAST) {
573 NOTREACHED(); 572 NOTREACHED();
574 return "CONNECTION_INVALID"; 573 return "CONNECTION_INVALID";
575 } 574 }
576 return kConnectionTypeNames[type]; 575 return kConnectionTypeNames[type];
577 } 576 }
578 577
579 // static 578 // static
580 void NetworkChangeNotifier::NotifyDataReceived(const URLRequest& request, 579 void NetworkChangeNotifier::NotifyDataReceived(const URLRequest& request,
581 int bytes_read) { 580 int bytes_read) {
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
959 DCHECK(g_network_change_notifier); 958 DCHECK(g_network_change_notifier);
960 g_network_change_notifier = NULL; 959 g_network_change_notifier = NULL;
961 } 960 }
962 961
963 NetworkChangeNotifier::DisableForTest::~DisableForTest() { 962 NetworkChangeNotifier::DisableForTest::~DisableForTest() {
964 DCHECK(!g_network_change_notifier); 963 DCHECK(!g_network_change_notifier);
965 g_network_change_notifier = network_change_notifier_; 964 g_network_change_notifier = network_change_notifier_;
966 } 965 }
967 966
968 } // namespace net 967 } // namespace net
OLDNEW
« no previous file with comments | « net/base/mime_sniffer.cc ('k') | net/base/prioritized_dispatcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698