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