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

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.cc

Issue 1127893002: Add DataReductionProxyExperimentsStats and UMA for measuring potentially non-compressed bytes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test failures Created 5 years, 7 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: components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.cc
index 50a303cf7849faa3f32a8787cafbe931c7e41573..5a0e52fa706c9d8d4131e911bfc84a32e52a0a06 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.cc
@@ -14,6 +14,7 @@
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_configurator.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_delegate.h"
+#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_experiments_stats.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_interceptor.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_mutable_config_values.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.h"
@@ -142,6 +143,11 @@ DataReductionProxyIOData::DataReductionProxyIOData(
proxy_delegate_.reset(
new DataReductionProxyDelegate(request_options_.get(), config_.get()));
+ // It is safe to use base::Unretained here, since it gets executed
+ // synchronously on the IO thread, and |this| outlives the caller (since the
+ // caller is owned by |this|.
+ experiments_stats_.reset(new DataReductionProxyExperimentsStats(base::Bind(
+ &DataReductionProxyIOData::SetInt64Pref, base::Unretained(this))));
}
DataReductionProxyIOData::DataReductionProxyIOData()
@@ -177,6 +183,7 @@ void DataReductionProxyIOData::InitializeOnIOThread() {
config_->InitializeOnIOThread(basic_url_request_context_getter_.get());
if (config_client_.get())
config_client_->InitializeOnIOThread(url_request_context_getter_);
+ experiments_stats_->InitializeOnIOThread();
ui_task_runner_->PostTask(
FROM_HERE,
base::Bind(&DataReductionProxyService::SetIOData,
@@ -209,7 +216,8 @@ DataReductionProxyIOData::CreateNetworkDelegate(
scoped_ptr<DataReductionProxyNetworkDelegate> network_delegate(
new DataReductionProxyNetworkDelegate(
wrapped_network_delegate.Pass(), config_.get(),
- request_options_.get(), configurator_.get()));
+ request_options_.get(), configurator_.get(),
+ experiments_stats_.get()));
if (track_proxy_bypass_statistics)
network_delegate->InitIODataAndUMA(this, bypass_stats_.get());
return network_delegate.Pass();
@@ -279,4 +287,12 @@ void DataReductionProxyIOData::SetUnreachable(bool unreachable) {
service_, unreachable));
}
+void DataReductionProxyIOData::SetInt64Pref(const std::string& pref_path,
+ int64 value) {
+ DCHECK(io_task_runner_->BelongsToCurrentThread());
+ ui_task_runner_->PostTask(
+ FROM_HERE, base::Bind(&DataReductionProxyService::SetInt64Pref, service_,
+ pref_path, value));
+}
+
} // namespace data_reduction_proxy

Powered by Google App Engine
This is Rietveld 408576698