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

Unified Diff: net/filter/sdch_filter.cc

Issue 537403003: Added new histogram for analyzing SDCH corruption detection cases. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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: net/filter/sdch_filter.cc
diff --git a/net/filter/sdch_filter.cc b/net/filter/sdch_filter.cc
index c5384a4ef040abe18f50933b01f490b0ca5e4e89..2d78aefeedae115cddf8830615e8dafd45ccbe10 100644
--- a/net/filter/sdch_filter.cc
+++ b/net/filter/sdch_filter.cc
@@ -179,6 +179,8 @@ Filter::FilterStatus SdchFilter::ReadFilteredData(char* dest_buffer,
decoding_status_ = PASS_THROUGH;
} else if (filter_context_.GetResponseCode() != 200) {
// We need to meta-refresh, with SDCH disabled.
+ RecordCorruptionDetectionCause(filter_context_.IsCachedContent() ?
+ RESPONSE_200_CACHED : RESPONSE_200);
mmenke 2014/09/05 14:52:27 nit: this doesn't follow the indentation rules.
mmenke 2014/09/05 14:52:27 I think it's weird that we're only recording a sub
Randy Smith (Not in Mondays) 2014/09/07 01:14:16 Done. (I agree with you about SdchErrorRecovery;
Randy Smith (Not in Mondays) 2014/09/07 01:14:16 Moot; saw other comment :-}.
mmenke 2014/09/07 01:46:03 I agree that we shouldn't clean it up (Or fix the
} else if (filter_context_.IsCachedContent()
&& !dictionary_hash_is_plausible_) {
// We must have hit the back button, and gotten content that was fetched
@@ -200,14 +202,22 @@ Filter::FilterStatus SdchFilter::ReadFilteredData(char* dest_buffer,
// the meta-refresh result.
// TODO(jar): Improve robustness by sniffing for valid text that we can
// actual use re: decoding_status_ = PASS_THROUGH;
+ RecordCorruptionDetectionCause(filter_context_.IsCachedContent() ?
+ TENTATIVE_SDCH_CACHED : TENTATIVE_SDCH);
mmenke 2014/09/05 14:52:27 I know this is the language used elsewhere, but I
Randy Smith (Not in Mondays) 2014/09/07 01:14:16 I've played around some with the doc, both pointin
} else if (dictionary_hash_is_plausible_) {
// We need a meta-refresh since we don't have the dictionary.
// The common cause is a restart of the browser, where we try to render
// cached content that was saved when we had a dictionary.
+ RecordCorruptionDetectionCause(
+ filter_context_.IsCachedContent() ?
+ DICTIONARY_NOT_FOUND_CACHED : DICTIONARY_NOT_FOUND);
} else if (filter_context_.IsSdchResponse()) {
// This is a very corrupt SDCH request response. We can't decode it.
// We'll use a meta-refresh, and get content without asking for SDCH.
// This will also progressively disable SDCH for this domain.
+ RecordCorruptionDetectionCause(
+ filter_context_.IsCachedContent() ?
+ NON_SDCH_RESPONSE_CACHED : NON_SDCH_RESPONSE);
mmenke 2014/09/05 14:52:27 This is weird. If it is an SDCH response, we reco
Randy Smith (Not in Mondays) 2014/09/07 01:14:16 IsSdchResponse() being true means that we advertis
mmenke 2014/09/07 01:46:03 Ahh... IsSdchResponse means is this a response to
Randy Smith (Not in Mondays) 2014/09/08 01:56:12 I tend to agree with you, although that may also b
} else {
// One of the first 9 bytes precluded consideration as a hash.
// This can't be an SDCH payload, even though the server said it was.
@@ -393,4 +403,10 @@ int SdchFilter::OutputBufferExcess(char* const dest_buffer,
return amount;
}
+void SdchFilter::RecordCorruptionDetectionCause(
+ CorruptionDetectionCause cause) {
+ UMA_HISTOGRAM_ENUMERATION(
+ "Sdch3.CorruptionDetectionCause", cause, META_REFRESH_CAUSE_MAX);
+}
+
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698