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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 params_.enable_user_alternate_protocol_ports = false; | 358 params_.enable_user_alternate_protocol_ports = false; |
358 | 359 |
359 std::string quic_user_agent_id = GetChannelString(); | 360 std::string quic_user_agent_id = GetChannelString(); |
360 if (!quic_user_agent_id.empty()) | 361 if (!quic_user_agent_id.empty()) |
361 quic_user_agent_id.push_back(' '); | 362 quic_user_agent_id.push_back(' '); |
362 quic_user_agent_id.append( | 363 quic_user_agent_id.append( |
363 version_info::GetProductNameAndVersionForUserAgent()); | 364 version_info::GetProductNameAndVersionForUserAgent()); |
364 quic_user_agent_id.push_back(' '); | 365 quic_user_agent_id.push_back(' '); |
365 quic_user_agent_id.append(web::BuildOSCpuInfo()); | 366 quic_user_agent_id.append(web::BuildOSCpuInfo()); |
366 | 367 |
367 network_session_configurator::ParseFieldTrials( | 368 // Set up field trials, ignoring debug command line options. |
368 /*is_quic_force_disabled=*/false, | 369 network_session_configurator::ParseCommandLineAndFieldTrials( |
369 /*is_quic_force_enabled=*/false, quic_user_agent_id, ¶ms_); | 370 base::CommandLine(base::CommandLine::NO_PROGRAM), |
| 371 /*is_quic_force_disabled=*/false, quic_user_agent_id, ¶ms_); |
370 | 372 |
371 // InitSystemRequestContext turns right around and posts a task back | 373 // InitSystemRequestContext turns right around and posts a task back |
372 // to the IO thread, so we can't let it run until we know the IO | 374 // to the IO thread, so we can't let it run until we know the IO |
373 // thread has started. | 375 // thread has started. |
374 // | 376 // |
375 // Note that since we are at WebThread::Init time, the UI thread | 377 // Note that since we are at WebThread::Init time, the UI thread |
376 // is blocked waiting for the thread to start. Therefore, posting | 378 // is blocked waiting for the thread to start. Therefore, posting |
377 // this task to the main thread's message loop here is guaranteed to | 379 // this task to the main thread's message loop here is guaranteed to |
378 // get it onto the message loop while the IOSIOThread object still | 380 // get it onto the message loop while the IOSIOThread object still |
379 // exists. However, the message might not be processed on the UI | 381 // exists. However, the message might not be processed on the UI |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 new net::HttpNetworkSession(params, system_context)); | 523 new net::HttpNetworkSession(params, system_context)); |
522 globals->system_http_transaction_factory.reset( | 524 globals->system_http_transaction_factory.reset( |
523 new net::HttpNetworkLayer(globals->system_http_network_session.get())); | 525 new net::HttpNetworkLayer(globals->system_http_network_session.get())); |
524 context->set_http_transaction_factory( | 526 context->set_http_transaction_factory( |
525 globals->system_http_transaction_factory.get()); | 527 globals->system_http_transaction_factory.get()); |
526 | 528 |
527 return context; | 529 return context; |
528 } | 530 } |
529 | 531 |
530 } // namespace io_thread | 532 } // namespace io_thread |
OLD | NEW |