Index: net/filter/sdch_filter.cc |
diff --git a/net/filter/sdch_filter.cc b/net/filter/sdch_filter.cc |
index 2ef5ad51d7c4dce79e350643d76a95cf02df12f8..7cfdf3b1d218bf01efea1f95d00caff11bf3deea 100644 |
--- a/net/filter/sdch_filter.cc |
+++ b/net/filter/sdch_filter.cc |
@@ -50,7 +50,8 @@ SdchFilter::~SdchFilter() { |
if (vcdiff_streaming_decoder_.get()) { |
if (!vcdiff_streaming_decoder_->FinishDecoding()) { |
decoding_status_ = DECODING_ERROR; |
- SdchManager::SdchErrorRecovery(SdchManager::INCOMPLETE_SDCH_CONTENT); |
+ GetSdchManager()->SdchErrorRecovery( |
+ SdchManager::INCOMPLETE_SDCH_CONTENT, url_); |
// Make it possible for the user to hit reload, and get non-sdch content. |
// Note this will "wear off" quickly enough, and is just meant to assure |
// in some rare case that the user is not stuck. |
@@ -65,7 +66,7 @@ SdchFilter::~SdchFilter() { |
if (!dest_buffer_excess_.empty()) { |
// Filter chaining error, or premature teardown. |
- SdchManager::SdchErrorRecovery(SdchManager::UNFLUSHED_CONTENT); |
+ GetSdchManager()->SdchErrorRecovery(SdchManager::UNFLUSHED_CONTENT, url_); |
UMA_HISTOGRAM_COUNTS("Sdch3.UnflushedBytesIn", |
static_cast<int>(filter_context_.GetByteReadCount())); |
UMA_HISTOGRAM_COUNTS("Sdch3.UnflushedBufferSize", |
@@ -77,7 +78,7 @@ SdchFilter::~SdchFilter() { |
if (filter_context_.IsCachedContent()) { |
// Not a real error, but it is useful to have this tally. |
// TODO(jar): Remove this stat after SDCH stability is validated. |
- SdchManager::SdchErrorRecovery(SdchManager::CACHE_DECODED); |
+ GetSdchManager()->SdchErrorRecovery(SdchManager::CACHE_DECODED, url_); |
return; // We don't need timing stats, and we aready got ratios. |
} |
@@ -92,8 +93,7 @@ SdchFilter::~SdchFilter() { |
filter_context_.RecordPacketStats(FilterContext::SDCH_DECODE); |
// Allow latency experiments to proceed. |
- url_request_context_->sdch_manager()->SetAllowLatencyExperiment( |
- url_, true); |
+ GetSdchManager()->SetAllowLatencyExperiment(url_, true); |
return; |
} |
case PASS_THROUGH: { |
@@ -101,15 +101,16 @@ SdchFilter::~SdchFilter() { |
return; |
} |
case DECODING_UNINITIALIZED: { |
- SdchManager::SdchErrorRecovery(SdchManager::UNINITIALIZED); |
+ GetSdchManager()->SdchErrorRecovery(SdchManager::UNINITIALIZED, url_); |
return; |
} |
case WAITING_FOR_DICTIONARY_SELECTION: { |
- SdchManager::SdchErrorRecovery(SdchManager::PRIOR_TO_DICTIONARY); |
+ GetSdchManager()->SdchErrorRecovery( |
+ SdchManager::PRIOR_TO_DICTIONARY, url_); |
return; |
} |
case DECODING_ERROR: { |
- SdchManager::SdchErrorRecovery(SdchManager::DECODE_ERROR); |
+ GetSdchManager()->SdchErrorRecovery(SdchManager::DECODE_ERROR, url_); |
return; |
} |
case META_REFRESH_RECOVERY: { |
@@ -175,7 +176,8 @@ Filter::FilterStatus SdchFilter::ReadFilteredData(char* dest_buffer, |
// We could be more generous, but for now, only a "NOT FOUND" code will |
// cause a pass through. All other bad codes will fall into a |
// meta-refresh. |
- SdchManager::SdchErrorRecovery(SdchManager::PASS_THROUGH_404_CODE); |
+ GetSdchManager()->SdchErrorRecovery( |
+ SdchManager::PASS_THROUGH_404_CODE, url_); |
decoding_status_ = PASS_THROUGH; |
} else if (filter_context_.GetResponseCode() != 200) { |
// We need to meta-refresh, with SDCH disabled. |
@@ -183,7 +185,8 @@ Filter::FilterStatus SdchFilter::ReadFilteredData(char* dest_buffer, |
&& !dictionary_hash_is_plausible_) { |
// We must have hit the back button, and gotten content that was fetched |
// before we *really* advertised SDCH and a dictionary. |
- SdchManager::SdchErrorRecovery(SdchManager::PASS_THROUGH_OLD_CACHED); |
+ GetSdchManager()->SdchErrorRecovery( |
+ SdchManager::PASS_THROUGH_OLD_CACHED, url_); |
decoding_status_ = PASS_THROUGH; |
} else if (possible_pass_through_) { |
// This is the potentially most graceful response. There really was no |
@@ -193,7 +196,8 @@ Filter::FilterStatus SdchFilter::ReadFilteredData(char* dest_buffer, |
// not to use sdch, even though there is a dictionary. To be |
// conservative, we locally added the tentative sdch (fearing that a |
// proxy stripped it!) and we must now recant (pass through). |
- SdchManager::SdchErrorRecovery(SdchManager::DISCARD_TENTATIVE_SDCH); |
+ GetSdchManager()->SdchErrorRecovery( |
+ SdchManager::DISCARD_TENTATIVE_SDCH, url_); |
// However.... just to be sure we don't get burned by proxies that |
// re-compress with gzip or other system, we can sniff to see if this |
// is compressed data etc. For now, we do nothing, which gets us into |
@@ -215,7 +219,8 @@ Filter::FilterStatus SdchFilter::ReadFilteredData(char* dest_buffer, |
// though it is not! |
// Meta-refresh won't help, as we didn't advertise an SDCH dictionary!! |
// Worse yet, meta-refresh could lead to an infinite refresh loop. |
- SdchManager::SdchErrorRecovery(SdchManager::PASSING_THROUGH_NON_SDCH); |
+ GetSdchManager()->SdchErrorRecovery( |
+ SdchManager::PASSING_THROUGH_NON_SDCH, url_); |
decoding_status_ = PASS_THROUGH; |
// ... but further back-off on advertising SDCH support. |
url_request_context_->sdch_manager()->BlacklistDomain(url_); |
@@ -230,11 +235,11 @@ Filter::FilterStatus SdchFilter::ReadFilteredData(char* dest_buffer, |
// backoff), we'll just make sure this NEVER happens again. |
url_request_context_->sdch_manager()->BlacklistDomainForever(url_); |
if (filter_context_.IsCachedContent()) |
- SdchManager::SdchErrorRecovery( |
- SdchManager::CACHED_META_REFRESH_UNSUPPORTED); |
+ GetSdchManager()->SdchErrorRecovery( |
+ SdchManager::CACHED_META_REFRESH_UNSUPPORTED, url_); |
else |
- SdchManager::SdchErrorRecovery( |
- SdchManager::META_REFRESH_UNSUPPORTED); |
+ GetSdchManager()->SdchErrorRecovery( |
+ SdchManager::META_REFRESH_UNSUPPORTED, url_); |
return FILTER_ERROR; |
} |
// HTML content means we can issue a meta-refresh, and get the content |
@@ -242,13 +247,14 @@ Filter::FilterStatus SdchFilter::ReadFilteredData(char* dest_buffer, |
if (filter_context_.IsCachedContent()) { |
// Cached content is probably a startup tab, so we'll just get fresh |
// content and try again, without disabling sdch. |
- SdchManager::SdchErrorRecovery( |
- SdchManager::META_REFRESH_CACHED_RECOVERY); |
+ GetSdchManager()->SdchErrorRecovery( |
+ SdchManager::META_REFRESH_CACHED_RECOVERY, url_); |
} else { |
// Since it wasn't in the cache, we definately need at least some |
// period of blacklisting to get the correct content. |
url_request_context_->sdch_manager()->BlacklistDomain(url_); |
- SdchManager::SdchErrorRecovery(SdchManager::META_REFRESH_RECOVERY); |
+ GetSdchManager()->SdchErrorRecovery( |
+ SdchManager::META_REFRESH_RECOVERY, url_); |
} |
decoding_status_ = META_REFRESH_RECOVERY; |
// Issue a meta redirect with SDCH disabled. |
@@ -302,7 +308,8 @@ Filter::FilterStatus SdchFilter::ReadFilteredData(char* dest_buffer, |
if (!ret) { |
vcdiff_streaming_decoder_.reset(NULL); // Don't call it again. |
decoding_status_ = DECODING_ERROR; |
- SdchManager::SdchErrorRecovery(SdchManager::DECODE_BODY_ERROR); |
+ GetSdchManager()->SdchErrorRecovery( |
+ SdchManager::DECODE_BODY_ERROR, url_); |
return FILTER_ERROR; |
} |
@@ -359,9 +366,11 @@ Filter::FilterStatus SdchFilter::InitializeDictionary() { |
} |
} |
if (dictionary_hash_is_plausible_) |
- SdchManager::SdchErrorRecovery(SdchManager::DICTIONARY_HASH_NOT_FOUND); |
+ GetSdchManager()->SdchErrorRecovery( |
+ SdchManager::DICTIONARY_HASH_NOT_FOUND, url_); |
else |
- SdchManager::SdchErrorRecovery(SdchManager::DICTIONARY_HASH_MALFORMED); |
+ GetSdchManager()->SdchErrorRecovery( |
+ SdchManager::DICTIONARY_HASH_MALFORMED, url_); |
decoding_status_ = DECODING_ERROR; |
return FILTER_ERROR; |
} |
@@ -391,4 +400,8 @@ int SdchFilter::OutputBufferExcess(char* const dest_buffer, |
return amount; |
} |
+SdchManager* SdchFilter::GetSdchManager() const { |
+ return url_request_context_->sdch_manager(); |
+} |
+ |
} // namespace net |