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

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

Issue 1897033002: Reland 'Convert //net and //chromecast to std::unordered_*' (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix TestDownloadRequestHandler Created 4 years, 8 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 | « content/public/test/test_download_request_handler.cc ('k') | net/base/address_tracker_linux.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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 // delegate then forwards these notifications to the threads of each observer 52 // delegate then forwards these notifications to the threads of each observer
53 // (network change notifier). The network change notifier than processes the 53 // (network change notifier). The network change notifier than processes the
54 // state change, and notifies each of its observers on their threads. 54 // state change, and notifies each of its observers on their threads.
55 // 55 //
56 // This can also be seen as: 56 // This can also be seen as:
57 // Android platform -> NetworkChangeNotifier (Java) -> 57 // Android platform -> NetworkChangeNotifier (Java) ->
58 // NetworkChangeNotifierDelegateAndroid -> NetworkChangeNotifierAndroid. 58 // NetworkChangeNotifierDelegateAndroid -> NetworkChangeNotifierAndroid.
59 59
60 #include "net/android/network_change_notifier_android.h" 60 #include "net/android/network_change_notifier_android.h"
61 61
62 #include <unordered_set>
63
62 #include "base/android/build_info.h" 64 #include "base/android/build_info.h"
63 #include "base/macros.h" 65 #include "base/macros.h"
64 #include "base/metrics/histogram_macros.h" 66 #include "base/metrics/histogram_macros.h"
65 #include "base/threading/thread.h" 67 #include "base/threading/thread.h"
66 #include "net/base/address_tracker_linux.h" 68 #include "net/base/address_tracker_linux.h"
67 #include "net/dns/dns_config_service_posix.h" 69 #include "net/dns/dns_config_service_posix.h"
68 70
69 namespace net { 71 namespace net {
70 72
71 // Expose kInvalidNetworkHandle out to Java as NetId.INVALID. The notion of 73 // Expose kInvalidNetworkHandle out to Java as NetId.INVALID. The notion of
(...skipping 14 matching lines...) Expand all
86 public NetworkChangeNotifier::NetworkChangeObserver { 88 public NetworkChangeNotifier::NetworkChangeObserver {
87 public: 89 public:
88 explicit DnsConfigServiceThread(const DnsConfig* dns_config_for_testing) 90 explicit DnsConfigServiceThread(const DnsConfig* dns_config_for_testing)
89 : base::Thread("DnsConfigService"), 91 : base::Thread("DnsConfigService"),
90 dns_config_for_testing_(dns_config_for_testing), 92 dns_config_for_testing_(dns_config_for_testing),
91 creation_time_(base::Time::Now()), 93 creation_time_(base::Time::Now()),
92 address_tracker_(base::Bind(base::DoNothing), 94 address_tracker_(base::Bind(base::DoNothing),
93 base::Bind(base::DoNothing), 95 base::Bind(base::DoNothing),
94 // We're only interested in tunnel interface changes. 96 // We're only interested in tunnel interface changes.
95 base::Bind(NotifyNetworkChangeNotifierObservers), 97 base::Bind(NotifyNetworkChangeNotifierObservers),
96 base::hash_set<std::string>()) {} 98 std::unordered_set<std::string>()) {}
97 99
98 ~DnsConfigServiceThread() override { 100 ~DnsConfigServiceThread() override {
99 NetworkChangeNotifier::RemoveNetworkChangeObserver(this); 101 NetworkChangeNotifier::RemoveNetworkChangeObserver(this);
100 Stop(); 102 Stop();
101 } 103 }
102 104
103 void InitAfterStart() { 105 void InitAfterStart() {
104 DCHECK(IsRunning()); 106 DCHECK(IsRunning());
105 NetworkChangeNotifier::AddNetworkChangeObserver(this); 107 NetworkChangeNotifier::AddNetworkChangeObserver(this);
106 } 108 }
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 NetworkChangeNotifier::GetConnectionType(); 275 NetworkChangeNotifier::GetConnectionType();
274 NetworkChangeNotifier::LogOperatorCodeHistogram(type); 276 NetworkChangeNotifier::LogOperatorCodeHistogram(type);
275 if (NetworkChangeNotifier::IsConnectionCellular(type)) { 277 if (NetworkChangeNotifier::IsConnectionCellular(type)) {
276 UMA_HISTOGRAM_ENUMERATION("NCN.CellularConnectionSubtype", 278 UMA_HISTOGRAM_ENUMERATION("NCN.CellularConnectionSubtype",
277 delegate_->GetCurrentConnectionSubtype(), 279 delegate_->GetCurrentConnectionSubtype(),
278 SUBTYPE_LAST + 1); 280 SUBTYPE_LAST + 1);
279 } 281 }
280 } 282 }
281 283
282 } // namespace net 284 } // namespace net
OLDNEW
« no previous file with comments | « content/public/test/test_download_request_handler.cc ('k') | net/base/address_tracker_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698