OLD | NEW |
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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 globals_ = new Globals; | 388 globals_ = new Globals; |
389 | 389 |
390 // Add an observer that will emit network change events to the ChromeNetLog. | 390 // Add an observer that will emit network change events to the ChromeNetLog. |
391 // Assuming NetworkChangeNotifier dispatches in FIFO order, we should be | 391 // Assuming NetworkChangeNotifier dispatches in FIFO order, we should be |
392 // logging the network change before other IO thread consumers respond to it. | 392 // logging the network change before other IO thread consumers respond to it. |
393 network_change_observer_.reset( | 393 network_change_observer_.reset( |
394 new LoggingNetworkChangeObserver(net_log_)); | 394 new LoggingNetworkChangeObserver(net_log_)); |
395 | 395 |
396 globals_->extension_event_router_forwarder = | 396 globals_->extension_event_router_forwarder = |
397 extension_event_router_forwarder_; | 397 extension_event_router_forwarder_; |
398 globals_->system_network_delegate.reset(new ChromeNetworkDelegate( | 398 ChromeNetworkDelegate* network_delegate = new ChromeNetworkDelegate( |
399 extension_event_router_forwarder_, | 399 extension_event_router_forwarder_, |
400 NULL, | 400 NULL, |
401 NULL, | 401 NULL, |
402 NULL, | 402 NULL, |
403 NULL, | 403 NULL, |
404 &system_enable_referrers_)); | 404 &system_enable_referrers_); |
| 405 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 406 switches::kDisableExtensionsHttpThrottling)) { |
| 407 network_delegate->NeverThrottleRequests(); |
| 408 } |
| 409 globals_->system_network_delegate.reset(network_delegate); |
405 globals_->host_resolver.reset( | 410 globals_->host_resolver.reset( |
406 CreateGlobalHostResolver(net_log_)); | 411 CreateGlobalHostResolver(net_log_)); |
407 globals_->cert_verifier.reset(net::CertVerifier::CreateDefault()); | 412 globals_->cert_verifier.reset(net::CertVerifier::CreateDefault()); |
408 globals_->transport_security_state.reset(new net::TransportSecurityState()); | 413 globals_->transport_security_state.reset(new net::TransportSecurityState()); |
409 globals_->ssl_config_service = GetSSLConfigService(); | 414 globals_->ssl_config_service = GetSSLConfigService(); |
410 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory( | 415 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory( |
411 globals_->host_resolver.get())); | 416 globals_->host_resolver.get())); |
412 globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl); | 417 globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl); |
413 // For the ProxyScriptFetcher, we use a direct ProxyService. | 418 // For the ProxyScriptFetcher, we use a direct ProxyService. |
414 globals_->proxy_script_fetcher_proxy_service.reset( | 419 globals_->proxy_script_fetcher_proxy_service.reset( |
(...skipping 25 matching lines...) Expand all Loading... |
440 session_params.net_log = net_log_; | 445 session_params.net_log = net_log_; |
441 session_params.ssl_config_service = globals_->ssl_config_service; | 446 session_params.ssl_config_service = globals_->ssl_config_service; |
442 scoped_refptr<net::HttpNetworkSession> network_session( | 447 scoped_refptr<net::HttpNetworkSession> network_session( |
443 new net::HttpNetworkSession(session_params)); | 448 new net::HttpNetworkSession(session_params)); |
444 globals_->proxy_script_fetcher_http_transaction_factory.reset( | 449 globals_->proxy_script_fetcher_http_transaction_factory.reset( |
445 new net::HttpNetworkLayer(network_session)); | 450 new net::HttpNetworkLayer(network_session)); |
446 globals_->proxy_script_fetcher_ftp_transaction_factory.reset( | 451 globals_->proxy_script_fetcher_ftp_transaction_factory.reset( |
447 new net::FtpNetworkLayer(globals_->host_resolver.get())); | 452 new net::FtpNetworkLayer(globals_->host_resolver.get())); |
448 | 453 |
449 globals_->throttler_manager.reset(new net::URLRequestThrottlerManager()); | 454 globals_->throttler_manager.reset(new net::URLRequestThrottlerManager()); |
| 455 globals_->throttler_manager->set_net_log(net_log_); |
450 // Always done in production, disabled only for unit tests. | 456 // Always done in production, disabled only for unit tests. |
451 globals_->throttler_manager->set_enable_thread_checks(true); | 457 globals_->throttler_manager->set_enable_thread_checks(true); |
452 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
453 switches::kDisableExtensionsHttpThrottling)) { | |
454 globals_->throttler_manager->set_enforce_throttling(false); | |
455 } | |
456 globals_->throttler_manager->set_net_log(net_log_); | |
457 | 458 |
458 globals_->proxy_script_fetcher_context.reset( | 459 globals_->proxy_script_fetcher_context.reset( |
459 ConstructProxyScriptFetcherContext(globals_, net_log_)); | 460 ConstructProxyScriptFetcherContext(globals_, net_log_)); |
460 | 461 |
461 sdch_manager_ = new net::SdchManager(); | 462 sdch_manager_ = new net::SdchManager(); |
462 | 463 |
463 // InitSystemRequestContext turns right around and posts a task back | 464 // InitSystemRequestContext turns right around and posts a task back |
464 // to the IO thread, so we can't let it run until we know the IO | 465 // to the IO thread, so we can't let it run until we know the IO |
465 // thread has started. | 466 // thread has started. |
466 // | 467 // |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 new net::HttpNetworkLayer( | 624 new net::HttpNetworkLayer( |
624 new net::HttpNetworkSession(system_params))); | 625 new net::HttpNetworkSession(system_params))); |
625 globals_->system_ftp_transaction_factory.reset( | 626 globals_->system_ftp_transaction_factory.reset( |
626 new net::FtpNetworkLayer(globals_->host_resolver.get())); | 627 new net::FtpNetworkLayer(globals_->host_resolver.get())); |
627 globals_->system_request_context.reset( | 628 globals_->system_request_context.reset( |
628 ConstructSystemRequestContext(globals_, net_log_)); | 629 ConstructSystemRequestContext(globals_, net_log_)); |
629 | 630 |
630 sdch_manager_->set_sdch_fetcher( | 631 sdch_manager_->set_sdch_fetcher( |
631 new SdchDictionaryFetcher(system_url_request_context_getter_.get())); | 632 new SdchDictionaryFetcher(system_url_request_context_getter_.get())); |
632 } | 633 } |
OLD | NEW |