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

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

Issue 1389213003: [Cronet] Use Https for Quic Test Server (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ryancl
Patch Set: Adopt suggestion Created 5 years, 2 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 <limits> 7 #include <limits>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 127
128 void URLRequestContextAdapter::InitRequestContextOnMainThread() { 128 void URLRequestContextAdapter::InitRequestContextOnMainThread() {
129 proxy_config_service_ = net::ProxyService::CreateSystemProxyConfigService( 129 proxy_config_service_ = net::ProxyService::CreateSystemProxyConfigService(
130 GetNetworkTaskRunner(), NULL); 130 GetNetworkTaskRunner(), NULL);
131 GetNetworkTaskRunner()->PostTask( 131 GetNetworkTaskRunner()->PostTask(
132 FROM_HERE, 132 FROM_HERE,
133 base::Bind(&URLRequestContextAdapter::InitRequestContextOnNetworkThread, 133 base::Bind(&URLRequestContextAdapter::InitRequestContextOnNetworkThread,
134 this)); 134 this));
135 } 135 }
136 136
137 void URLRequestContextAdapter::SetMockCertVerifierForTesting(
138 net::CertVerifier* cert_verifier) {
139 DCHECK(!GetNetworkTaskRunner()->BelongsToCurrentThread());
140 // Not using RunTaskAfterContextInitOnNetworkThread so verifier can be set
141 // before the context is initialized.
142 GetNetworkTaskRunner()->PostTask(
143 FROM_HERE, base::Bind(&URLRequestContextAdapter::
144 SetMockCertVerifierForTestingOnNetworkThread,
145 base::Unretained(this), cert_verifier));
146 }
147
148 void URLRequestContextAdapter::SetMockCertVerifierForTestingOnNetworkThread(
149 net::CertVerifier* cert_verifier) {
150 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread());
151 DCHECK(!context_builder_);
152
153 context_builder_.reset(new net::URLRequestContextBuilder);
154 context_builder_->set_cert_verifier(cert_verifier);
155 }
156
137 void URLRequestContextAdapter::InitRequestContextOnNetworkThread() { 157 void URLRequestContextAdapter::InitRequestContextOnNetworkThread() {
138 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread()); 158 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread());
139 DCHECK(config_); 159 DCHECK(config_);
140 // TODO(mmenke): Add method to have the builder enable SPDY. 160 // TODO(mmenke): Add method to have the builder enable SPDY.
141 net::URLRequestContextBuilder context_builder; 161 if (!context_builder_)
142 context_builder.set_network_delegate( 162 context_builder_.reset(new net::URLRequestContextBuilder());
163 context_builder_->set_network_delegate(
143 make_scoped_ptr(new BasicNetworkDelegate())); 164 make_scoped_ptr(new BasicNetworkDelegate()));
144 context_builder.set_proxy_config_service(proxy_config_service_.Pass()); 165 context_builder_->set_proxy_config_service(proxy_config_service_.Pass());
145 config_->ConfigureURLRequestContextBuilder(&context_builder); 166 config_->ConfigureURLRequestContextBuilder(context_builder_.get());
146 167
147 context_ = context_builder.Build().Pass(); 168 context_ = context_builder_->Build().Pass();
148 169
149 if (config_->enable_sdch) { 170 if (config_->enable_sdch) {
150 DCHECK(context_->sdch_manager()); 171 DCHECK(context_->sdch_manager());
151 sdch_owner_.reset( 172 sdch_owner_.reset(
152 new net::SdchOwner(context_->sdch_manager(), context_.get())); 173 new net::SdchOwner(context_->sdch_manager(), context_.get()));
153 } 174 }
154 175
155 // Currently (circa M39) enabling QUIC requires setting probability threshold. 176 // Currently (circa M39) enabling QUIC requires setting probability threshold.
156 if (config_->enable_quic) { 177 if (config_->enable_quic) {
157 context_->http_server_properties() 178 context_->http_server_properties()
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 write_to_file_observer_.reset(); 326 write_to_file_observer_.reset();
306 } 327 }
307 } 328 }
308 329
309 void NetLogObserver::OnAddEntry(const net::NetLog::Entry& entry) { 330 void NetLogObserver::OnAddEntry(const net::NetLog::Entry& entry) {
310 VLOG(2) << "Net log entry: type=" << entry.type() 331 VLOG(2) << "Net log entry: type=" << entry.type()
311 << ", source=" << entry.source().type << ", phase=" << entry.phase(); 332 << ", source=" << entry.source().type << ", phase=" << entry.phase();
312 } 333 }
313 334
314 } // namespace cronet 335 } // namespace cronet
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698