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

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

Issue 2453973003: Add a QUIC proxy server to the list of QUIC servers supported at start up (Closed)
Patch Set: Created 4 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 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 a16e7149ce804e8184f8270707607fae49c78b41..7392f2364e7f820916f52c89fc5cf71b3db7b455 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
@@ -4,6 +4,7 @@
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h"
+#include <map>
#include <string>
#include <vector>
@@ -60,6 +61,18 @@ bool IsIncludedInFieldTrial(const std::string& name) {
base::CompareCase::SENSITIVE);
}
+// Returns the variation value for |parameter_name|. If the value is
+// unavailable, |default_value| is returned.
+std::string GetStringValueForVariationParamWithDefaultValue(
+ const std::map<std::string, std::string>& variation_params,
+ const std::string& parameter_name,
+ const std::string& default_value) {
+ const auto it = variation_params.find(parameter_name);
+ if (it == variation_params.end())
+ return default_value;
+ return it->second;
+}
+
} // namespace
namespace data_reduction_proxy {
@@ -185,6 +198,15 @@ const char* GetQuicFieldTrialName() {
return kQuicFieldTrial;
}
+bool IsZeroRttQuicEnabled() {
+ if (!IsIncludedInQuicFieldTrial())
+ return false;
+ std::map<std::string, std::string> params;
+ variations::GetVariationParams(GetQuicFieldTrialName(), &params);
+ return GetStringValueForVariationParamWithDefaultValue(
+ params, "enable_zero_rtt", "false") == "true";
+}
+
bool IsConfigClientEnabled() {
// Config client is enabled by default. It can be disabled only if Chromium
// belongs to a field trial group whose name starts with "Disabled".

Powered by Google App Engine
This is Rietveld 408576698