Skip to content

Commit

Permalink
Log what filter causes a decoding error.
Browse files Browse the repository at this point in the history
BUG=584326
R=xunjieli@chromium.org

Review URL: https://codereview.chromium.org/1670643003

Cr-Commit-Position: refs/heads/master@{#373651}
  • Loading branch information
rdsmith authored and Commit bot committed Feb 4, 2016
1 parent a59d0ad commit d3b510c
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
2 changes: 2 additions & 0 deletions net/filter/filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ std::string FilterTypeAsString(Filter::FilterType type_id) {
return "FILTER_TYPE_SDCH_POSSIBLE ";
case Filter::FILTER_TYPE_UNSUPPORTED:
return "FILTER_TYPE_UNSUPPORTED";
case Filter::FILTER_TYPE_MAX:
return "FILTER_TYPE_MAX";
}
return "";
}
Expand Down
7 changes: 6 additions & 1 deletion net/filter/filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ class NET_EXPORT_PRIVATE Filter {
FILTER_ERROR
};

// Specifies type of filters that can be created.
// Specifies type of filters that can be created. Do not change the values
// of this enum; it is preserved in a histogram.
enum FilterType {
FILTER_TYPE_BROTLI,
FILTER_TYPE_DEFLATE,
Expand All @@ -160,6 +161,8 @@ class NET_EXPORT_PRIVATE Filter {
FILTER_TYPE_SDCH,
FILTER_TYPE_SDCH_POSSIBLE, // Sdch possible, but pass through allowed.
FILTER_TYPE_UNSUPPORTED,

FILTER_TYPE_MAX
};

virtual ~Filter();
Expand Down Expand Up @@ -233,6 +236,8 @@ class NET_EXPORT_PRIVATE Filter {
// Returns a string describing the FilterTypes implemented by this filter.
std::string OrderedFilterList() const;

FilterType type() const { return type_id_; }

protected:
friend class BrotliUnitTest;
friend class GZipUnitTest;
Expand Down
2 changes: 2 additions & 0 deletions net/url_request/url_request_job.cc
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,8 @@ Error URLRequestJob::ReadFilteredData(int* bytes_read) {
<< " Filter Error";
filter_needs_more_output_space_ = false;
error = ERR_CONTENT_DECODING_FAILED;
UMA_HISTOGRAM_ENUMERATION("Net.ContentDecodingFailed.FilterType",
filter_->type(), Filter::FILTER_TYPE_MAX);
break;
}
default: {
Expand Down
21 changes: 21 additions & 0 deletions tools/metrics/histograms/histograms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23390,6 +23390,13 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
</summary>
</histogram>

<histogram name="Net.ContentDecodingFailed.FilterType" enum="NetFilterType">
<owner>rdsmith@chromium.org</owner>
<summary>
For each CONTENT_DECODING_FAILED, record the filter that failed.
</summary>
</histogram>

<histogram name="net.CookieBackingStoreUpdateResults"
enum="BackingStoreResults">
<obsolete>
Expand Down Expand Up @@ -72609,6 +72616,20 @@ To add a new entry, add it with any value and run test to compute valid value.
<int value="21" label="Show Offline Copy Button Clicked"/>
</enum>

<enum name="NetFilterType" type="int">
<summary>
Specific content decoding filter. See net::Filter::FilterType for more
details
</summary>
<int value="0" label="Brotli"/>
<int value="1" label="Deflate"/>
<int value="2" label="GZIP"/>
<int value="3" label="GzipHelpingSdch"/>
<int value="4" label="SDCH"/>
<int value="5" label="SDCHPossible"/>
<int value="6" label="Unsupported"/>
</enum>

<enum name="NetInternalsUiFeature" type="int">
<int value="0" label="NetInternals"/>
<int value="1" label="Connection tester"/>
Expand Down

0 comments on commit d3b510c

Please sign in to comment.