Commit b541e938 authored by Robert Ogden's avatar Robert Ogden Committed by Commit Bot

Remove some unused LoFi histograms

Bug: 823569
Change-Id: If226bd56a981e78aa2fe9da89e144b930a064502
Reviewed-on: https://chromium-review.googlesource.com/991074Reviewed-by: default avatarMark Pearson <mpearson@chromium.org>
Reviewed-by: default avatarTarun Bansal <tbansal@chromium.org>
Commit-Queue: Robert Ogden <robertogden@google.com>
Cr-Commit-Position: refs/heads/master@{#547841}
parent 0e90c5f5
...@@ -59,15 +59,6 @@ ContentLoFiDecider::DetermineCommittedServerPreviewsState( ...@@ -59,15 +59,6 @@ ContentLoFiDecider::DetermineCommittedServerPreviewsState(
return updated_state; return updated_state;
} }
bool ContentLoFiDecider::IsUsingLoFi(const net::URLRequest& request) const {
const content::ResourceRequestInfo* request_info =
content::ResourceRequestInfo::ForRequest(&request);
if (!request_info)
return false;
return (request_info->GetPreviewsState() & content::SERVER_LOFI_ON);
}
void ContentLoFiDecider::MaybeSetAcceptTransformHeader( void ContentLoFiDecider::MaybeSetAcceptTransformHeader(
const net::URLRequest& request, const net::URLRequest& request,
net::HttpRequestHeaders* headers) const { net::HttpRequestHeaders* headers) const {
......
...@@ -44,7 +44,6 @@ class ContentLoFiDecider : public LoFiDecider { ...@@ -44,7 +44,6 @@ class ContentLoFiDecider : public LoFiDecider {
content::PreviewsState initial_state); content::PreviewsState initial_state);
// LoFiDecider implementation: // LoFiDecider implementation:
bool IsUsingLoFi(const net::URLRequest& request) const override;
void MaybeSetAcceptTransformHeader( void MaybeSetAcceptTransformHeader(
const net::URLRequest& request, const net::URLRequest& request,
net::HttpRequestHeaders* headers) const override; net::HttpRequestHeaders* headers) const override;
......
...@@ -112,14 +112,11 @@ void RecordNewContentLengthHistograms( ...@@ -112,14 +112,11 @@ void RecordNewContentLengthHistograms(
} }
} }
// |lofi_low_header_added| is set to true iff Lo-Fi request header // |received_content_length| is the number of prefilter bytes received.
// can be added to the Chrome proxy header. |received_content_length| is // |original_content_length| is the length of resource if accessed directly
// the number of prefilter bytes received. |original_content_length| is the // without data saver proxy. |freshness_lifetime| specifies how long the
// length of resource if accessed directly without data saver proxy. // resource will be fresh for.
// |freshness_lifetime| specifies how long the resource will void RecordContentLengthHistograms(bool is_https,
// be fresh for.
void RecordContentLengthHistograms(bool lofi_low_header_added,
bool is_https,
bool is_video, bool is_video,
int64_t received_content_length, int64_t received_content_length,
int64_t original_content_length, int64_t original_content_length,
...@@ -134,19 +131,6 @@ void RecordContentLengthHistograms(bool lofi_low_header_added, ...@@ -134,19 +131,6 @@ void RecordContentLengthHistograms(bool lofi_low_header_added,
original_content_length); original_content_length);
UMA_HISTOGRAM_COUNTS_1M("Net.HttpContentLengthDifferenceWithValidOCL", UMA_HISTOGRAM_COUNTS_1M("Net.HttpContentLengthDifferenceWithValidOCL",
original_content_length - received_content_length); original_content_length - received_content_length);
// Populate Lo-Fi content length histograms.
if (lofi_low_header_added) {
UMA_HISTOGRAM_COUNTS_1M("Net.HttpContentLengthWithValidOCL.LoFiOn",
received_content_length);
UMA_HISTOGRAM_COUNTS_1M(
"Net.HttpOriginalContentLengthWithValidOCL.LoFiOn",
original_content_length);
UMA_HISTOGRAM_COUNTS_1M(
"Net.HttpContentLengthDifferenceWithValidOCL.LoFiOn",
original_content_length - received_content_length);
}
} else { } else {
// Presume the original content length is the same as the received content // Presume the original content length is the same as the received content
// length. // length.
...@@ -640,11 +624,6 @@ void DataReductionProxyNetworkDelegate::RecordContentLength( ...@@ -640,11 +624,6 @@ void DataReductionProxyNetworkDelegate::RecordContentLength(
} }
RecordContentLengthHistograms( RecordContentLengthHistograms(
// |data_reduction_proxy_io_data_| can be NULL for Webview.
data_reduction_proxy_io_data_ &&
data_reduction_proxy_io_data_->IsEnabled() &&
data_reduction_proxy_io_data_->lofi_decider() &&
data_reduction_proxy_io_data_->lofi_decider()->IsUsingLoFi(request),
is_https, is_video, request.received_response_content_length(), is_https, is_video, request.received_response_content_length(),
original_content_length, freshness_lifetime, request_type); original_content_length, freshness_lifetime, request_type);
......
...@@ -127,14 +127,6 @@ const char kOriginalVideoSecureBypassedHistogramName[] = ...@@ -127,14 +127,6 @@ const char kOriginalVideoSecureBypassedHistogramName[] =
const char kOriginalVideoSecureOtherHistogramName[] = const char kOriginalVideoSecureOtherHistogramName[] =
"Net.HttpOriginalContentLengthV2.Https.Other.Video"; "Net.HttpOriginalContentLengthV2.Https.Other.Video";
// Lo-Fi histograms.
const char kReceivedValidOCLLoFiOnHistogramName[] =
"Net.HttpContentLengthWithValidOCL.LoFiOn";
const char kOriginalValidOCLLoFiOnHistogramName[] =
"Net.HttpOriginalContentLengthWithValidOCL.LoFiOn";
const char kDifferenceValidOCLLoFiOnHistogramName[] =
"Net.HttpContentLengthDifferenceWithValidOCL.LoFiOn";
const char kReceivedHistogramName[] = "Net.HttpContentLength"; const char kReceivedHistogramName[] = "Net.HttpContentLength";
const char kReceivedInsecureDirectHistogramName[] = const char kReceivedInsecureDirectHistogramName[] =
"Net.HttpContentLengthV2.Http.Direct"; "Net.HttpContentLengthV2.Http.Direct";
...@@ -213,10 +205,6 @@ class TestLoFiDecider : public LoFiDecider { ...@@ -213,10 +205,6 @@ class TestLoFiDecider : public LoFiDecider {
ignore_is_using_data_reduction_proxy_check_(false) {} ignore_is_using_data_reduction_proxy_check_(false) {}
~TestLoFiDecider() override {} ~TestLoFiDecider() override {}
bool IsUsingLoFi(const net::URLRequest& request) const override {
return should_request_lofi_resource_;
}
void SetIsUsingLoFi(bool should_request_lofi_resource) { void SetIsUsingLoFi(bool should_request_lofi_resource) {
should_request_lofi_resource_ = should_request_lofi_resource; should_request_lofi_resource_ = should_request_lofi_resource;
} }
...@@ -1285,67 +1273,6 @@ TEST_F(DataReductionProxyNetworkDelegateTest, NetHistograms) { ...@@ -1285,67 +1273,6 @@ TEST_F(DataReductionProxyNetworkDelegateTest, NetHistograms) {
kResponseContentLength, 1); kResponseContentLength, 1);
histogram_tester.ExpectUniqueSample(kCacheable24HoursHistogramName, histogram_tester.ExpectUniqueSample(kCacheable24HoursHistogramName,
kResponseContentLength, 1); kResponseContentLength, 1);
// Check Lo-Fi histograms.
const struct {
bool lofi_enabled;
int expected_count;
} tests[] = {
{
// Lo-Fi disabled.
false, 0,
},
{
// Lo-Fi enabled so should populate Lo-Fi content length histogram.
true, 1,
},
};
for (size_t i = 0; i < arraysize(tests); ++i) {
base::test::ScopedFeatureList scoped_feature_list;
if (tests[i].lofi_enabled) {
scoped_feature_list.InitAndEnableFeature(
features::kDataReductionProxyDecidesTransform);
} else {
scoped_feature_list.InitAndDisableFeature(
features::kDataReductionProxyDecidesTransform);
}
// Needed as a parameter, but functionality is not tested.
previews::TestPreviewsDecider test_previews_decider(true);
lofi_decider()->SetIsUsingLoFi(config()->ShouldAcceptServerPreview(
*fake_request.get(), test_previews_decider));
fake_request = (FetchURLRequest(GURL(kTestURL), nullptr, response_headers,
kResponseContentLength, 0));
fake_request->SetLoadFlags(fake_request->load_flags() |
net::LOAD_MAIN_FRAME_DEPRECATED);
// Histograms are accumulative, so get the sum of all the tests so far.
int expected_count = 0;
for (size_t j = 0; j <= i; ++j)
expected_count += tests[j].expected_count;
if (expected_count == 0) {
histogram_tester.ExpectTotalCount(kReceivedValidOCLLoFiOnHistogramName,
expected_count);
histogram_tester.ExpectTotalCount(kOriginalValidOCLLoFiOnHistogramName,
expected_count);
histogram_tester.ExpectTotalCount(kDifferenceValidOCLLoFiOnHistogramName,
expected_count);
} else {
histogram_tester.ExpectUniqueSample(kReceivedValidOCLLoFiOnHistogramName,
kResponseContentLength,
expected_count);
histogram_tester.ExpectUniqueSample(kOriginalValidOCLLoFiOnHistogramName,
kOriginalContentLength,
expected_count);
histogram_tester.ExpectUniqueSample(
kDifferenceValidOCLLoFiOnHistogramName,
kOriginalContentLength - kResponseContentLength, expected_count);
}
}
} }
TEST_F(DataReductionProxyNetworkDelegateTest, NetVideoHistograms) { TEST_F(DataReductionProxyNetworkDelegateTest, NetVideoHistograms) {
......
...@@ -26,10 +26,6 @@ class LoFiDecider { ...@@ -26,10 +26,6 @@ class LoFiDecider {
public: public:
virtual ~LoFiDecider() {} virtual ~LoFiDecider() {}
// Returns true when Lo-Fi Previews are on for the given |request|. This means
// the Lo-Fi header should be added to the given request.
virtual bool IsUsingLoFi(const net::URLRequest& request) const = 0;
// Adds a previews-specific directive to the Chrome-Proxy-Accept-Transform // Adds a previews-specific directive to the Chrome-Proxy-Accept-Transform
// header if needed. // header if needed.
virtual void MaybeSetAcceptTransformHeader( virtual void MaybeSetAcceptTransformHeader(
......
...@@ -106846,6 +106846,9 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries. ...@@ -106846,6 +106846,9 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
</histogram_suffixes> </histogram_suffixes>
<histogram_suffixes name="DataReductionProxy.WithValidOCL.LoFiOn" separator="."> <histogram_suffixes name="DataReductionProxy.WithValidOCL.LoFiOn" separator=".">
<obsolete>
Deprecated 04/2018.
</obsolete>
<suffix name="LoFiOn" <suffix name="LoFiOn"
label="Only page loads through the data reduction proxy with Lo-Fi On label="Only page loads through the data reduction proxy with Lo-Fi On
are considered."/> are considered."/>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment