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

Side by Side Diff: components/cronet/android/url_request_context_adapter.cc

Issue 1550383002: Convert Pass()→std::move() in //components (Android edition) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/cronet/android/url_request_context_adapter.h" 5 #include "components/cronet/android/url_request_context_adapter.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9
10 #include <limits> 9 #include <limits>
10 #include <utility>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/files/file_util.h" 13 #include "base/files/file_util.h"
14 #include "base/files/scoped_file.h" 14 #include "base/files/scoped_file.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/message_loop/message_loop.h" 16 #include "base/message_loop/message_loop.h"
17 #include "base/single_thread_task_runner.h" 17 #include "base/single_thread_task_runner.h"
18 #include "base/time/time.h" 18 #include "base/time/time.h"
19 #include "components/cronet/url_request_context_config.h" 19 #include "components/cronet/url_request_context_config.h"
20 #include "net/android/network_change_notifier_factory_android.h" 20 #include "net/android/network_change_notifier_factory_android.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 delegate_ = delegate; 119 delegate_ = delegate;
120 user_agent_ = user_agent; 120 user_agent_ = user_agent;
121 } 121 }
122 122
123 void URLRequestContextAdapter::Initialize( 123 void URLRequestContextAdapter::Initialize(
124 scoped_ptr<URLRequestContextConfig> config) { 124 scoped_ptr<URLRequestContextConfig> config) {
125 network_thread_ = new base::Thread("network"); 125 network_thread_ = new base::Thread("network");
126 base::Thread::Options options; 126 base::Thread::Options options;
127 options.message_loop_type = base::MessageLoop::TYPE_IO; 127 options.message_loop_type = base::MessageLoop::TYPE_IO;
128 network_thread_->StartWithOptions(options); 128 network_thread_->StartWithOptions(options);
129 config_ = config.Pass(); 129 config_ = std::move(config);
130 } 130 }
131 131
132 void URLRequestContextAdapter::InitRequestContextOnMainThread() { 132 void URLRequestContextAdapter::InitRequestContextOnMainThread() {
133 proxy_config_service_ = net::ProxyService::CreateSystemProxyConfigService( 133 proxy_config_service_ = net::ProxyService::CreateSystemProxyConfigService(
134 GetNetworkTaskRunner(), NULL); 134 GetNetworkTaskRunner(), NULL);
135 GetNetworkTaskRunner()->PostTask( 135 GetNetworkTaskRunner()->PostTask(
136 FROM_HERE, 136 FROM_HERE,
137 base::Bind(&URLRequestContextAdapter::InitRequestContextOnNetworkThread, 137 base::Bind(&URLRequestContextAdapter::InitRequestContextOnNetworkThread,
138 this)); 138 this));
139 } 139 }
140 140
141 void URLRequestContextAdapter::InitRequestContextOnNetworkThread() { 141 void URLRequestContextAdapter::InitRequestContextOnNetworkThread() {
142 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread()); 142 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread());
143 DCHECK(config_); 143 DCHECK(config_);
144 // TODO(mmenke): Add method to have the builder enable SPDY. 144 // TODO(mmenke): Add method to have the builder enable SPDY.
145 net::URLRequestContextBuilder context_builder; 145 net::URLRequestContextBuilder context_builder;
146 146
147 // TODO(mef): Remove this work around for crbug.com/543366 once it is fixed. 147 // TODO(mef): Remove this work around for crbug.com/543366 once it is fixed.
148 net::URLRequestContextBuilder::HttpNetworkSessionParams 148 net::URLRequestContextBuilder::HttpNetworkSessionParams
149 custom_http_network_session_params; 149 custom_http_network_session_params;
150 custom_http_network_session_params.use_alternative_services = false; 150 custom_http_network_session_params.use_alternative_services = false;
151 context_builder.set_http_network_session_params( 151 context_builder.set_http_network_session_params(
152 custom_http_network_session_params); 152 custom_http_network_session_params);
153 153
154 context_builder.set_network_delegate( 154 context_builder.set_network_delegate(
155 make_scoped_ptr(new BasicNetworkDelegate())); 155 make_scoped_ptr(new BasicNetworkDelegate()));
156 context_builder.set_proxy_config_service(proxy_config_service_.Pass()); 156 context_builder.set_proxy_config_service(std::move(proxy_config_service_));
157 config_->ConfigureURLRequestContextBuilder(&context_builder, nullptr); 157 config_->ConfigureURLRequestContextBuilder(&context_builder, nullptr);
158 158
159 context_ = context_builder.Build().Pass(); 159 context_ = context_builder.Build();
160 160
161 if (config_->enable_sdch) { 161 if (config_->enable_sdch) {
162 DCHECK(context_->sdch_manager()); 162 DCHECK(context_->sdch_manager());
163 sdch_owner_.reset( 163 sdch_owner_.reset(
164 new net::SdchOwner(context_->sdch_manager(), context_.get())); 164 new net::SdchOwner(context_->sdch_manager(), context_.get()));
165 } 165 }
166 166
167 // Currently (circa M39) enabling QUIC requires setting probability threshold. 167 // Currently (circa M39) enabling QUIC requires setting probability threshold.
168 if (config_->enable_quic) { 168 if (config_->enable_quic) {
169 context_->http_server_properties() 169 context_->http_server_properties()
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 base::FilePath file_path(file_name); 299 base::FilePath file_path(file_name);
300 base::ScopedFILE file(base::OpenFile(file_path, "w")); 300 base::ScopedFILE file(base::OpenFile(file_path, "w"));
301 if (!file) 301 if (!file)
302 return; 302 return;
303 303
304 write_to_file_observer_.reset(new net::WriteToFileNetLogObserver()); 304 write_to_file_observer_.reset(new net::WriteToFileNetLogObserver());
305 if (log_all) { 305 if (log_all) {
306 write_to_file_observer_->set_capture_mode( 306 write_to_file_observer_->set_capture_mode(
307 net::NetLogCaptureMode::IncludeSocketBytes()); 307 net::NetLogCaptureMode::IncludeSocketBytes());
308 } 308 }
309 write_to_file_observer_->StartObserving(context_->net_log(), file.Pass(), 309 write_to_file_observer_->StartObserving(context_->net_log(), std::move(file),
310 nullptr, context_.get()); 310 nullptr, context_.get());
311 } 311 }
312 312
313 void URLRequestContextAdapter::StopNetLogHelper() { 313 void URLRequestContextAdapter::StopNetLogHelper() {
314 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread()); 314 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread());
315 if (write_to_file_observer_) { 315 if (write_to_file_observer_) {
316 write_to_file_observer_->StopObserving(context_.get()); 316 write_to_file_observer_->StopObserving(context_.get());
317 write_to_file_observer_.reset(); 317 write_to_file_observer_.reset();
318 } 318 }
319 } 319 }
320 320
321 void NetLogObserver::OnAddEntry(const net::NetLog::Entry& entry) { 321 void NetLogObserver::OnAddEntry(const net::NetLog::Entry& entry) {
322 VLOG(2) << "Net log entry: type=" << entry.type() 322 VLOG(2) << "Net log entry: type=" << entry.type()
323 << ", source=" << entry.source().type << ", phase=" << entry.phase(); 323 << ", source=" << entry.source().type << ", phase=" << entry.phase();
324 } 324 }
325 325
326 } // namespace cronet 326 } // namespace cronet
OLDNEW
« no previous file with comments | « components/cronet/android/url_request_adapter.cc ('k') | components/cronet/url_request_context_config.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698