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

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: Addressed comments and removed code duplication. 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 4f0ca9a060c10bd51ab4567e1bbf06e50d52d701..aad68ec387687f886aa9e3de0d6b445e8529a066 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";
@@ -98,6 +99,20 @@ bool DataReductionProxyParams::IsIncludedInAndroidOnePromoFieldTrial(
return (fingerprint.find(kAndroidOneIdentifier) != std::string::npos);
}
+// static
+bool DataReductionProxyParams::IsIncludedInUseQUICFieldTrial() {
+ return FieldTrialList::FindFullName("DataReductionProxyUseQuic") == kEnabled;
+}
+
+void DataReductionProxyParams::SetIsQuicEnabledForProxies(
+ bool quic_enabled_for_proxies) {
+ quic_enabled_for_proxies_ = quic_enabled_for_proxies;
+ if (command_line_origin_.empty() && IsIncludedInUseQUICFieldTrial() &&
bengr 2015/02/10 20:18:31 I don't think you want to check if you're in the f
tbansal1 2015/02/10 22:24:38 I need to: quic_enabled_for_proxies_ can be true i
+ quic_enabled_for_proxies_)
+ origin_ = net::ProxyServer::FromURI(kDefaultQuicOrigin,
+ net::ProxyServer::SCHEME_HTTP);
+}
+
DataReductionProxyTypeInfo::DataReductionProxyTypeInfo()
: proxy_servers(),
is_fallback(false),
@@ -274,6 +289,7 @@ void DataReductionProxyParams::InitWithoutChecks() {
!(origin.empty() && fallback_origin.empty() && ssl_origin.empty() &&
alt_origin.empty() && alt_fallback_origin.empty());
+ // quic_globally_disabled_ = command_line.HasSwitch(switches::kDisableQuic);
bengr 2015/02/10 20:18:31 Remove dead code.
tbansal1 2015/02/10 22:24:38 Done.
// Configuring the proxy on the command line overrides the values of
// |allowed_| and |alt_allowed_|.
@@ -290,8 +306,12 @@ void DataReductionProxyParams::InitWithoutChecks() {
// Set from preprocessor constants those params that are not specified on the
// command line.
+ LOG(WARNING) << "InitWithoutChecks origin.empty()=" << origin.empty()
bengr 2015/02/10 20:18:31 Remove this logging. If you need it, don't use WAR
tbansal1 2015/02/10 22:24:38 Done.
+ << " GetDefaultDevOrigin()=" << GetDefaultDevOrigin();
+
if (origin.empty())
origin = GetDefaultDevOrigin();
+ command_line_origin_ = origin;
if (origin.empty())
origin = GetDefaultOrigin();
if (fallback_origin.empty())
@@ -520,7 +540,9 @@ bool DataReductionProxyParams::IsProxyBypassed(
// TODO(kundaji): Remove tests for macro definitions.
std::string DataReductionProxyParams::GetDefaultOrigin() const {
- return kDefaultOrigin;
+ return IsIncludedInUseQUICFieldTrial() && quic_enabled_for_proxies_
bengr 2015/02/10 20:18:31 Don't check the field trial here.
tbansal1 2015/02/10 22:24:38 see above.
+ ? kDefaultQuicOrigin
+ : kDefaultSpdyOrigin;
}
std::string DataReductionProxyParams::GetDefaultFallbackOrigin() const {

Powered by Google App Engine
This is Rietveld 408576698