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

Unified Diff: chrome/browser/io_thread.cc

Issue 778463002: Wrapped data reduction proxy initialization into its own class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@network-delegate
Patch Set: Created 6 years 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 094d043fadbde49b79e8441815d93fd4076f0742..44404fafc046405bceccfceee1447fd9c397197b 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -35,19 +35,14 @@
#include "chrome/browser/net/dns_probe_service.h"
#include "chrome/browser/net/pref_proxy_config_tracker.h"
#include "chrome/browser/net/proxy_service_factory.h"
-#include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h"
-#include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_factory.h"
+#include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_io_data.h"
#include "chrome/common/chrome_content_client.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_version_info.h"
#include "chrome/common/pref_names.h"
-#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_auth_request_handler.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_delegate.h"
-#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.h"
+#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_prefs.h"
-#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_protocol.h"
-#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.h"
-#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h"
#include "components/policy/core/common/policy_service.h"
#include "components/variations/variations_associated_data.h"
#include "content/public/browser/browser_thread.h"
@@ -597,19 +592,20 @@ void IOThread::InitAsync() {
chrome_network_delegate->NeverThrottleRequests();
#endif
- SetupDataReductionProxy();
+ globals_->data_reduction_proxy_io_data =
+ CreateDataReductionProxyChromeIODataForSystem(
+ net_log_,
+ nullptr, /* PrefServiceSyncable */
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
+ BrowserThread::GetMessageLoopProxyForThread(
+ BrowserThread::UI)).Pass();
- // This is the same as in ProfileImplIOData except that it does not collect
- // usage stats.
- data_reduction_proxy::DataReductionProxyNetworkDelegate* network_delegate =
- new data_reduction_proxy::DataReductionProxyNetworkDelegate(
- chrome_network_delegate.Pass(),
- globals_->data_reduction_proxy_params.get(),
- globals_->data_reduction_proxy_auth_request_handler.get(),
- data_reduction_proxy::DataReductionProxyNetworkDelegate::
- ProxyConfigGetter());
+ globals_->data_reduction_proxy_io_data->Init(
+ chrome_network_delegate.Pass(),
+ false, false, true);
- globals_->system_network_delegate.reset(network_delegate);
+ globals_->system_network_delegate.reset(
+ globals_->data_reduction_proxy_io_data->network_delegate());
mmenke 2014/12/17 21:37:22 BUG: You're storing the DRP's network delegate in
bengr 2014/12/19 20:05:57 Uggh. Thanks for catching this. I didn't do what y
globals_->host_resolver = CreateGlobalHostResolver(net_log_);
UpdateDnsClientEnabled();
#if defined(OS_CHROMEOS)
@@ -1065,7 +1061,8 @@ void IOThread::InitializeNetworkSessionParamsFromGlobals(
&params->origin_to_force_quic_on);
params->enable_user_alternate_protocol_ports =
globals.enable_user_alternate_protocol_ports;
- params->proxy_delegate = globals.data_reduction_proxy_delegate.get();
+ params->proxy_delegate =
+ globals.data_reduction_proxy_io_data->proxy_delegate();
}
base::TimeTicks IOThread::creation_time() const {
@@ -1118,7 +1115,7 @@ void IOThread::InitSystemRequestContextOnIOThread() {
system_proxy_config_service_.release(),
command_line,
quick_check_enabled_.GetValue()));
- DCHECK(globals_->data_reduction_proxy_params);
+ DCHECK(globals_->data_reduction_proxy_io_data);
net::HttpNetworkSession::Params system_params;
InitializeNetworkSessionParams(&system_params);
@@ -1156,34 +1153,6 @@ void IOThread::ConfigureQuic(const CommandLine& command_line) {
ConfigureQuicGlobals(command_line, group, params, globals_);
}
-void IOThread::SetupDataReductionProxy() {
- // TODO(kundaji): Move flags initialization to DataReductionProxyParams and
- // merge with flag initialization in
- // data_reduction_proxy_chrome_settings_factory.cc.
- int flags = data_reduction_proxy::DataReductionProxyParams::kAllowed |
- data_reduction_proxy::DataReductionProxyParams::kFallbackAllowed |
- 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(),
- globals_->data_reduction_proxy_params.get(),
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)));
- globals_->data_reduction_proxy_delegate.reset(
- new data_reduction_proxy::DataReductionProxyDelegate(
- globals_->data_reduction_proxy_auth_request_handler.get(),
- globals_->data_reduction_proxy_params.get()));
-}
-
// static
void IOThread::ConfigureQuicGlobals(
const base::CommandLine& command_line,

Powered by Google App Engine
This is Rietveld 408576698