OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ios/chrome/browser/ios_chrome_io_thread.h" | 5 #include "ios/chrome/browser/ios_chrome_io_thread.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 #include "net/base/network_quality_estimator.h" | 47 #include "net/base/network_quality_estimator.h" |
48 #include "net/base/sdch_manager.h" | 48 #include "net/base/sdch_manager.h" |
49 #include "net/cert/cert_verifier.h" | 49 #include "net/cert/cert_verifier.h" |
50 #include "net/cert/cert_verify_proc.h" | 50 #include "net/cert/cert_verify_proc.h" |
51 #include "net/cert/ct_known_logs.h" | 51 #include "net/cert/ct_known_logs.h" |
52 #include "net/cert/ct_log_verifier.h" | 52 #include "net/cert/ct_log_verifier.h" |
53 #include "net/cert/ct_policy_enforcer.h" | 53 #include "net/cert/ct_policy_enforcer.h" |
54 #include "net/cert/ct_verifier.h" | 54 #include "net/cert/ct_verifier.h" |
55 #include "net/cert/multi_log_ct_verifier.h" | 55 #include "net/cert/multi_log_ct_verifier.h" |
56 #include "net/cert/multi_threaded_cert_verifier.h" | 56 #include "net/cert/multi_threaded_cert_verifier.h" |
57 #include "net/cert_net/nss_ocsp.h" | |
58 #include "net/cookies/cookie_monster.h" | 57 #include "net/cookies/cookie_monster.h" |
59 #include "net/cookies/cookie_store.h" | 58 #include "net/cookies/cookie_store.h" |
60 #include "net/dns/host_cache.h" | 59 #include "net/dns/host_cache.h" |
61 #include "net/dns/host_resolver.h" | 60 #include "net/dns/host_resolver.h" |
62 #include "net/dns/mapped_host_resolver.h" | 61 #include "net/dns/mapped_host_resolver.h" |
63 #include "net/http/http_auth_filter.h" | 62 #include "net/http/http_auth_filter.h" |
64 #include "net/http/http_auth_handler_factory.h" | 63 #include "net/http/http_auth_handler_factory.h" |
65 #include "net/http/http_auth_preferences.h" | 64 #include "net/http/http_auth_preferences.h" |
66 #include "net/http/http_network_layer.h" | 65 #include "net/http/http_network_layer.h" |
67 #include "net/http/http_network_session.h" | 66 #include "net/http/http_network_session.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 138 |
140 // Field trial for priority dependencies. | 139 // Field trial for priority dependencies. |
141 const char kSpdyDependenciesFieldTrial[] = "SpdyEnableDependencies"; | 140 const char kSpdyDependenciesFieldTrial[] = "SpdyEnableDependencies"; |
142 const char kSpdyDependenciesFieldTrialEnable[] = "Enable"; | 141 const char kSpdyDependenciesFieldTrialEnable[] = "Enable"; |
143 const char kSpdyDepencenciesFieldTrialDisable[] = "Disable"; | 142 const char kSpdyDepencenciesFieldTrialDisable[] = "Disable"; |
144 | 143 |
145 // Used for the "system" URLRequestContext. | 144 // Used for the "system" URLRequestContext. |
146 class SystemURLRequestContext : public net::URLRequestContext { | 145 class SystemURLRequestContext : public net::URLRequestContext { |
147 public: | 146 public: |
148 SystemURLRequestContext() { | 147 SystemURLRequestContext() { |
149 #if defined(USE_NSS_VERIFIER) | |
150 net::SetURLRequestContextForNSSHttpIO(this); | |
151 #endif | |
152 } | 148 } |
153 | 149 |
154 private: | 150 private: |
155 ~SystemURLRequestContext() override { | 151 ~SystemURLRequestContext() override { |
156 AssertNoURLRequests(); | 152 AssertNoURLRequests(); |
157 #if defined(USE_NSS_VERIFIER) | |
158 net::SetURLRequestContextForNSSHttpIO(nullptr); | |
159 #endif | |
160 } | 153 } |
161 }; | 154 }; |
162 | 155 |
163 std::unique_ptr<net::HostResolver> CreateGlobalHostResolver( | 156 std::unique_ptr<net::HostResolver> CreateGlobalHostResolver( |
164 net::NetLog* net_log) { | 157 net::NetLog* net_log) { |
165 TRACE_EVENT0("startup", "IOSChromeIOThread::CreateGlobalHostResolver"); | 158 TRACE_EVENT0("startup", "IOSChromeIOThread::CreateGlobalHostResolver"); |
166 const base::CommandLine& command_line = | 159 const base::CommandLine& command_line = |
167 *base::CommandLine::ForCurrentProcess(); | 160 *base::CommandLine::ForCurrentProcess(); |
168 | 161 |
169 std::unique_ptr<net::HostResolver> global_host_resolver = | 162 std::unique_ptr<net::HostResolver> global_host_resolver = |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 if (!system_url_request_context_getter_.get()) { | 375 if (!system_url_request_context_getter_.get()) { |
383 InitSystemRequestContext(); | 376 InitSystemRequestContext(); |
384 } | 377 } |
385 return system_url_request_context_getter_.get(); | 378 return system_url_request_context_getter_.get(); |
386 } | 379 } |
387 | 380 |
388 void IOSChromeIOThread::Init() { | 381 void IOSChromeIOThread::Init() { |
389 TRACE_EVENT0("startup", "IOSChromeIOThread::Init"); | 382 TRACE_EVENT0("startup", "IOSChromeIOThread::Init"); |
390 DCHECK_CURRENTLY_ON(web::WebThread::IO); | 383 DCHECK_CURRENTLY_ON(web::WebThread::IO); |
391 | 384 |
392 #if defined(USE_NSS_VERIFIER) | |
393 net::SetMessageLoopForNSSHttpIO(); | |
394 #endif | |
395 | |
396 const base::CommandLine& command_line = | 385 const base::CommandLine& command_line = |
397 *base::CommandLine::ForCurrentProcess(); | 386 *base::CommandLine::ForCurrentProcess(); |
398 | 387 |
399 DCHECK(!globals_); | 388 DCHECK(!globals_); |
400 globals_ = new Globals; | 389 globals_ = new Globals; |
401 | 390 |
402 // Add an observer that will emit network change events to the ChromeNetLog. | 391 // Add an observer that will emit network change events to the ChromeNetLog. |
403 // Assuming NetworkChangeNotifier dispatches in FIFO order, we should be | 392 // Assuming NetworkChangeNotifier dispatches in FIFO order, we should be |
404 // logging the network change before other IO thread consumers respond to it. | 393 // logging the network change before other IO thread consumers respond to it. |
405 network_change_observer_.reset(new LoggingNetworkChangeObserver(net_log_)); | 394 network_change_observer_.reset(new LoggingNetworkChangeObserver(net_log_)); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 // get it onto the message loop while the IOSChromeIOThread object still | 473 // get it onto the message loop while the IOSChromeIOThread object still |
485 // exists. However, the message might not be processed on the UI | 474 // exists. However, the message might not be processed on the UI |
486 // thread until after IOSChromeIOThread is gone, so use a weak pointer. | 475 // thread until after IOSChromeIOThread is gone, so use a weak pointer. |
487 web::WebThread::PostTask( | 476 web::WebThread::PostTask( |
488 web::WebThread::UI, FROM_HERE, | 477 web::WebThread::UI, FROM_HERE, |
489 base::Bind(&IOSChromeIOThread::InitSystemRequestContext, | 478 base::Bind(&IOSChromeIOThread::InitSystemRequestContext, |
490 weak_factory_.GetWeakPtr())); | 479 weak_factory_.GetWeakPtr())); |
491 } | 480 } |
492 | 481 |
493 void IOSChromeIOThread::CleanUp() { | 482 void IOSChromeIOThread::CleanUp() { |
494 #if defined(USE_NSS_VERIFIER) | |
495 net::ShutdownNSSHttpIO(); | |
496 #endif | |
497 | |
498 system_url_request_context_getter_ = nullptr; | 483 system_url_request_context_getter_ = nullptr; |
499 | 484 |
500 // Release objects that the net::URLRequestContext could have been pointing | 485 // Release objects that the net::URLRequestContext could have been pointing |
501 // to. | 486 // to. |
502 | 487 |
503 // Shutdown the HistogramWatcher on the IO thread. | 488 // Shutdown the HistogramWatcher on the IO thread. |
504 net::NetworkChangeNotifier::ShutdownHistogramWatcher(); | 489 net::NetworkChangeNotifier::ShutdownHistogramWatcher(); |
505 | 490 |
506 // This must be reset before the ChromeNetLog is destroyed. | 491 // This must be reset before the ChromeNetLog is destroyed. |
507 network_change_observer_.reset(); | 492 network_change_observer_.reset(); |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1046 | 1031 |
1047 globals->system_http_network_session.reset( | 1032 globals->system_http_network_session.reset( |
1048 new net::HttpNetworkSession(system_params)); | 1033 new net::HttpNetworkSession(system_params)); |
1049 globals->system_http_transaction_factory.reset( | 1034 globals->system_http_transaction_factory.reset( |
1050 new net::HttpNetworkLayer(globals->system_http_network_session.get())); | 1035 new net::HttpNetworkLayer(globals->system_http_network_session.get())); |
1051 context->set_http_transaction_factory( | 1036 context->set_http_transaction_factory( |
1052 globals->system_http_transaction_factory.get()); | 1037 globals->system_http_transaction_factory.get()); |
1053 | 1038 |
1054 return context; | 1039 return context; |
1055 } | 1040 } |
OLD | NEW |