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

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

Issue 1802893002: Revert of Remove support for Alt-Svc/Alternate Protocol Probability (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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/cronet_url_request_context_adapter.h" 5 #include "components/cronet/android/cronet_url_request_context_adapter.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <map> 9 #include <map>
10 #include <utility> 10 #include <utility>
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 if (config->enable_sdch) { 477 if (config->enable_sdch) {
478 DCHECK(context_->sdch_manager()); 478 DCHECK(context_->sdch_manager());
479 sdch_owner_.reset( 479 sdch_owner_.reset(
480 new net::SdchOwner(context_->sdch_manager(), context_.get())); 480 new net::SdchOwner(context_->sdch_manager(), context_.get()));
481 if (json_pref_store_) { 481 if (json_pref_store_) {
482 sdch_owner_->EnablePersistentStorage( 482 sdch_owner_->EnablePersistentStorage(
483 make_scoped_ptr(new SdchOwnerPrefStorage(json_pref_store_.get()))); 483 make_scoped_ptr(new SdchOwnerPrefStorage(json_pref_store_.get())));
484 } 484 }
485 } 485 }
486 486
487 // Currently (circa M39) enabling QUIC requires setting probability threshold.
487 if (config->enable_quic) { 488 if (config->enable_quic) {
489 context_->http_server_properties()
490 ->SetAlternativeServiceProbabilityThreshold(0.0f);
488 for (auto hint = config->quic_hints.begin(); 491 for (auto hint = config->quic_hints.begin();
489 hint != config->quic_hints.end(); ++hint) { 492 hint != config->quic_hints.end(); ++hint) {
490 const URLRequestContextConfig::QuicHint& quic_hint = **hint; 493 const URLRequestContextConfig::QuicHint& quic_hint = **hint;
491 if (quic_hint.host.empty()) { 494 if (quic_hint.host.empty()) {
492 LOG(ERROR) << "Empty QUIC hint host: " << quic_hint.host; 495 LOG(ERROR) << "Empty QUIC hint host: " << quic_hint.host;
493 continue; 496 continue;
494 } 497 }
495 498
496 url::CanonHostInfo host_info; 499 url::CanonHostInfo host_info;
497 std::string canon_host(net::CanonicalizeHost(quic_hint.host, &host_info)); 500 std::string canon_host(net::CanonicalizeHost(quic_hint.host, &host_info));
(...skipping 16 matching lines...) Expand all
514 << quic_hint.alternate_port; 517 << quic_hint.alternate_port;
515 continue; 518 continue;
516 } 519 }
517 520
518 net::HostPortPair quic_hint_host_port_pair(canon_host, 521 net::HostPortPair quic_hint_host_port_pair(canon_host,
519 quic_hint.port); 522 quic_hint.port);
520 net::AlternativeService alternative_service( 523 net::AlternativeService alternative_service(
521 net::AlternateProtocol::QUIC, "", 524 net::AlternateProtocol::QUIC, "",
522 static_cast<uint16_t>(quic_hint.alternate_port)); 525 static_cast<uint16_t>(quic_hint.alternate_port));
523 context_->http_server_properties()->SetAlternativeService( 526 context_->http_server_properties()->SetAlternativeService(
524 quic_hint_host_port_pair, alternative_service, base::Time::Max()); 527 quic_hint_host_port_pair, alternative_service, 1.0f,
528 base::Time::Max());
525 } 529 }
526 } 530 }
527 531
528 // Iterate through PKP configuration for every host. 532 // Iterate through PKP configuration for every host.
529 for (const auto& pkp : config->pkp_list) { 533 for (const auto& pkp : config->pkp_list) {
530 // Add the host pinning. 534 // Add the host pinning.
531 context_->transport_security_state()->AddHPKP( 535 context_->transport_security_state()->AddHPKP(
532 pkp->host, pkp->expiration_date, pkp->include_subdomains, 536 pkp->host, pkp->expiration_date, pkp->include_subdomains,
533 pkp->pin_hashes, GURL::EmptyGURL()); 537 pkp->pin_hashes, GURL::EmptyGURL());
534 } 538 }
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 JNIEnv* env, 803 JNIEnv* env,
800 const JavaParamRef<jclass>& jcaller) { 804 const JavaParamRef<jclass>& jcaller) {
801 base::StatisticsRecorder::Initialize(); 805 base::StatisticsRecorder::Initialize();
802 std::vector<uint8_t> data; 806 std::vector<uint8_t> data;
803 if (!HistogramManager::GetInstance()->GetDeltas(&data)) 807 if (!HistogramManager::GetInstance()->GetDeltas(&data))
804 return ScopedJavaLocalRef<jbyteArray>(); 808 return ScopedJavaLocalRef<jbyteArray>();
805 return base::android::ToJavaByteArray(env, &data[0], data.size()); 809 return base::android::ToJavaByteArray(env, &data[0], data.size());
806 } 810 }
807 811
808 } // namespace cronet 812 } // namespace cronet
OLDNEW
« no previous file with comments | « chrome/common/chrome_switches.cc ('k') | components/cronet/android/url_request_context_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698