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

Unified Diff: android_webview/browser/aw_browser_context.cc

Issue 893003002: Data Reduction Proxy class ownership updates and Settings cleanup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 10 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: android_webview/browser/aw_browser_context.cc
diff --git a/android_webview/browser/aw_browser_context.cc b/android_webview/browser/aw_browser_context.cc
index d113d74e23d3dac2ebfdae2bfcf399f3ac6bad4a..04ccac921ecdfb82c4fbf16ad2b88e1dcbb07c1a 100644
--- a/android_webview/browser/aw_browser_context.cc
+++ b/android_webview/browser/aw_browser_context.cc
@@ -20,7 +20,9 @@
#include "components/autofill/core/common/autofill_pref_names.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_service.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.h"
+#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_statistics_prefs.h"
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h"
#include "components/user_prefs/user_prefs.h"
#include "components/visitedlink/browser/visitedlink_master.h"
@@ -156,24 +158,21 @@ void AwBrowserContext::PreMainMessageLoopRun() {
cache_path, cookie_store_.get(),
make_scoped_ptr(CreateProxyConfigService()).Pass());
- data_reduction_proxy_settings_.reset(
- new data_reduction_proxy::DataReductionProxySettings(
- scoped_ptr<data_reduction_proxy::DataReductionProxyParams>(
- new data_reduction_proxy::DataReductionProxyParams(
- data_reduction_proxy::DataReductionProxyParams::kAllowed))
- .Pass()));
data_reduction_proxy_io_data_.reset(
new data_reduction_proxy::DataReductionProxyIOData(
data_reduction_proxy::Client::WEBVIEW_ANDROID,
- scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs>(),
- data_reduction_proxy_settings_.get(),
+ data_reduction_proxy::DataReductionProxyParams::kAllowed,
url_request_context_getter_->GetNetLog(),
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
- BrowserThread::GetMessageLoopProxyForThread(
- BrowserThread::UI)));
- data_reduction_proxy_io_data_->Init();
- data_reduction_proxy_settings_->SetProxyConfigurator(
- data_reduction_proxy_io_data_->configurator());
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI)));
+ data_reduction_proxy_settings_.reset(
+ new data_reduction_proxy::DataReductionProxySettings());
+ data_reduction_proxy_service_.reset(
+ new data_reduction_proxy::DataReductionProxyService(
+ scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs>(),
+ data_reduction_proxy_settings_.get(), GetAwURLRequestContext()));
+ data_reduction_proxy_io_data_->SetDataReductionProxyService(
+ data_reduction_proxy_service_->GetWeakPtr());
visitedlink_master_.reset(
new visitedlink::VisitedLinkMaster(this, this, false));
@@ -233,11 +232,6 @@ AwBrowserContext::GetDataReductionProxyIOData() {
return data_reduction_proxy_io_data_.get();
}
-data_reduction_proxy::DataReductionProxyConfigurator*
-AwBrowserContext::GetDataReductionProxyConfigurator() {
- return data_reduction_proxy_io_data_->configurator();
-}
-
AwURLRequestContextGetter* AwBrowserContext::GetAwURLRequestContext() {
return url_request_context_getter_.get();
}
@@ -276,11 +270,8 @@ void AwBrowserContext::CreateUserPrefServiceIfNecessary() {
if (data_reduction_proxy_settings_) {
data_reduction_proxy_settings_->InitDataReductionProxySettings(
- user_pref_service_.get(),
- scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs>(),
- GetRequestContext(),
- GetAwURLRequestContext()->GetNetLog(),
- data_reduction_proxy_io_data_->event_store());
+ user_pref_service_.get(), data_reduction_proxy_io_data_.get(),
+ data_reduction_proxy_service_.Pass());
data_reduction_proxy_settings_->MaybeActivateDataReductionProxy(true);
SetDataReductionProxyEnabled(data_reduction_proxy_enabled_);
@@ -375,16 +366,17 @@ void AwBrowserContext::RebuildTable(
void AwBrowserContext::CreateDataReductionProxyStatisticsIfNecessary() {
DCHECK(user_pref_service_.get());
DCHECK(GetDataReductionProxySettings());
- if (GetDataReductionProxySettings()->statistics_prefs())
+ DCHECK(GetDataReductionProxySettings()->data_reduction_proxy_service());
bengr 2015/02/20 00:00:36 nit: You could introduce a local to hold GetDRPSet
jeremyim 2015/02/20 02:17:16 Done.
+ if (GetDataReductionProxySettings()->data_reduction_proxy_service()->
+ statistics_prefs())
return;
// We don't care about commit_delay for now. It is just a dummy value.
base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60);
- GetDataReductionProxySettings()->EnableCompressionStatisticsLogging(
- user_pref_service_.get(),
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI),
- commit_delay);
- GetDataReductionProxyIOData()->SetDataReductionProxyStatisticsPrefs(
- GetDataReductionProxySettings()->statistics_prefs());
+ GetDataReductionProxySettings()->data_reduction_proxy_service()->
+ EnableCompressionStatisticsLogging(
+ user_pref_service_.get(),
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI),
+ commit_delay);
}
} // namespace android_webview

Powered by Google App Engine
This is Rietveld 408576698