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

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, 4 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 7726fcf5524bddfd32c81c0fd5b953f5d32749a3..163354913708a312784e1fca758ca54802bcefbb 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"
@@ -97,13 +101,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"
@@ -542,6 +539,38 @@ void IOThread::Init() {
// the UI thread
}
+void IOThread::SetupDataReductionProxy(
+ ChromeNetworkDelegate* network_delegate) {
+ int flags = data_reduction_proxy::DataReductionProxyParams::kAllowed |
+ data_reduction_proxy::DataReductionProxyParams::kFallbackAllowed;
Ryan Sleevi 2014/08/28 17:21:01 Reformat
Not at Google. Contact bengr 2014/08/28 18:59:27 Done.
+ 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;
+ 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(),
+ DataReductionProxyChromeSettings::GetBuildAndPatchNumber(),
+ 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));
+}
+
void IOThread::InitAsync() {
TRACE_EVENT0("startup", "IOThread::InitAsync");
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
@@ -635,44 +664,7 @@ void IOThread::InitAsync() {
}
#endif
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(),
- DataReductionProxyChromeSettings::GetBuildAndPatchNumber(),
- 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());
@@ -1110,6 +1102,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);

Powered by Google App Engine
This is Rietveld 408576698