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

Side by Side Diff: chrome/browser/io_thread.cc

Issue 10417002: RefCounted types should not have public destructors, net/ edition (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased to r139261 Created 8 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/io_thread.h ('k') | net/base/net_log.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 #include "chrome/browser/io_thread.h" 5 #include "chrome/browser/io_thread.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 if (!command_line.HasSwitch(switches::kHostResolverRules)) 165 if (!command_line.HasSwitch(switches::kHostResolverRules))
166 return global_host_resolver; 166 return global_host_resolver;
167 167
168 net::MappedHostResolver* remapped_resolver = 168 net::MappedHostResolver* remapped_resolver =
169 new net::MappedHostResolver(global_host_resolver); 169 new net::MappedHostResolver(global_host_resolver);
170 remapped_resolver->SetRulesFromString( 170 remapped_resolver->SetRulesFromString(
171 command_line.GetSwitchValueASCII(switches::kHostResolverRules)); 171 command_line.GetSwitchValueASCII(switches::kHostResolverRules));
172 return remapped_resolver; 172 return remapped_resolver;
173 } 173 }
174 174
175 class LoggingNetworkChangeObserver
176 : public net::NetworkChangeNotifier::IPAddressObserver {
177 public:
178 // |net_log| must remain valid throughout our lifetime.
179 explicit LoggingNetworkChangeObserver(net::NetLog* net_log)
180 : net_log_(net_log) {
181 net::NetworkChangeNotifier::AddIPAddressObserver(this);
182 }
183
184 ~LoggingNetworkChangeObserver() {
185 net::NetworkChangeNotifier::RemoveIPAddressObserver(this);
186 }
187
188 virtual void OnIPAddressChanged() {
189 VLOG(1) << "Observed a change to the network IP addresses";
190
191 net_log_->AddGlobalEntry(net::NetLog::TYPE_NETWORK_IP_ADDRESSES_CHANGED,
192 NULL);
193 }
194
195 private:
196 net::NetLog* net_log_;
197 DISALLOW_COPY_AND_ASSIGN(LoggingNetworkChangeObserver);
198 };
199
200 // TODO(willchan): Remove proxy script fetcher context since it's not necessary 175 // TODO(willchan): Remove proxy script fetcher context since it's not necessary
201 // now that I got rid of refcounting URLRequestContexts. 176 // now that I got rid of refcounting URLRequestContexts.
202 // See IOThread::Globals for details. 177 // See IOThread::Globals for details.
203 net::URLRequestContext* 178 net::URLRequestContext*
204 ConstructProxyScriptFetcherContext(IOThread::Globals* globals, 179 ConstructProxyScriptFetcherContext(IOThread::Globals* globals,
205 net::NetLog* net_log) { 180 net::NetLog* net_log) {
206 net::URLRequestContext* context = new URLRequestContextWithUserAgent; 181 net::URLRequestContext* context = new URLRequestContextWithUserAgent;
207 context->set_net_log(net_log); 182 context->set_net_log(net_log);
208 context->set_host_resolver(globals->host_resolver.get()); 183 context->set_host_resolver(globals->host_resolver.get());
209 context->set_cert_verifier(globals->cert_verifier.get()); 184 context->set_cert_verifier(globals->cert_verifier.get());
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 globals->system_ftp_transaction_factory.get()); 219 globals->system_ftp_transaction_factory.get());
245 context->set_cookie_store(globals->system_cookie_store.get()); 220 context->set_cookie_store(globals->system_cookie_store.get());
246 context->set_server_bound_cert_service( 221 context->set_server_bound_cert_service(
247 globals->system_server_bound_cert_service.get()); 222 globals->system_server_bound_cert_service.get());
248 context->set_throttler_manager(globals->throttler_manager.get()); 223 context->set_throttler_manager(globals->throttler_manager.get());
249 return context; 224 return context;
250 } 225 }
251 226
252 } // namespace 227 } // namespace
253 228
229 class IOThread::LoggingNetworkChangeObserver
230 : public net::NetworkChangeNotifier::IPAddressObserver {
231 public:
232 // |net_log| must remain valid throughout our lifetime.
233 explicit LoggingNetworkChangeObserver(net::NetLog* net_log)
234 : net_log_(net_log) {
235 net::NetworkChangeNotifier::AddIPAddressObserver(this);
236 }
237
238 ~LoggingNetworkChangeObserver() {
239 net::NetworkChangeNotifier::RemoveIPAddressObserver(this);
240 }
241
242 virtual void OnIPAddressChanged() {
243 VLOG(1) << "Observed a change to the network IP addresses";
244
245 net_log_->AddGlobalEntry(net::NetLog::TYPE_NETWORK_IP_ADDRESSES_CHANGED,
246 NULL);
247 }
248
249 private:
250 net::NetLog* net_log_;
251 DISALLOW_COPY_AND_ASSIGN(LoggingNetworkChangeObserver);
252 };
253
254 class SystemURLRequestContextGetter : public net::URLRequestContextGetter { 254 class SystemURLRequestContextGetter : public net::URLRequestContextGetter {
255 public: 255 public:
256 explicit SystemURLRequestContextGetter(IOThread* io_thread); 256 explicit SystemURLRequestContextGetter(IOThread* io_thread);
257 257
258 // Implementation for net::UrlRequestContextGetter. 258 // Implementation for net::UrlRequestContextGetter.
259 virtual net::URLRequestContext* GetURLRequestContext(); 259 virtual net::URLRequestContext* GetURLRequestContext();
260 virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const; 260 virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const;
261 261
262 protected: 262 protected:
263 virtual ~SystemURLRequestContextGetter(); 263 virtual ~SystemURLRequestContextGetter();
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 new net::HttpNetworkLayer( 623 new net::HttpNetworkLayer(
624 new net::HttpNetworkSession(system_params))); 624 new net::HttpNetworkSession(system_params)));
625 globals_->system_ftp_transaction_factory.reset( 625 globals_->system_ftp_transaction_factory.reset(
626 new net::FtpNetworkLayer(globals_->host_resolver.get())); 626 new net::FtpNetworkLayer(globals_->host_resolver.get()));
627 globals_->system_request_context.reset( 627 globals_->system_request_context.reset(
628 ConstructSystemRequestContext(globals_, net_log_)); 628 ConstructSystemRequestContext(globals_, net_log_));
629 629
630 sdch_manager_->set_sdch_fetcher( 630 sdch_manager_->set_sdch_fetcher(
631 new SdchDictionaryFetcher(system_url_request_context_getter_.get())); 631 new SdchDictionaryFetcher(system_url_request_context_getter_.get()));
632 } 632 }
OLDNEW
« no previous file with comments | « chrome/browser/io_thread.h ('k') | net/base/net_log.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698