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

Unified Diff: chrome/browser/profiles/profile_impl_io_data.cc

Issue 734263003: Move data reduction proxy logic out of chrome and android webview network delegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding inits to DRPNetworkDelegate 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/profiles/profile_impl_io_data.cc
diff --git a/chrome/browser/profiles/profile_impl_io_data.cc b/chrome/browser/profiles/profile_impl_io_data.cc
index 04dbdf2f08675a2589d2f0052cfc43b596f92186..c4a5f90d64374e66ebfdb701a292c37ffedfcdc0 100644
--- a/chrome/browser/profiles/profile_impl_io_data.cc
+++ b/chrome/browser/profiles/profile_impl_io_data.cc
@@ -37,6 +37,7 @@
#include "chrome/common/url_constants.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_interceptor.h"
+#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_protocol.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_statistics_prefs.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.h"
@@ -414,9 +415,6 @@ ProfileImplIOData::ProfileImplIOData()
}
ProfileImplIOData::~ProfileImplIOData() {
- if (initialized())
- network_delegate()->set_domain_reliability_monitor(NULL);
-
DestroyResourceContext();
if (media_request_context_)
@@ -424,6 +422,7 @@ ProfileImplIOData::~ProfileImplIOData() {
}
void ProfileImplIOData::InitializeInternal(
+ scoped_ptr<ChromeNetworkDelegate> chrome_network_delegate,
mmenke 2014/12/03 18:50:38 This passing ownership back and forth seems weird:
megjablon 2014/12/04 01:23:46 I'm not sure I understand. Can you explain? If we
ProfileParams* profile_params,
content::ProtocolHandlerMap* protocol_handlers,
content::URLRequestInterceptorScopedVector request_interceptors) const {
@@ -432,6 +431,10 @@ void ProfileImplIOData::InitializeInternal(
IOThread* const io_thread = profile_params->io_thread;
IOThread::Globals* const io_thread_globals = io_thread->globals();
+ ChromeNetworkDelegate* chrome_network_delegate_ptr =
+ chrome_network_delegate.get();
+ Profile* profile = reinterpret_cast<Profile*>(profile_params->profile);
+
set_data_reduction_proxy_auth_request_handler(
scoped_ptr<data_reduction_proxy::DataReductionProxyAuthRequestHandler>
(new data_reduction_proxy::DataReductionProxyAuthRequestHandler(
@@ -446,24 +449,27 @@ void ProfileImplIOData::InitializeInternal(
.get())));
data_reduction_proxy_usage_stats()->set_unavailable_callback(
data_reduction_proxy_unavailable_callback());
-
- network_delegate()->set_data_reduction_proxy_enabled_pref(
- &data_reduction_proxy_enabled_);
- network_delegate()->set_data_reduction_proxy_params(
- data_reduction_proxy_params());
- network_delegate()->set_data_reduction_proxy_usage_stats(
- data_reduction_proxy_usage_stats());
- network_delegate()->set_data_reduction_proxy_auth_request_handler(
- data_reduction_proxy_auth_request_handler());
- network_delegate()->set_data_reduction_proxy_statistics_prefs(
- data_reduction_proxy_statistics_prefs());
- network_delegate()->set_on_resolve_proxy_handler(
+ scoped_ptr<data_reduction_proxy::DataReductionProxyNetworkDelegate>
+ data_reduction_proxy_network_delegate(
+ new data_reduction_proxy::DataReductionProxyNetworkDelegate(
+ chrome_network_delegate.Pass(),
+ data_reduction_proxy_params(),
+ data_reduction_proxy_auth_request_handler(),
+ base::Bind(
+ &DataReductionProxyChromeConfigurator::GetProxyConfigOnIOThread,
+ base::Unretained(data_reduction_proxy_chrome_configurator()))));
+ data_reduction_proxy_network_delegate->InitProxyConfigOverrides(
base::Bind(data_reduction_proxy::OnResolveProxyHandler));
- network_delegate()->set_proxy_config_getter(
- base::Bind(
- &DataReductionProxyChromeConfigurator::GetProxyConfigOnIOThread,
- base::Unretained(data_reduction_proxy_chrome_configurator())));
- network_delegate()->set_predictor(predictor_.get());
+ data_reduction_proxy_network_delegate->InitStatisticsPrefs(
+ profile->GetPrefs(),
mmenke 2014/12/03 18:50:38 BUG: We're on the IO thread. it's not safe to de
megjablon 2014/12/04 01:23:46 Done.
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI),
+ data_reduction_proxy_statistics_prefs());
+ data_reduction_proxy_network_delegate->InitStatisticsUMA(
+ &data_reduction_proxy_enabled_,
+ data_reduction_proxy_usage_stats());
+ set_network_delegate(data_reduction_proxy_network_delegate.Pass());
+
+ chrome_network_delegate_ptr->set_predictor(predictor_.get());
mmenke 2014/12/03 18:50:38 Can this just be moved to where chrome_network_del
megjablon 2014/12/04 01:23:46 Done.
// Initialize context members.
@@ -611,7 +617,7 @@ void ProfileImplIOData::InitializeInternal(
monitor->InitURLRequestContext(main_context);
monitor->AddBakedInConfigs();
monitor->SetDiscardUploads(!GetMetricsEnabledStateOnIOThread());
- network_delegate()->set_domain_reliability_monitor(monitor);
+ chrome_network_delegate_ptr->set_domain_reliability_monitor(monitor);
mmenke 2014/12/03 18:50:38 Again, think it's simpler if we can just move this
megjablon 2014/12/04 01:23:46 Done.
}
lazy_params_.reset();

Powered by Google App Engine
This is Rietveld 408576698