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

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

Issue 540593002: Use scoped_refptr<SingleThreadTaskRunner> when initializing ProxyConfigService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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/proxy/proxy_service.cc ('k') | net/url_request/url_request_context_builder.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 // 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 8
9 #include "base/at_exit.h" 9 #include "base/at_exit.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 base::MessageLoopForIO network_loop; 153 base::MessageLoopForIO network_loop;
154 154
155 NetWatcher net_watcher; 155 NetWatcher net_watcher;
156 156
157 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier( 157 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier(
158 net::NetworkChangeNotifier::Create()); 158 net::NetworkChangeNotifier::Create());
159 159
160 // Use the network loop as the file loop also. 160 // Use the network loop as the file loop also.
161 scoped_ptr<net::ProxyConfigService> proxy_config_service( 161 scoped_ptr<net::ProxyConfigService> proxy_config_service(
162 net::ProxyService::CreateSystemProxyConfigService( 162 net::ProxyService::CreateSystemProxyConfigService(
163 network_loop.message_loop_proxy().get(), &network_loop)); 163 network_loop.message_loop_proxy(),
164 network_loop.message_loop_proxy()));
164 165
165 // Uses |network_change_notifier|. 166 // Uses |network_change_notifier|.
166 net::NetworkChangeNotifier::AddIPAddressObserver(&net_watcher); 167 net::NetworkChangeNotifier::AddIPAddressObserver(&net_watcher);
167 net::NetworkChangeNotifier::AddConnectionTypeObserver(&net_watcher); 168 net::NetworkChangeNotifier::AddConnectionTypeObserver(&net_watcher);
168 net::NetworkChangeNotifier::AddDNSObserver(&net_watcher); 169 net::NetworkChangeNotifier::AddDNSObserver(&net_watcher);
169 net::NetworkChangeNotifier::AddNetworkChangeObserver(&net_watcher); 170 net::NetworkChangeNotifier::AddNetworkChangeObserver(&net_watcher);
170 171
171 proxy_config_service->AddObserver(&net_watcher); 172 proxy_config_service->AddObserver(&net_watcher);
172 173
173 LOG(INFO) << "Initial connection type: " 174 LOG(INFO) << "Initial connection type: "
(...skipping 17 matching lines...) Expand all
191 proxy_config_service->RemoveObserver(&net_watcher); 192 proxy_config_service->RemoveObserver(&net_watcher);
192 193
193 // Uses |network_change_notifier|. 194 // Uses |network_change_notifier|.
194 net::NetworkChangeNotifier::RemoveDNSObserver(&net_watcher); 195 net::NetworkChangeNotifier::RemoveDNSObserver(&net_watcher);
195 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(&net_watcher); 196 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(&net_watcher);
196 net::NetworkChangeNotifier::RemoveIPAddressObserver(&net_watcher); 197 net::NetworkChangeNotifier::RemoveIPAddressObserver(&net_watcher);
197 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(&net_watcher); 198 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(&net_watcher);
198 199
199 return 0; 200 return 0;
200 } 201 }
OLDNEW
« no previous file with comments | « net/proxy/proxy_service.cc ('k') | net/url_request/url_request_context_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698