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

Unified Diff: android_webview/browser/aw_browser_context.cc

Issue 676863002: Use no-op statistics collecting object for WebView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2171
Patch Set: Created 6 years, 2 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
« no previous file with comments | « android_webview/browser/aw_browser_context.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 098ce73ea4e15025166e93268a27fe7c55158ac8..239dfc40c20d5979fff4f30813bf9a4e04ece86b 100644
--- a/android_webview/browser/aw_browser_context.cc
+++ b/android_webview/browser/aw_browser_context.cc
@@ -20,6 +20,7 @@
#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_settings.h"
+#include "components/data_reduction_proxy/browser/data_reduction_proxy_statistics_prefs.h"
#include "components/user_prefs/user_prefs.h"
#include "components/visitedlink/browser/visitedlink_master.h"
#include "content/public/browser/browser_thread.h"
@@ -94,6 +95,10 @@ void AwBrowserContext::SetDataReductionProxyEnabled(bool enabled) {
context->GetDataReductionProxySettings();
if (proxy_settings == NULL)
return;
+
+ context->CreateDataReductionProxyStatisticsIfNecessary();
+ proxy_settings->SetDataReductionProxyStatisticsPrefs(
+ context->data_reduction_proxy_statistics_.get());
proxy_settings->SetDataReductionProxyEnabled(data_reduction_proxy_enabled_);
}
@@ -294,4 +299,19 @@ void AwBrowserContext::RebuildTable(
enumerator->OnComplete(true);
}
+void AwBrowserContext::CreateDataReductionProxyStatisticsIfNecessary() {
+ DCHECK(user_pref_service_.get());
+
+ if (!data_reduction_proxy_statistics_.get()) {
+ // We don't care about commit_delay for now. It is just a dummy value.
+ base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60);
+ data_reduction_proxy_statistics_ =
+ scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs>(
+ new data_reduction_proxy::DataReductionProxyStatisticsPrefs(
+ user_pref_service_.get(),
+ base::MessageLoopProxy::current(),
+ commit_delay));
+ }
+}
+
} // namespace android_webview
« no previous file with comments | « android_webview/browser/aw_browser_context.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698