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/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/debug/leak_tracker.h" | 13 #include "base/debug/leak_tracker.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
16 #include "base/string_number_conversions.h" | 16 #include "base/string_number_conversions.h" |
17 #include "base/string_split.h" | 17 #include "base/string_split.h" |
18 #include "base/string_util.h" | 18 #include "base/string_util.h" |
19 #include "base/threading/thread.h" | 19 #include "base/threading/thread.h" |
20 #include "base/threading/thread_restrictions.h" | |
21 #include "build/build_config.h" | 20 #include "build/build_config.h" |
22 #include "chrome/browser/browser_process.h" | 21 #include "chrome/browser/browser_process.h" |
23 #include "chrome/browser/extensions/extension_event_router_forwarder.h" | 22 #include "chrome/browser/extensions/extension_event_router_forwarder.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/http_pipelining_compatibility_client.h" | 27 #include "chrome/browser/net/http_pipelining_compatibility_client.h" |
29 #include "chrome/browser/net/pref_proxy_config_tracker.h" | 28 #include "chrome/browser/net/pref_proxy_config_tracker.h" |
30 #include "chrome/browser/net/proxy_service_factory.h" | 29 #include "chrome/browser/net/proxy_service_factory.h" |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 | 366 |
368 net::URLRequestContextGetter* IOThread::system_url_request_context_getter() { | 367 net::URLRequestContextGetter* IOThread::system_url_request_context_getter() { |
369 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 368 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
370 if (!system_url_request_context_getter_) { | 369 if (!system_url_request_context_getter_) { |
371 InitSystemRequestContext(); | 370 InitSystemRequestContext(); |
372 } | 371 } |
373 return system_url_request_context_getter_; | 372 return system_url_request_context_getter_; |
374 } | 373 } |
375 | 374 |
376 void IOThread::Init() { | 375 void IOThread::Init() { |
377 // Though this thread is called the "IO" thread, it actually just routes | |
378 // messages around; it shouldn't be allowed to perform any blocking disk I/O. | |
379 base::ThreadRestrictions::SetIOAllowed(false); | |
380 | |
381 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 376 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
382 | 377 |
383 #if defined(USE_NSS) | 378 #if defined(USE_NSS) |
384 net::SetMessageLoopForNSSHttpIO(); | 379 net::SetMessageLoopForNSSHttpIO(); |
385 #endif // defined(USE_NSS) | 380 #endif // defined(USE_NSS) |
386 | 381 |
387 DCHECK(!globals_); | 382 DCHECK(!globals_); |
388 globals_ = new Globals; | 383 globals_ = new Globals; |
389 | 384 |
390 // Add an observer that will emit network change events to the ChromeNetLog. | 385 // Add an observer that will emit network change events to the ChromeNetLog. |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 new net::HttpNetworkLayer( | 608 new net::HttpNetworkLayer( |
614 new net::HttpNetworkSession(system_params))); | 609 new net::HttpNetworkSession(system_params))); |
615 globals_->system_ftp_transaction_factory.reset( | 610 globals_->system_ftp_transaction_factory.reset( |
616 new net::FtpNetworkLayer(globals_->host_resolver.get())); | 611 new net::FtpNetworkLayer(globals_->host_resolver.get())); |
617 globals_->system_request_context = | 612 globals_->system_request_context = |
618 ConstructSystemRequestContext(globals_, net_log_); | 613 ConstructSystemRequestContext(globals_, net_log_); |
619 | 614 |
620 sdch_manager_->set_sdch_fetcher( | 615 sdch_manager_->set_sdch_fetcher( |
621 new SdchDictionaryFetcher(system_url_request_context_getter_.get())); | 616 new SdchDictionaryFetcher(system_url_request_context_getter_.get())); |
622 } | 617 } |
OLD | NEW |