OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/components/io_thread/ios_io_thread.h" | 5 #include "ios/components/io_thread/ios_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> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
| 14 #include "base/command_line.h" |
14 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
15 #include "base/debug/leak_tracker.h" | 16 #include "base/debug/leak_tracker.h" |
16 #include "base/environment.h" | 17 #include "base/environment.h" |
17 #include "base/logging.h" | 18 #include "base/logging.h" |
18 #include "base/macros.h" | 19 #include "base/macros.h" |
19 #include "base/memory/ptr_util.h" | 20 #include "base/memory/ptr_util.h" |
20 #include "base/metrics/field_trial.h" | 21 #include "base/metrics/field_trial.h" |
21 #include "base/stl_util.h" | 22 #include "base/stl_util.h" |
22 #include "base/strings/string_number_conversions.h" | 23 #include "base/strings/string_number_conversions.h" |
23 #include "base/strings/string_split.h" | 24 #include "base/strings/string_split.h" |
24 #include "base/strings/string_util.h" | 25 #include "base/strings/string_util.h" |
25 #include "base/threading/sequenced_worker_pool.h" | 26 #include "base/threading/sequenced_worker_pool.h" |
26 #include "base/threading/thread.h" | 27 #include "base/threading/thread.h" |
27 #include "base/time/time.h" | 28 #include "base/time/time.h" |
28 #include "base/trace_event/trace_event.h" | 29 #include "base/trace_event/trace_event.h" |
29 #include "components/net_log/chrome_net_log.h" | 30 #include "components/net_log/chrome_net_log.h" |
30 #include "components/network_session_configurator/network_session_configurator.h
" | 31 #include "components/network_session_configurator/browser/network_session_config
urator.h" |
31 #include "components/prefs/pref_service.h" | 32 #include "components/prefs/pref_service.h" |
32 #include "components/proxy_config/ios/proxy_service_factory.h" | 33 #include "components/proxy_config/ios/proxy_service_factory.h" |
33 #include "components/proxy_config/pref_proxy_config_tracker.h" | 34 #include "components/proxy_config/pref_proxy_config_tracker.h" |
34 #include "components/variations/variations_associated_data.h" | 35 #include "components/variations/variations_associated_data.h" |
35 #include "components/version_info/version_info.h" | 36 #include "components/version_info/version_info.h" |
36 #include "ios/web/public/user_agent.h" | 37 #include "ios/web/public/user_agent.h" |
37 #include "ios/web/public/web_client.h" | 38 #include "ios/web/public/web_client.h" |
38 #include "ios/web/public/web_thread.h" | 39 #include "ios/web/public/web_thread.h" |
39 #include "net/base/sdch_manager.h" | 40 #include "net/base/sdch_manager.h" |
40 #include "net/cert/cert_verifier.h" | 41 #include "net/cert/cert_verifier.h" |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 params_.enable_user_alternate_protocol_ports = false; | 341 params_.enable_user_alternate_protocol_ports = false; |
341 | 342 |
342 std::string quic_user_agent_id = GetChannelString(); | 343 std::string quic_user_agent_id = GetChannelString(); |
343 if (!quic_user_agent_id.empty()) | 344 if (!quic_user_agent_id.empty()) |
344 quic_user_agent_id.push_back(' '); | 345 quic_user_agent_id.push_back(' '); |
345 quic_user_agent_id.append( | 346 quic_user_agent_id.append( |
346 version_info::GetProductNameAndVersionForUserAgent()); | 347 version_info::GetProductNameAndVersionForUserAgent()); |
347 quic_user_agent_id.push_back(' '); | 348 quic_user_agent_id.push_back(' '); |
348 quic_user_agent_id.append(web::BuildOSCpuInfo()); | 349 quic_user_agent_id.append(web::BuildOSCpuInfo()); |
349 | 350 |
350 network_session_configurator::ParseFieldTrials( | 351 // Set up field trials, ignoring debug command line options. |
351 /*is_quic_force_disabled=*/false, | 352 network_session_configurator::ParseCommandLineAndFieldTrials( |
352 /*is_quic_force_enabled=*/false, quic_user_agent_id, ¶ms_); | 353 base::CommandLine(base::CommandLine::NO_PROGRAM), |
| 354 /*is_quic_force_disabled=*/false, quic_user_agent_id, ¶ms_); |
353 | 355 |
354 // InitSystemRequestContext turns right around and posts a task back | 356 // InitSystemRequestContext turns right around and posts a task back |
355 // to the IO thread, so we can't let it run until we know the IO | 357 // to the IO thread, so we can't let it run until we know the IO |
356 // thread has started. | 358 // thread has started. |
357 // | 359 // |
358 // Note that since we are at WebThread::Init time, the UI thread | 360 // Note that since we are at WebThread::Init time, the UI thread |
359 // is blocked waiting for the thread to start. Therefore, posting | 361 // is blocked waiting for the thread to start. Therefore, posting |
360 // this task to the main thread's message loop here is guaranteed to | 362 // this task to the main thread's message loop here is guaranteed to |
361 // get it onto the message loop while the IOSIOThread object still | 363 // get it onto the message loop while the IOSIOThread object still |
362 // exists. However, the message might not be processed on the UI | 364 // exists. However, the message might not be processed on the UI |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 new net::HttpNetworkSession(params, system_context)); | 504 new net::HttpNetworkSession(params, system_context)); |
503 globals->system_http_transaction_factory.reset( | 505 globals->system_http_transaction_factory.reset( |
504 new net::HttpNetworkLayer(globals->system_http_network_session.get())); | 506 new net::HttpNetworkLayer(globals->system_http_network_session.get())); |
505 context->set_http_transaction_factory( | 507 context->set_http_transaction_factory( |
506 globals->system_http_transaction_factory.get()); | 508 globals->system_http_transaction_factory.get()); |
507 | 509 |
508 return context; | 510 return context; |
509 } | 511 } |
510 | 512 |
511 } // namespace io_thread | 513 } // namespace io_thread |
OLD | NEW |