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

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

Issue 6280018: Add "system" URLRequestContext (not ready for use!) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix DCHECK, create dummy ProxyService. Created 9 years, 11 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') | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/leak_tracker.h" 10 #include "base/debug/leak_tracker.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/metrics/field_trial.h" 12 #include "base/metrics/field_trial.h"
13 #include "base/stl_util-inl.h" 13 #include "base/stl_util-inl.h"
14 #include "base/string_number_conversions.h" 14 #include "base/string_number_conversions.h"
15 #include "base/string_split.h" 15 #include "base/string_split.h"
16 #include "base/string_util.h" 16 #include "base/string_util.h"
17 #include "base/threading/thread_restrictions.h" 17 #include "base/threading/thread_restrictions.h"
18 #include "chrome/browser/browser_process.h"
18 #include "chrome/browser/browser_thread.h" 19 #include "chrome/browser/browser_thread.h"
19 #include "chrome/browser/gpu_process_host.h" 20 #include "chrome/browser/gpu_process_host.h"
20 #include "chrome/browser/in_process_webkit/indexed_db_key_utility_client.h" 21 #include "chrome/browser/in_process_webkit/indexed_db_key_utility_client.h"
21 #include "chrome/browser/net/chrome_net_log.h" 22 #include "chrome/browser/net/chrome_net_log.h"
22 #include "chrome/browser/net/chrome_url_request_context.h" 23 #include "chrome/browser/net/chrome_url_request_context.h"
23 #include "chrome/browser/net/connect_interceptor.h" 24 #include "chrome/browser/net/connect_interceptor.h"
24 #include "chrome/browser/net/passive_log_collector.h" 25 #include "chrome/browser/net/passive_log_collector.h"
25 #include "chrome/browser/net/predictor_api.h" 26 #include "chrome/browser/net/predictor_api.h"
26 #include "chrome/browser/prefs/pref_service.h" 27 #include "chrome/browser/prefs/pref_service.h"
27 #include "chrome/common/chrome_switches.h" 28 #include "chrome/common/chrome_switches.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 context->set_http_auth_handler_factory( 189 context->set_http_auth_handler_factory(
189 globals->http_auth_handler_factory.get()); 190 globals->http_auth_handler_factory.get());
190 context->set_proxy_service(globals->proxy_script_fetcher_proxy_service.get()); 191 context->set_proxy_service(globals->proxy_script_fetcher_proxy_service.get());
191 context->set_http_transaction_factory( 192 context->set_http_transaction_factory(
192 globals->proxy_script_fetcher_http_transaction_factory.get()); 193 globals->proxy_script_fetcher_http_transaction_factory.get());
193 // In-memory cookie store. 194 // In-memory cookie store.
194 context->set_cookie_store(new net::CookieMonster(NULL, NULL)); 195 context->set_cookie_store(new net::CookieMonster(NULL, NULL));
195 return context; 196 return context;
196 } 197 }
197 198
199 scoped_refptr<net::URLRequestContext>
200 ConstructSystemRequestContext(IOThread::Globals* globals,
201 net::NetLog* net_log) {
202 scoped_refptr<net::URLRequestContext> context(new net::URLRequestContext);
203 context->set_net_log(net_log);
204 context->set_host_resolver(globals->host_resolver.get());
205 context->set_cert_verifier(globals->cert_verifier.get());
206 context->set_dnsrr_resolver(globals->dnsrr_resolver.get());
207 context->set_http_auth_handler_factory(
208 globals->http_auth_handler_factory.get());
209 // TODO(willchan): Use this once a system proxy service gets created.
210 #if 0
211 context->set_proxy_service(globals->system_proxy_service.get());
212 #endif
213 context->set_http_transaction_factory(
214 globals->system_http_transaction_factory.get());
215 // In-memory cookie store.
216 context->set_cookie_store(new net::CookieMonster(NULL, NULL));
217 return context;
218 }
219
198 } // namespace 220 } // namespace
199 221
200 // The IOThread object must outlive any tasks posted to the IO thread before the 222 // The IOThread object must outlive any tasks posted to the IO thread before the
201 // Quit task. 223 // Quit task.
202 DISABLE_RUNNABLE_METHOD_REFCOUNT(IOThread); 224 DISABLE_RUNNABLE_METHOD_REFCOUNT(IOThread);
203 225
204 IOThread::Globals::Globals() {} 226 IOThread::Globals::Globals() {}
205 227
206 IOThread::Globals::~Globals() {} 228 IOThread::Globals::~Globals() {}
207 229
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 globals_->proxy_script_fetcher_proxy_service.get(), 366 globals_->proxy_script_fetcher_proxy_service.get(),
345 globals_->ssl_config_service.get(), 367 globals_->ssl_config_service.get(),
346 new net::SpdySessionPool(globals_->ssl_config_service.get()), 368 new net::SpdySessionPool(globals_->ssl_config_service.get()),
347 globals_->http_auth_handler_factory.get(), 369 globals_->http_auth_handler_factory.get(),
348 &globals_->network_delegate, 370 &globals_->network_delegate,
349 net_log_)); 371 net_log_));
350 372
351 scoped_refptr<net::URLRequestContext> proxy_script_fetcher_context = 373 scoped_refptr<net::URLRequestContext> proxy_script_fetcher_context =
352 ConstructProxyScriptFetcherContext(globals_, net_log_); 374 ConstructProxyScriptFetcherContext(globals_, net_log_);
353 globals_->proxy_script_fetcher_context = proxy_script_fetcher_context; 375 globals_->proxy_script_fetcher_context = proxy_script_fetcher_context;
376
377 // FIXME(willchan): Need to use a real ProxyService. Can't yet because we
378 // don't have one that is Profile-agnostic yet.
379 globals_->system_proxy_service =
380 net::ProxyService::CreateDirectWithNetLog(net_log_);
381 globals_->system_http_transaction_factory.reset(
382 new net::HttpNetworkLayer(
383 globals_->client_socket_factory,
384 globals_->host_resolver.get(),
385 globals_->cert_verifier.get(),
386 globals_->dnsrr_resolver.get(),
387 NULL /* dns_cert_checker */,
388 NULL /* ssl_host_info_factory */,
389 globals_->system_proxy_service,
390 globals_->ssl_config_service.get(),
391 new net::SpdySessionPool(globals_->ssl_config_service.get()),
392 globals_->http_auth_handler_factory.get(),
393 &globals_->network_delegate,
394 net_log_));
395
396 scoped_refptr<net::URLRequestContext> system_request_context =
397 ConstructSystemRequestContext(globals_, net_log_);
398 globals_->system_request_context = system_request_context;
354 } 399 }
355 400
356 void IOThread::CleanUp() { 401 void IOThread::CleanUp() {
357 // Step 1: Kill all things that might be holding onto 402 // Step 1: Kill all things that might be holding onto
358 // net::URLRequest/net::URLRequestContexts. 403 // net::URLRequest/net::URLRequestContexts.
359 404
360 #if defined(USE_NSS) 405 #if defined(USE_NSS)
361 net::ShutdownOCSP(); 406 net::ShutdownOCSP();
362 #endif // defined(USE_NSS) 407 #endif // defined(USE_NSS)
363 408
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 net::HostCache* host_cache = 554 net::HostCache* host_cache =
510 globals_->host_resolver.get()->GetAsHostResolverImpl()->cache(); 555 globals_->host_resolver.get()->GetAsHostResolverImpl()->cache();
511 if (host_cache) 556 if (host_cache)
512 host_cache->clear(); 557 host_cache->clear();
513 } 558 }
514 // Clear all of the passively logged data. 559 // Clear all of the passively logged data.
515 // TODO(eroman): this is a bit heavy handed, really all we need to do is 560 // TODO(eroman): this is a bit heavy handed, really all we need to do is
516 // clear the data pertaining to off the record context. 561 // clear the data pertaining to off the record context.
517 net_log_->ClearAllPassivelyCapturedEvents(); 562 net_log_->ClearAllPassivelyCapturedEvents();
518 } 563 }
OLDNEW
« no previous file with comments | « chrome/browser/io_thread.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698