| 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/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "base/strings/string_split.h" | 23 #include "base/strings/string_split.h" |
| 24 #include "base/strings/string_util.h" | 24 #include "base/strings/string_util.h" |
| 25 #include "base/threading/sequenced_worker_pool.h" | 25 #include "base/threading/sequenced_worker_pool.h" |
| 26 #include "base/threading/thread.h" | 26 #include "base/threading/thread.h" |
| 27 #include "base/threading/worker_pool.h" | 27 #include "base/threading/worker_pool.h" |
| 28 #include "base/time/time.h" | 28 #include "base/time/time.h" |
| 29 #include "base/trace_event/trace_event.h" | 29 #include "base/trace_event/trace_event.h" |
| 30 #include "build/build_config.h" | 30 #include "build/build_config.h" |
| 31 #include "chrome/browser/browser_process.h" | 31 #include "chrome/browser/browser_process.h" |
| 32 #include "chrome/browser/net/async_dns_field_trial.h" | 32 #include "chrome/browser/net/async_dns_field_trial.h" |
| 33 #include "chrome/browser/net/chrome_net_log.h" | |
| 34 #include "chrome/browser/net/chrome_network_delegate.h" | 33 #include "chrome/browser/net/chrome_network_delegate.h" |
| 35 #include "chrome/browser/net/connect_interceptor.h" | 34 #include "chrome/browser/net/connect_interceptor.h" |
| 36 #include "chrome/browser/net/dns_probe_service.h" | 35 #include "chrome/browser/net/dns_probe_service.h" |
| 37 #include "chrome/browser/net/proxy_service_factory.h" | 36 #include "chrome/browser/net/proxy_service_factory.h" |
| 38 #include "chrome/common/channel_info.h" | 37 #include "chrome/common/channel_info.h" |
| 39 #include "chrome/common/chrome_content_client.h" | 38 #include "chrome/common/chrome_content_client.h" |
| 40 #include "chrome/common/chrome_switches.h" | 39 #include "chrome/common/chrome_switches.h" |
| 41 #include "chrome/common/pref_names.h" | 40 #include "chrome/common/pref_names.h" |
| 42 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref
s.h" | 41 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref
s.h" |
| 43 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" | 42 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" |
| 43 #include "components/net_log/chrome_net_log.h" |
| 44 #include "components/policy/core/common/policy_service.h" | 44 #include "components/policy/core/common/policy_service.h" |
| 45 #include "components/proxy_config/pref_proxy_config_tracker.h" | 45 #include "components/proxy_config/pref_proxy_config_tracker.h" |
| 46 #include "components/variations/variations_associated_data.h" | 46 #include "components/variations/variations_associated_data.h" |
| 47 #include "components/version_info/version_info.h" | 47 #include "components/version_info/version_info.h" |
| 48 #include "content/public/browser/browser_thread.h" | 48 #include "content/public/browser/browser_thread.h" |
| 49 #include "content/public/browser/cookie_store_factory.h" | 49 #include "content/public/browser/cookie_store_factory.h" |
| 50 #include "content/public/common/user_agent.h" | 50 #include "content/public/common/user_agent.h" |
| 51 #include "net/base/external_estimate_provider.h" | 51 #include "net/base/external_estimate_provider.h" |
| 52 #include "net/base/host_mapping_rules.h" | 52 #include "net/base/host_mapping_rules.h" |
| 53 #include "net/base/net_util.h" | 53 #include "net/base/net_util.h" |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 enable_user_alternate_protocol_ports(false) { | 414 enable_user_alternate_protocol_ports(false) { |
| 415 } | 415 } |
| 416 | 416 |
| 417 IOThread::Globals::~Globals() {} | 417 IOThread::Globals::~Globals() {} |
| 418 | 418 |
| 419 // |local_state| is passed in explicitly in order to (1) reduce implicit | 419 // |local_state| is passed in explicitly in order to (1) reduce implicit |
| 420 // dependencies and (2) make IOThread more flexible for testing. | 420 // dependencies and (2) make IOThread more flexible for testing. |
| 421 IOThread::IOThread( | 421 IOThread::IOThread( |
| 422 PrefService* local_state, | 422 PrefService* local_state, |
| 423 policy::PolicyService* policy_service, | 423 policy::PolicyService* policy_service, |
| 424 ChromeNetLog* net_log, | 424 net_log::ChromeNetLog* net_log, |
| 425 extensions::EventRouterForwarder* extension_event_router_forwarder) | 425 extensions::EventRouterForwarder* extension_event_router_forwarder) |
| 426 : net_log_(net_log), | 426 : net_log_(net_log), |
| 427 #if defined(ENABLE_EXTENSIONS) | 427 #if defined(ENABLE_EXTENSIONS) |
| 428 extension_event_router_forwarder_(extension_event_router_forwarder), | 428 extension_event_router_forwarder_(extension_event_router_forwarder), |
| 429 #endif | 429 #endif |
| 430 globals_(NULL), | 430 globals_(NULL), |
| 431 is_spdy_disabled_by_policy_(false), | 431 is_spdy_disabled_by_policy_(false), |
| 432 is_quic_allowed_by_policy_(true), | 432 is_quic_allowed_by_policy_(true), |
| 433 creation_time_(base::TimeTicks::Now()), | 433 creation_time_(base::TimeTicks::Now()), |
| 434 weak_factory_(this) { | 434 weak_factory_(this) { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 502 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 503 return globals_; | 503 return globals_; |
| 504 } | 504 } |
| 505 | 505 |
| 506 void IOThread::SetGlobalsForTesting(Globals* globals) { | 506 void IOThread::SetGlobalsForTesting(Globals* globals) { |
| 507 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 507 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 508 DCHECK(!globals || !globals_); | 508 DCHECK(!globals || !globals_); |
| 509 globals_ = globals; | 509 globals_ = globals; |
| 510 } | 510 } |
| 511 | 511 |
| 512 ChromeNetLog* IOThread::net_log() { | 512 net_log::ChromeNetLog* IOThread::net_log() { |
| 513 return net_log_; | 513 return net_log_; |
| 514 } | 514 } |
| 515 | 515 |
| 516 void IOThread::ChangedToOnTheRecord() { | 516 void IOThread::ChangedToOnTheRecord() { |
| 517 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 517 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 518 BrowserThread::PostTask( | 518 BrowserThread::PostTask( |
| 519 BrowserThread::IO, | 519 BrowserThread::IO, |
| 520 FROM_HERE, | 520 FROM_HERE, |
| 521 base::Bind(&IOThread::ChangedToOnTheRecordOnIOThread, | 521 base::Bind(&IOThread::ChangedToOnTheRecordOnIOThread, |
| 522 base::Unretained(this))); | 522 base::Unretained(this))); |
| (...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1586 globals->proxy_script_fetcher_url_request_job_factory = job_factory.Pass(); | 1586 globals->proxy_script_fetcher_url_request_job_factory = job_factory.Pass(); |
| 1587 | 1587 |
| 1588 context->set_job_factory( | 1588 context->set_job_factory( |
| 1589 globals->proxy_script_fetcher_url_request_job_factory.get()); | 1589 globals->proxy_script_fetcher_url_request_job_factory.get()); |
| 1590 | 1590 |
| 1591 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the | 1591 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the |
| 1592 // system URLRequestContext too. There's no reason this should be tied to a | 1592 // system URLRequestContext too. There's no reason this should be tied to a |
| 1593 // profile. | 1593 // profile. |
| 1594 return context; | 1594 return context; |
| 1595 } | 1595 } |
| OLD | NEW |