Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(332)

Side by Side Diff: ios/chrome/browser/ios_chrome_io_thread.mm

Issue 1861593005: Convert //ios from scoped_ptr to std::unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase? Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ios/chrome/browser/ios_chrome_io_thread.h ('k') | ios/chrome/browser/ios_chrome_main_parts.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
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/command_line.h"
15 #include "base/compiler_specific.h" 15 #include "base/compiler_specific.h"
16 #include "base/debug/leak_tracker.h" 16 #include "base/debug/leak_tracker.h"
17 #include "base/environment.h" 17 #include "base/environment.h"
18 #include "base/logging.h" 18 #include "base/logging.h"
19 #include "base/macros.h" 19 #include "base/macros.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_piece.h" 24 #include "base/strings/string_piece.h"
24 #include "base/strings/string_split.h" 25 #include "base/strings/string_split.h"
25 #include "base/strings/string_util.h" 26 #include "base/strings/string_util.h"
26 #include "base/threading/sequenced_worker_pool.h" 27 #include "base/threading/sequenced_worker_pool.h"
27 #include "base/threading/thread.h" 28 #include "base/threading/thread.h"
28 #include "base/threading/worker_pool.h" 29 #include "base/threading/worker_pool.h"
29 #include "base/time/time.h" 30 #include "base/time/time.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 154
154 private: 155 private:
155 ~SystemURLRequestContext() override { 156 ~SystemURLRequestContext() override {
156 AssertNoURLRequests(); 157 AssertNoURLRequests();
157 #if defined(USE_NSS_VERIFIER) 158 #if defined(USE_NSS_VERIFIER)
158 net::SetURLRequestContextForNSSHttpIO(nullptr); 159 net::SetURLRequestContextForNSSHttpIO(nullptr);
159 #endif 160 #endif
160 } 161 }
161 }; 162 };
162 163
163 scoped_ptr<net::HostResolver> CreateGlobalHostResolver(net::NetLog* net_log) { 164 std::unique_ptr<net::HostResolver> CreateGlobalHostResolver(
165 net::NetLog* net_log) {
164 TRACE_EVENT0("startup", "IOSChromeIOThread::CreateGlobalHostResolver"); 166 TRACE_EVENT0("startup", "IOSChromeIOThread::CreateGlobalHostResolver");
165 const base::CommandLine& command_line = 167 const base::CommandLine& command_line =
166 *base::CommandLine::ForCurrentProcess(); 168 *base::CommandLine::ForCurrentProcess();
167 169
168 scoped_ptr<net::HostResolver> global_host_resolver = 170 std::unique_ptr<net::HostResolver> global_host_resolver =
169 net::HostResolver::CreateSystemResolver(net::HostResolver::Options(), 171 net::HostResolver::CreateSystemResolver(net::HostResolver::Options(),
170 net_log); 172 net_log);
171 173
172 // If hostname remappings were specified on the command-line, layer these 174 // If hostname remappings were specified on the command-line, layer these
173 // rules on top of the real host resolver. This allows forwarding all requests 175 // rules on top of the real host resolver. This allows forwarding all requests
174 // through a designated test server. 176 // through a designated test server.
175 if (!command_line.HasSwitch(switches::kIOSHostResolverRules)) 177 if (!command_line.HasSwitch(switches::kIOSHostResolverRules))
176 return global_host_resolver; 178 return global_host_resolver;
177 179
178 scoped_ptr<net::MappedHostResolver> remapped_resolver( 180 std::unique_ptr<net::MappedHostResolver> remapped_resolver(
179 new net::MappedHostResolver(std::move(global_host_resolver))); 181 new net::MappedHostResolver(std::move(global_host_resolver)));
180 remapped_resolver->SetRulesFromString( 182 remapped_resolver->SetRulesFromString(
181 command_line.GetSwitchValueASCII(switches::kIOSHostResolverRules)); 183 command_line.GetSwitchValueASCII(switches::kIOSHostResolverRules));
182 return std::move(remapped_resolver); 184 return std::move(remapped_resolver);
183 } 185 }
184 186
185 int GetSwitchValueAsInt(const base::CommandLine& command_line, 187 int GetSwitchValueAsInt(const base::CommandLine& command_line,
186 const std::string& switch_name) { 188 const std::string& switch_name) {
187 int value; 189 int value;
188 if (!base::StringToInt(command_line.GetSwitchValueASCII(switch_name), 190 if (!base::StringToInt(command_line.GetSwitchValueASCII(switch_name),
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 globals_ = new Globals; 401 globals_ = new Globals;
400 402
401 // Add an observer that will emit network change events to the ChromeNetLog. 403 // Add an observer that will emit network change events to the ChromeNetLog.
402 // Assuming NetworkChangeNotifier dispatches in FIFO order, we should be 404 // Assuming NetworkChangeNotifier dispatches in FIFO order, we should be
403 // logging the network change before other IO thread consumers respond to it. 405 // logging the network change before other IO thread consumers respond to it.
404 network_change_observer_.reset(new LoggingNetworkChangeObserver(net_log_)); 406 network_change_observer_.reset(new LoggingNetworkChangeObserver(net_log_));
405 407
406 // Setup the HistogramWatcher to run on the IO thread. 408 // Setup the HistogramWatcher to run on the IO thread.
407 net::NetworkChangeNotifier::InitHistogramWatcher(); 409 net::NetworkChangeNotifier::InitHistogramWatcher();
408 410
409 scoped_ptr<IOSChromeNetworkDelegate> chrome_network_delegate( 411 std::unique_ptr<IOSChromeNetworkDelegate> chrome_network_delegate(
410 new IOSChromeNetworkDelegate()); 412 new IOSChromeNetworkDelegate());
411 413
412 globals_->system_network_delegate = std::move(chrome_network_delegate); 414 globals_->system_network_delegate = std::move(chrome_network_delegate);
413 globals_->host_resolver = CreateGlobalHostResolver(net_log_); 415 globals_->host_resolver = CreateGlobalHostResolver(net_log_);
414 416
415 std::map<std::string, std::string> network_quality_estimator_params; 417 std::map<std::string, std::string> network_quality_estimator_params;
416 variations::GetVariationParams(kNetworkQualityEstimatorFieldTrialName, 418 variations::GetVariationParams(kNetworkQualityEstimatorFieldTrialName,
417 &network_quality_estimator_params); 419 &network_quality_estimator_params);
418 420
419 scoped_ptr<net::ExternalEstimateProvider> external_estimate_provider; 421 std::unique_ptr<net::ExternalEstimateProvider> external_estimate_provider;
420 // Pass ownership. 422 // Pass ownership.
421 globals_->network_quality_estimator.reset(new net::NetworkQualityEstimator( 423 globals_->network_quality_estimator.reset(new net::NetworkQualityEstimator(
422 std::move(external_estimate_provider), network_quality_estimator_params)); 424 std::move(external_estimate_provider), network_quality_estimator_params));
423 425
424 globals_->cert_verifier.reset( 426 globals_->cert_verifier.reset(
425 new net::MultiThreadedCertVerifier(net::CertVerifyProc::CreateDefault())); 427 new net::MultiThreadedCertVerifier(net::CertVerifyProc::CreateDefault()));
426 428
427 globals_->transport_security_state.reset(new net::TransportSecurityState()); 429 globals_->transport_security_state.reset(new net::TransportSecurityState());
428 430
429 std::vector<scoped_refptr<const net::CTLogVerifier>> ct_logs( 431 std::vector<scoped_refptr<const net::CTLogVerifier>> ct_logs(
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 context->set_ssl_config_service(globals->ssl_config_service.get()); 1016 context->set_ssl_config_service(globals->ssl_config_service.get());
1015 context->set_http_auth_handler_factory( 1017 context->set_http_auth_handler_factory(
1016 globals->http_auth_handler_factory.get()); 1018 globals->http_auth_handler_factory.get());
1017 context->set_proxy_service(globals->system_proxy_service.get()); 1019 context->set_proxy_service(globals->system_proxy_service.get());
1018 1020
1019 net::URLRequestJobFactoryImpl* system_job_factory = 1021 net::URLRequestJobFactoryImpl* system_job_factory =
1020 new net::URLRequestJobFactoryImpl(); 1022 new net::URLRequestJobFactoryImpl();
1021 // Data URLs are always loaded through the system request context on iOS 1023 // Data URLs are always loaded through the system request context on iOS
1022 // (due to UIWebView limitations). 1024 // (due to UIWebView limitations).
1023 bool set_protocol = system_job_factory->SetProtocolHandler( 1025 bool set_protocol = system_job_factory->SetProtocolHandler(
1024 url::kDataScheme, make_scoped_ptr(new net::DataProtocolHandler())); 1026 url::kDataScheme, base::WrapUnique(new net::DataProtocolHandler()));
1025 DCHECK(set_protocol); 1027 DCHECK(set_protocol);
1026 globals->system_url_request_job_factory.reset(system_job_factory); 1028 globals->system_url_request_job_factory.reset(system_job_factory);
1027 context->set_job_factory(globals->system_url_request_job_factory.get()); 1029 context->set_job_factory(globals->system_url_request_job_factory.get());
1028 1030
1029 context->set_cookie_store(globals->system_cookie_store.get()); 1031 context->set_cookie_store(globals->system_cookie_store.get());
1030 context->set_channel_id_service(globals->system_channel_id_service.get()); 1032 context->set_channel_id_service(globals->system_channel_id_service.get());
1031 context->set_network_delegate(globals->system_network_delegate.get()); 1033 context->set_network_delegate(globals->system_network_delegate.get());
1032 context->set_http_user_agent_settings( 1034 context->set_http_user_agent_settings(
1033 globals->http_user_agent_settings.get()); 1035 globals->http_user_agent_settings.get());
1034 context->set_network_quality_estimator( 1036 context->set_network_quality_estimator(
(...skipping 10 matching lines...) Expand all
1045 1047
1046 globals->system_http_network_session.reset( 1048 globals->system_http_network_session.reset(
1047 new net::HttpNetworkSession(system_params)); 1049 new net::HttpNetworkSession(system_params));
1048 globals->system_http_transaction_factory.reset( 1050 globals->system_http_transaction_factory.reset(
1049 new net::HttpNetworkLayer(globals->system_http_network_session.get())); 1051 new net::HttpNetworkLayer(globals->system_http_network_session.get()));
1050 context->set_http_transaction_factory( 1052 context->set_http_transaction_factory(
1051 globals->system_http_transaction_factory.get()); 1053 globals->system_http_transaction_factory.get());
1052 1054
1053 return context; 1055 return context;
1054 } 1056 }
OLDNEW
« no previous file with comments | « ios/chrome/browser/ios_chrome_io_thread.h ('k') | ios/chrome/browser/ios_chrome_main_parts.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698