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

Unified Diff: chrome/browser/io_thread.cc

Issue 382313003: Add data reduction functionality to all platforms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync to head Created 6 years, 3 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: chrome/browser/io_thread.cc
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index 3abfe74886bc1a3f0d374a5134350a90736bafee..367b8b2e75ef9f05a2a1189a806de01fdee5c7c1 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -39,7 +39,11 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_version_info.h"
#include "chrome/common/pref_names.h"
+#include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler.h"
+#include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h"
#include "components/data_reduction_proxy/browser/data_reduction_proxy_prefs.h"
+#include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol.h"
+#include "components/data_reduction_proxy/browser/data_reduction_proxy_settings.h"
#include "components/policy/core/common/policy_service.h"
#include "components/variations/variations_associated_data.h"
#include "content/public/browser/browser_thread.h"
@@ -94,13 +98,6 @@
#include "net/ocsp/nss_ocsp.h"
#endif
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
-#include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h"
-#include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_factory.h"
-#include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler.h"
-#include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol.h"
-#endif // defined(SPDY_PROXY_AUTH_ORIGIN)
-
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/net/cert_verify_proc_chromeos.h"
#include "chromeos/network/host_resolver_impl_chromeos.h"
@@ -625,44 +622,7 @@ void IOThread::InitAsync() {
}
globals_->ssl_config_service = GetSSLConfigService();
-
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
- int drp_flags = 0;
- if (data_reduction_proxy::DataReductionProxyParams::
- IsIncludedInFieldTrial()) {
- drp_flags |=
- (data_reduction_proxy::DataReductionProxyParams::kAllowed |
- data_reduction_proxy::DataReductionProxyParams::kFallbackAllowed);
- }
- if (data_reduction_proxy::DataReductionProxyParams::
- IsIncludedInAlternativeFieldTrial()) {
- drp_flags |=
- data_reduction_proxy::DataReductionProxyParams::kAlternativeAllowed;
- }
- if (data_reduction_proxy::DataReductionProxyParams::
- IsIncludedInPromoFieldTrial())
- drp_flags |= data_reduction_proxy::DataReductionProxyParams::kPromoAllowed;
- if (data_reduction_proxy::DataReductionProxyParams::
- IsIncludedInHoldbackFieldTrial())
- drp_flags |= data_reduction_proxy::DataReductionProxyParams::kHoldback;
- globals_->data_reduction_proxy_params.reset(
- new data_reduction_proxy::DataReductionProxyParams(drp_flags));
- globals_->data_reduction_proxy_auth_request_handler.reset(
- new data_reduction_proxy::DataReductionProxyAuthRequestHandler(
- DataReductionProxyChromeSettings::GetClient(),
- chrome::VersionInfo().Version(),
- globals_->data_reduction_proxy_params.get(),
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)));
- // This is the same as in ProfileImplIOData except that we do not collect
- // usage stats.
- network_delegate->set_data_reduction_proxy_params(
- globals_->data_reduction_proxy_params.get());
- network_delegate->set_data_reduction_proxy_auth_request_handler(
- globals_->data_reduction_proxy_auth_request_handler.get());
- network_delegate->set_on_resolve_proxy_handler(
- base::Bind(data_reduction_proxy::OnResolveProxyHandler));
-#endif // defined(SPDY_PROXY_AUTH_ORIGIN)
-
+ SetupDataReductionProxy(network_delegate);
globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory(
globals_->host_resolver.get()));
globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl());
@@ -1102,6 +1062,7 @@ void IOThread::InitSystemRequestContextOnIOThread() {
system_proxy_config_service_.release(),
command_line,
quick_check_enabled_.GetValue()));
+ DCHECK(globals_->data_reduction_proxy_params);
net::HttpNetworkSession::Params system_params;
InitializeNetworkSessionParams(&system_params);
@@ -1139,6 +1100,41 @@ void IOThread::ConfigureQuic(const CommandLine& command_line) {
ConfigureQuicGlobals(command_line, group, params, globals_);
}
+void IOThread::SetupDataReductionProxy(
+ ChromeNetworkDelegate* network_delegate) {
+ int flags = data_reduction_proxy::DataReductionProxyParams::kAllowed |
+ data_reduction_proxy::DataReductionProxyParams::kFallbackAllowed;
+ if (data_reduction_proxy::DataReductionProxyParams::
+ IsIncludedInAlternativeFieldTrial()) {
+ flags |=
+ data_reduction_proxy::DataReductionProxyParams::kAlternativeAllowed;
+ }
+ if (data_reduction_proxy::DataReductionProxyParams::
+ IsIncludedInPromoFieldTrial()) {
+ flags |= data_reduction_proxy::DataReductionProxyParams::kPromoAllowed;
+ }
+ if (data_reduction_proxy::DataReductionProxyParams::
+ IsIncludedInHoldbackFieldTrial()) {
+ flags |= data_reduction_proxy::DataReductionProxyParams::kHoldback;
+ }
mmenke 2014/09/08 18:11:14 Should all this fieldtrial / flags stuff be moved
Not at Google. Contact bengr 2014/09/08 19:18:34 Added a TODO. I don't see any reason for it to be
+ globals_->data_reduction_proxy_params.reset(
+ new data_reduction_proxy::DataReductionProxyParams(flags));
+ globals_->data_reduction_proxy_auth_request_handler.reset(
+ new data_reduction_proxy::DataReductionProxyAuthRequestHandler(
+ DataReductionProxyChromeSettings::GetClient(),
+ chrome::VersionInfo().Version(),
+ globals_->data_reduction_proxy_params.get(),
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)));
+ // This is the same as in ProfileImplIOData except that we do not collect
+ // usage stats.
+ network_delegate->set_data_reduction_proxy_params(
+ globals_->data_reduction_proxy_params.get());
+ network_delegate->set_data_reduction_proxy_auth_request_handler(
+ globals_->data_reduction_proxy_auth_request_handler.get());
+ network_delegate->set_on_resolve_proxy_handler(
+ base::Bind(data_reduction_proxy::OnResolveProxyHandler));
+}
+
// static
void IOThread::ConfigureQuicGlobals(
const base::CommandLine& command_line,

Powered by Google App Engine
This is Rietveld 408576698