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

Side by Side Diff: net/tools/net_watcher/net_watcher.cc

Issue 1884453002: Revert of Convert //net and //chromecast to std::unordered_* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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>
9 8
10 #include "base/at_exit.h" 9 #include "base/at_exit.h"
11 #include "base/command_line.h" 10 #include "base/command_line.h"
12 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
13 #include "base/json/json_writer.h" 12 #include "base/json/json_writer.h"
14 #include "base/logging.h" 13 #include "base/logging.h"
15 #include "base/macros.h" 14 #include "base/macros.h"
16 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
17 #include "base/message_loop/message_loop.h" 16 #include "base/message_loop/message_loop.h"
18 #include "base/strings/string_split.h" 17 #include "base/strings/string_split.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 161
163 // Just make the main message loop the network loop. 162 // Just make the main message loop the network loop.
164 base::MessageLoopForIO network_loop; 163 base::MessageLoopForIO network_loop;
165 164
166 NetWatcher net_watcher; 165 NetWatcher net_watcher;
167 166
168 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 167 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
169 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 168 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
170 std::string ignored_netifs_str = 169 std::string ignored_netifs_str =
171 command_line->GetSwitchValueASCII(kIgnoreNetifFlag); 170 command_line->GetSwitchValueASCII(kIgnoreNetifFlag);
172 std::unordered_set<std::string> ignored_interfaces; 171 base::hash_set<std::string> ignored_interfaces;
173 if (!ignored_netifs_str.empty()) { 172 if (!ignored_netifs_str.empty()) {
174 for (const std::string& ignored_netif : 173 for (const std::string& ignored_netif :
175 base::SplitString(ignored_netifs_str, ",", base::TRIM_WHITESPACE, 174 base::SplitString(ignored_netifs_str, ",", base::TRIM_WHITESPACE,
176 base::SPLIT_WANT_ALL)) { 175 base::SPLIT_WANT_ALL)) {
177 LOG(INFO) << "Ignoring: " << ignored_netif; 176 LOG(INFO) << "Ignoring: " << ignored_netif;
178 ignored_interfaces.insert(ignored_netif); 177 ignored_interfaces.insert(ignored_netif);
179 } 178 }
180 } 179 }
181 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier( 180 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier(
182 new net::NetworkChangeNotifierLinux(ignored_interfaces)); 181 new net::NetworkChangeNotifierLinux(ignored_interfaces));
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 proxy_config_service->RemoveObserver(&net_watcher); 218 proxy_config_service->RemoveObserver(&net_watcher);
220 219
221 // Uses |network_change_notifier|. 220 // Uses |network_change_notifier|.
222 net::NetworkChangeNotifier::RemoveDNSObserver(&net_watcher); 221 net::NetworkChangeNotifier::RemoveDNSObserver(&net_watcher);
223 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(&net_watcher); 222 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(&net_watcher);
224 net::NetworkChangeNotifier::RemoveIPAddressObserver(&net_watcher); 223 net::NetworkChangeNotifier::RemoveIPAddressObserver(&net_watcher);
225 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(&net_watcher); 224 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(&net_watcher);
226 225
227 return 0; 226 return 0;
228 } 227 }
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