Skip to content
This repository was archived by the owner on Apr 3, 2020. It is now read-only.

Commit 4441cc1

Browse files
hushCommit bot
hush
authored and
Commit bot
committed
Use no-op statistics collecting object for WebView.
WebView does not gather data_reduction_proxy related statistics at the moment. WebView's statistics object writes the data to pref service which does not upload the data to anywhere. BUG=b/17998706 Review URL: https://codereview.chromium.org/651443005 Cr-Commit-Position: refs/heads/master@{#300613}
1 parent 80aa80b commit 4441cc1

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

android_webview/browser/aw_browser_context.cc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_params.h"
2121
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_prefs.h"
2222
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.h"
23+
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_statistics_prefs.h"
2324
#include "components/user_prefs/user_prefs.h"
2425
#include "components/visitedlink/browser/visitedlink_master.h"
2526
#include "content/public/browser/browser_thread.h"
@@ -94,6 +95,10 @@ void AwBrowserContext::SetDataReductionProxyEnabled(bool enabled) {
9495
context->GetDataReductionProxySettings();
9596
if (proxy_settings == NULL)
9697
return;
98+
99+
context->CreateDataReductionProxyStatisticsIfNecessary();
100+
proxy_settings->SetDataReductionProxyStatisticsPrefs(
101+
context->data_reduction_proxy_statistics_.get());
97102
proxy_settings->SetDataReductionProxyEnabled(data_reduction_proxy_enabled_);
98103
}
99104

@@ -293,4 +298,19 @@ void AwBrowserContext::RebuildTable(
293298
enumerator->OnComplete(true);
294299
}
295300

301+
void AwBrowserContext::CreateDataReductionProxyStatisticsIfNecessary() {
302+
DCHECK(user_pref_service_.get());
303+
304+
if (!data_reduction_proxy_statistics_.get()) {
305+
// We don't care about commit_delay for now. It is just a dummy value.
306+
base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60);
307+
data_reduction_proxy_statistics_ =
308+
scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs>(
309+
new data_reduction_proxy::DataReductionProxyStatisticsPrefs(
310+
user_pref_service_.get(),
311+
base::MessageLoopProxy::current(),
312+
commit_delay));
313+
}
314+
}
315+
296316
} // namespace android_webview

android_webview/browser/aw_browser_context.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class WebContents;
3030
namespace data_reduction_proxy {
3131
class DataReductionProxyConfigurator;
3232
class DataReductionProxySettings;
33+
class DataReductionProxyStatisticsPrefs;
3334
}
3435

3536
namespace net {
@@ -116,6 +117,7 @@ class AwBrowserContext : public content::BrowserContext,
116117
const scoped_refptr<URLEnumerator>& enumerator) override;
117118

118119
private:
120+
void CreateDataReductionProxyStatisticsIfNecessary();
119121
static bool data_reduction_proxy_enabled_;
120122

121123
// The file path where data for this context is persisted.
@@ -136,6 +138,8 @@ class AwBrowserContext : public content::BrowserContext,
136138

137139
scoped_ptr<data_reduction_proxy::DataReductionProxyConfigurator>
138140
data_reduction_proxy_configurator_;
141+
scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs>
142+
data_reduction_proxy_statistics_;
139143
scoped_ptr<data_reduction_proxy::DataReductionProxySettings>
140144
data_reduction_proxy_settings_;
141145

0 commit comments

Comments
 (0)