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

Unified Diff: components/data_reduction_proxy/core/common/data_reduction_proxy_params.cc

Issue 903213003: Enable QUIC for proxies based on Finch config and command line switch. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added comment Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: components/data_reduction_proxy/core/common/data_reduction_proxy_params.cc
diff --git a/components/data_reduction_proxy/core/common/data_reduction_proxy_params.cc b/components/data_reduction_proxy/core/common/data_reduction_proxy_params.cc
index 9bbec293aded2d89d81a33c6316a726dc2c43c77..b3422c8e19f5fed545831203b13020ac027bc4b8 100644
--- a/components/data_reduction_proxy/core/common/data_reduction_proxy_params.cc
+++ b/components/data_reduction_proxy/core/common/data_reduction_proxy_params.cc
@@ -30,7 +30,8 @@ using base::FieldTrialList;
namespace {
const char kEnabled[] = "Enabled";
-const char kDefaultOrigin[] = "https://proxy.googlezip.net:443";
+const char kDefaultSpdyOrigin[] = "https://proxy.googlezip.net:443";
+const char kDefaultQuicOrigin[] = "quic://proxy.googlezip.net:443";
const char kDevOrigin[] = "https://proxy-dev.googlezip.net:443";
const char kDevFallbackOrigin[] = "proxy-dev.googlezip.net:80";
const char kDefaultFallbackOrigin[] = "compress.googlezip.net:80";
@@ -44,6 +45,8 @@ const char kDefaultProbeUrl[] = "http://check.googlezip.net/connect";
const char kDefaultWarmupUrl[] = "http://www.gstatic.com/generate_204";
const char kAndroidOneIdentifier[] = "sprout";
+
+const char kQuicFieldTrial[] = "DataReductionProxyUseQuic";
} // namespace
namespace data_reduction_proxy {
@@ -120,6 +123,24 @@ bool DataReductionProxyParams::CanProxyURLScheme(const GURL& url) {
return url.SchemeIs(url::kHttpScheme);
}
+// static
+bool DataReductionProxyParams::IsIncludedInQuicFieldTrial() {
+ return FieldTrialList::FindFullName(kQuicFieldTrial) == kEnabled;
+}
+
+// static
+std::string DataReductionProxyParams::GetQuicFieldTrialName() {
+ return kQuicFieldTrial;
+}
+
+void DataReductionProxyParams::EnableQuic(bool enable) {
+ quic_enabled_ = enable;
+ DCHECK(!quic_enabled_ || IsIncludedInQuicFieldTrial());
+ if (override_quic_origin_.empty() && quic_enabled_)
+ origin_ = net::ProxyServer::FromURI(kDefaultQuicOrigin,
+ net::ProxyServer::SCHEME_HTTP);
+}
+
DataReductionProxyTypeInfo::DataReductionProxyTypeInfo()
: proxy_servers(),
is_fallback(false),
@@ -138,6 +159,7 @@ DataReductionProxyParams::DataReductionProxyParams(int flags)
(flags & kAlternativeFallbackAllowed) == kAlternativeFallbackAllowed),
promo_allowed_((flags & kPromoAllowed) == kPromoAllowed),
holdback_((flags & kHoldback) == kHoldback),
+ quic_enabled_(false),
configured_on_command_line_(false) {
bool result = Init(
allowed_, fallback_allowed_, alt_allowed_, alt_fallback_allowed_);
@@ -164,6 +186,8 @@ DataReductionProxyParams::DataReductionProxyParams(
alt_fallback_allowed_(other.alt_fallback_allowed_),
promo_allowed_(other.promo_allowed_),
holdback_(other.holdback_),
+ quic_enabled_(other.quic_enabled_),
+ override_quic_origin_(other.override_quic_origin_),
configured_on_command_line_(other.configured_on_command_line_) {
}
@@ -196,6 +220,7 @@ DataReductionProxyParams::DataReductionProxyParams(int flags,
(flags & kAlternativeFallbackAllowed) == kAlternativeFallbackAllowed),
promo_allowed_((flags & kPromoAllowed) == kPromoAllowed),
holdback_((flags & kHoldback) == kHoldback),
+ quic_enabled_(false),
configured_on_command_line_(false) {
if (should_call_init) {
bool result = Init(
@@ -314,6 +339,7 @@ void DataReductionProxyParams::InitWithoutChecks() {
// command line.
if (origin.empty())
origin = GetDefaultDevOrigin();
+ override_quic_origin_ = origin;
if (origin.empty())
origin = GetDefaultOrigin();
if (fallback_origin.empty())
@@ -542,7 +568,8 @@ bool DataReductionProxyParams::IsProxyBypassed(
// TODO(kundaji): Remove tests for macro definitions.
std::string DataReductionProxyParams::GetDefaultOrigin() const {
- return kDefaultOrigin;
+ return quic_enabled_ ?
+ kDefaultQuicOrigin : kDefaultSpdyOrigin;
}
std::string DataReductionProxyParams::GetDefaultFallbackOrigin() const {
« no previous file with comments | « components/data_reduction_proxy/core/common/data_reduction_proxy_params.h ('k') | net/http/http_network_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698