| 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" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/debug/leak_tracker.h" | 12 #include "base/debug/leak_tracker.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
| 15 #include "base/string_number_conversions.h" | 15 #include "base/string_number_conversions.h" |
| 16 #include "base/string_split.h" | 16 #include "base/string_split.h" |
| 17 #include "base/string_util.h" | 17 #include "base/string_util.h" |
| 18 #include "base/threading/thread.h" | 18 #include "base/threading/thread.h" |
| 19 #include "base/threading/thread_restrictions.h" | 19 #include "base/threading/thread_restrictions.h" |
| 20 #include "build/build_config.h" | 20 #include "build/build_config.h" |
| 21 #include "chrome/browser/browser_process.h" | 21 #include "chrome/browser/browser_process.h" |
| 22 #include "chrome/browser/extensions/extension_event_router_forwarder.h" | 22 #include "chrome/browser/extensions/extension_event_router_forwarder.h" |
| 23 #include "chrome/browser/media/media_internals.h" | |
| 24 #include "chrome/browser/net/chrome_net_log.h" | 23 #include "chrome/browser/net/chrome_net_log.h" |
| 25 #include "chrome/browser/net/chrome_network_delegate.h" | 24 #include "chrome/browser/net/chrome_network_delegate.h" |
| 26 #include "chrome/browser/net/chrome_url_request_context.h" | 25 #include "chrome/browser/net/chrome_url_request_context.h" |
| 27 #include "chrome/browser/net/connect_interceptor.h" | 26 #include "chrome/browser/net/connect_interceptor.h" |
| 28 #include "chrome/browser/net/pref_proxy_config_tracker.h" | 27 #include "chrome/browser/net/pref_proxy_config_tracker.h" |
| 29 #include "chrome/browser/net/proxy_service_factory.h" | 28 #include "chrome/browser/net/proxy_service_factory.h" |
| 30 #include "chrome/browser/net/sdch_dictionary_fetcher.h" | 29 #include "chrome/browser/net/sdch_dictionary_fetcher.h" |
| 31 #include "chrome/browser/prefs/pref_service.h" | 30 #include "chrome/browser/prefs/pref_service.h" |
| 32 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" |
| 33 #include "chrome/common/pref_names.h" | 32 #include "chrome/common/pref_names.h" |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 | 279 |
| 281 scoped_refptr<base::MessageLoopProxy> | 280 scoped_refptr<base::MessageLoopProxy> |
| 282 SystemURLRequestContextGetter::GetIOMessageLoopProxy() const { | 281 SystemURLRequestContextGetter::GetIOMessageLoopProxy() const { |
| 283 return io_message_loop_proxy_; | 282 return io_message_loop_proxy_; |
| 284 } | 283 } |
| 285 | 284 |
| 286 IOThread::Globals::Globals() {} | 285 IOThread::Globals::Globals() {} |
| 287 | 286 |
| 288 IOThread::Globals::~Globals() {} | 287 IOThread::Globals::~Globals() {} |
| 289 | 288 |
| 290 IOThread::Globals::MediaGlobals::MediaGlobals() {} | |
| 291 | |
| 292 IOThread::Globals::MediaGlobals::~MediaGlobals() {} | |
| 293 | |
| 294 // |local_state| is passed in explicitly in order to (1) reduce implicit | 289 // |local_state| is passed in explicitly in order to (1) reduce implicit |
| 295 // dependencies and (2) make IOThread more flexible for testing. | 290 // dependencies and (2) make IOThread more flexible for testing. |
| 296 IOThread::IOThread( | 291 IOThread::IOThread( |
| 297 PrefService* local_state, | 292 PrefService* local_state, |
| 298 ChromeNetLog* net_log, | 293 ChromeNetLog* net_log, |
| 299 ExtensionEventRouterForwarder* extension_event_router_forwarder) | 294 ExtensionEventRouterForwarder* extension_event_router_forwarder) |
| 300 : net_log_(net_log), | 295 : net_log_(net_log), |
| 301 extension_event_router_forwarder_(extension_event_router_forwarder), | 296 extension_event_router_forwarder_(extension_event_router_forwarder), |
| 302 globals_(NULL), | 297 globals_(NULL), |
| 303 sdch_manager_(NULL), | 298 sdch_manager_(NULL), |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 | 362 |
| 368 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 363 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 369 | 364 |
| 370 #if defined(USE_NSS) | 365 #if defined(USE_NSS) |
| 371 net::SetMessageLoopForNSSHttpIO(); | 366 net::SetMessageLoopForNSSHttpIO(); |
| 372 #endif // defined(USE_NSS) | 367 #endif // defined(USE_NSS) |
| 373 | 368 |
| 374 DCHECK(!globals_); | 369 DCHECK(!globals_); |
| 375 globals_ = new Globals; | 370 globals_ = new Globals; |
| 376 | 371 |
| 377 globals_->media.media_internals.reset(new MediaInternals()); | |
| 378 | |
| 379 // Add an observer that will emit network change events to the ChromeNetLog. | 372 // Add an observer that will emit network change events to the ChromeNetLog. |
| 380 // Assuming NetworkChangeNotifier dispatches in FIFO order, we should be | 373 // Assuming NetworkChangeNotifier dispatches in FIFO order, we should be |
| 381 // logging the network change before other IO thread consumers respond to it. | 374 // logging the network change before other IO thread consumers respond to it. |
| 382 network_change_observer_.reset( | 375 network_change_observer_.reset( |
| 383 new LoggingNetworkChangeObserver(net_log_)); | 376 new LoggingNetworkChangeObserver(net_log_)); |
| 384 | 377 |
| 385 globals_->extension_event_router_forwarder = | 378 globals_->extension_event_router_forwarder = |
| 386 extension_event_router_forwarder_; | 379 extension_event_router_forwarder_; |
| 387 globals_->system_network_delegate.reset(new ChromeNetworkDelegate( | 380 globals_->system_network_delegate.reset(new ChromeNetworkDelegate( |
| 388 extension_event_router_forwarder_, | 381 extension_event_router_forwarder_, |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 new net::HttpNetworkLayer( | 595 new net::HttpNetworkLayer( |
| 603 new net::HttpNetworkSession(system_params))); | 596 new net::HttpNetworkSession(system_params))); |
| 604 globals_->system_ftp_transaction_factory.reset( | 597 globals_->system_ftp_transaction_factory.reset( |
| 605 new net::FtpNetworkLayer(globals_->host_resolver.get())); | 598 new net::FtpNetworkLayer(globals_->host_resolver.get())); |
| 606 globals_->system_request_context = | 599 globals_->system_request_context = |
| 607 ConstructSystemRequestContext(globals_, net_log_); | 600 ConstructSystemRequestContext(globals_, net_log_); |
| 608 | 601 |
| 609 sdch_manager_->set_sdch_fetcher( | 602 sdch_manager_->set_sdch_fetcher( |
| 610 new SdchDictionaryFetcher(system_url_request_context_getter_.get())); | 603 new SdchDictionaryFetcher(system_url_request_context_getter_.get())); |
| 611 } | 604 } |
| OLD | NEW |