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

Side by Side Diff: net/tools/net_watcher/net_watcher.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 | « net/tools/epoll_server/epoll_server.h ('k') | net/tools/quic/quic_dispatcher.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 // This is a small utility that watches for and logs network changes. 5 // This is a small utility that watches for and logs network changes.
6 6
7 #include <string> 7 #include <string>
8 #include <unordered_set>
8 9
9 #include "base/at_exit.h" 10 #include "base/at_exit.h"
10 #include "base/command_line.h" 11 #include "base/command_line.h"
11 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
12 #include "base/json/json_writer.h" 13 #include "base/json/json_writer.h"
13 #include "base/logging.h" 14 #include "base/logging.h"
14 #include "base/macros.h" 15 #include "base/macros.h"
15 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
16 #include "base/message_loop/message_loop.h" 17 #include "base/message_loop/message_loop.h"
17 #include "base/strings/string_split.h" 18 #include "base/strings/string_split.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 162
162 // Just make the main message loop the network loop. 163 // Just make the main message loop the network loop.
163 base::MessageLoopForIO network_loop; 164 base::MessageLoopForIO network_loop;
164 165
165 NetWatcher net_watcher; 166 NetWatcher net_watcher;
166 167
167 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 168 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
168 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 169 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
169 std::string ignored_netifs_str = 170 std::string ignored_netifs_str =
170 command_line->GetSwitchValueASCII(kIgnoreNetifFlag); 171 command_line->GetSwitchValueASCII(kIgnoreNetifFlag);
171 base::hash_set<std::string> ignored_interfaces; 172 std::unordered_set<std::string> ignored_interfaces;
172 if (!ignored_netifs_str.empty()) { 173 if (!ignored_netifs_str.empty()) {
173 for (const std::string& ignored_netif : 174 for (const std::string& ignored_netif :
174 base::SplitString(ignored_netifs_str, ",", base::TRIM_WHITESPACE, 175 base::SplitString(ignored_netifs_str, ",", base::TRIM_WHITESPACE,
175 base::SPLIT_WANT_ALL)) { 176 base::SPLIT_WANT_ALL)) {
176 LOG(INFO) << "Ignoring: " << ignored_netif; 177 LOG(INFO) << "Ignoring: " << ignored_netif;
177 ignored_interfaces.insert(ignored_netif); 178 ignored_interfaces.insert(ignored_netif);
178 } 179 }
179 } 180 }
180 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier( 181 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier(
181 new net::NetworkChangeNotifierLinux(ignored_interfaces)); 182 new net::NetworkChangeNotifierLinux(ignored_interfaces));
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 proxy_config_service->RemoveObserver(&net_watcher); 219 proxy_config_service->RemoveObserver(&net_watcher);
219 220
220 // Uses |network_change_notifier|. 221 // Uses |network_change_notifier|.
221 net::NetworkChangeNotifier::RemoveDNSObserver(&net_watcher); 222 net::NetworkChangeNotifier::RemoveDNSObserver(&net_watcher);
222 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(&net_watcher); 223 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(&net_watcher);
223 net::NetworkChangeNotifier::RemoveIPAddressObserver(&net_watcher); 224 net::NetworkChangeNotifier::RemoveIPAddressObserver(&net_watcher);
224 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(&net_watcher); 225 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(&net_watcher);
225 226
226 return 0; 227 return 0;
227 } 228 }
OLDNEW
« no previous file with comments | « net/tools/epoll_server/epoll_server.h ('k') | net/tools/quic/quic_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698