OLD | NEW |
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/bind.h" | 10 #include "base/bind.h" |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 | 388 |
389 IOThread::Globals* IOThread::globals() { | 389 IOThread::Globals* IOThread::globals() { |
390 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 390 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
391 return globals_; | 391 return globals_; |
392 } | 392 } |
393 | 393 |
394 ChromeNetLog* IOThread::net_log() { | 394 ChromeNetLog* IOThread::net_log() { |
395 return net_log_; | 395 return net_log_; |
396 } | 396 } |
397 | 397 |
| 398 void IOThread::ChangedToOnTheRecord() { |
| 399 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 400 BrowserThread::PostTask( |
| 401 BrowserThread::IO, |
| 402 FROM_HERE, |
| 403 base::Bind(&IOThread::ChangedToOnTheRecordOnIOThread, |
| 404 base::Unretained(this))); |
| 405 } |
| 406 |
398 net::URLRequestContextGetter* IOThread::system_url_request_context_getter() { | 407 net::URLRequestContextGetter* IOThread::system_url_request_context_getter() { |
399 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 408 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
400 if (!system_url_request_context_getter_) { | 409 if (!system_url_request_context_getter_) { |
401 InitSystemRequestContext(); | 410 InitSystemRequestContext(); |
402 } | 411 } |
403 return system_url_request_context_getter_; | 412 return system_url_request_context_getter_; |
404 } | 413 } |
405 | 414 |
406 void IOThread::Init() { | 415 void IOThread::Init() { |
407 // Though this thread is called the "IO" thread, it actually just routes | 416 // Though this thread is called the "IO" thread, it actually just routes |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 | 595 |
587 net::HostCache* host_cache = globals_->host_resolver->GetHostCache(); | 596 net::HostCache* host_cache = globals_->host_resolver->GetHostCache(); |
588 if (host_cache) | 597 if (host_cache) |
589 host_cache->clear(); | 598 host_cache->clear(); |
590 } | 599 } |
591 | 600 |
592 net::SSLConfigService* IOThread::GetSSLConfigService() { | 601 net::SSLConfigService* IOThread::GetSSLConfigService() { |
593 return ssl_config_service_manager_->Get(); | 602 return ssl_config_service_manager_->Get(); |
594 } | 603 } |
595 | 604 |
| 605 void IOThread::ChangedToOnTheRecordOnIOThread() { |
| 606 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 607 |
| 608 // Clear the host cache to avoid showing entries from the OTR session |
| 609 // in about:net-internals. |
| 610 ClearHostCache(); |
| 611 |
| 612 // Clear all of the passively logged data. |
| 613 // TODO(eroman): this is a bit heavy handed, really all we need to do is |
| 614 // clear the data pertaining to incognito context. |
| 615 net_log_->ClearAllPassivelyCapturedEvents(); |
| 616 } |
| 617 |
596 void IOThread::InitSystemRequestContext() { | 618 void IOThread::InitSystemRequestContext() { |
597 if (system_url_request_context_getter_) | 619 if (system_url_request_context_getter_) |
598 return; | 620 return; |
599 // If we're in unit_tests, IOThread may not be run. | 621 // If we're in unit_tests, IOThread may not be run. |
600 if (!BrowserThread::IsMessageLoopValid(BrowserThread::IO)) | 622 if (!BrowserThread::IsMessageLoopValid(BrowserThread::IO)) |
601 return; | 623 return; |
602 ChromeProxyConfigService* proxy_config_service = | 624 ChromeProxyConfigService* proxy_config_service = |
603 ProxyServiceFactory::CreateProxyConfigService(); | 625 ProxyServiceFactory::CreateProxyConfigService(); |
604 system_proxy_config_service_.reset(proxy_config_service); | 626 system_proxy_config_service_.reset(proxy_config_service); |
605 if (pref_proxy_config_tracker_.get()) { | 627 if (pref_proxy_config_tracker_.get()) { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 system_params.network_delegate = globals_->system_network_delegate.get(); | 667 system_params.network_delegate = globals_->system_network_delegate.get(); |
646 system_params.net_log = net_log_; | 668 system_params.net_log = net_log_; |
647 globals_->system_http_transaction_factory.reset( | 669 globals_->system_http_transaction_factory.reset( |
648 new net::HttpNetworkLayer( | 670 new net::HttpNetworkLayer( |
649 new net::HttpNetworkSession(system_params))); | 671 new net::HttpNetworkSession(system_params))); |
650 globals_->system_ftp_transaction_factory.reset( | 672 globals_->system_ftp_transaction_factory.reset( |
651 new net::FtpNetworkLayer(globals_->host_resolver.get())); | 673 new net::FtpNetworkLayer(globals_->host_resolver.get())); |
652 globals_->system_request_context = | 674 globals_->system_request_context = |
653 ConstructSystemRequestContext(globals_, net_log_); | 675 ConstructSystemRequestContext(globals_, net_log_); |
654 } | 676 } |
OLD | NEW |