Index: net/filter/sdch_filter.h |
diff --git a/net/filter/sdch_filter.h b/net/filter/sdch_filter.h |
index bc7788c3b09b8aac656ac48335592760c41ec645..9541742bca84b873aa059a49b66178d0ffeb2829 100644 |
--- a/net/filter/sdch_filter.h |
+++ b/net/filter/sdch_filter.h |
@@ -43,7 +43,7 @@ class NET_EXPORT_PRIVATE SdchFilter : public Filter { |
FilterStatus ReadFilteredData(char* dest_buffer, int* dest_len) override; |
private: |
- // Internal status. Once we enter an error state, we stop processing data. |
+ // Internal status. Once we enter an error state, we stop processing data. |
enum DecodingStatus { |
DECODING_UNINITIALIZED, |
WAITING_FOR_DICTIONARY_SELECTION, |
@@ -87,19 +87,19 @@ class NET_EXPORT_PRIVATE SdchFilter : public Filter { |
// After assembling an entire dictionary hash (the first 9 bytes of the |
// sdch payload, we check to see if it is plausible, meaning it has a null |
// termination, and has 8 characters that are possible in a net-safe base64 |
- // encoding. If the hash is not plausible, then the payload is probably not |
+ // encoding. If the hash is not plausible, then the payload is probably not |
// an SDCH encoded bundle, and various error recovery strategies can be |
// attempted. |
bool dictionary_hash_is_plausible_; |
- // We hold an in-memory copy of the dictionary during the entire decoding, as |
- // it is used directly by the VC-DIFF decoding system. |
- // That char* data is part of the dictionary_ we hold a reference to. |
- scoped_refptr<SdchManager::Dictionary> dictionary_; |
+ // Validity of this pointer is guaranteed by either the FilterContext holding |
+ // a containing SdchManager::DictionarySet, or this object holding a |
+ // container in |unexpected_dictionary_handle_| below. |
+ const SdchManager::Dictionary *dictionary_; |
// We keep a copy of the URLRequestContext for use in the destructor, (at |
// which point GetURLRequestContext() will likely return null because of |
- // the disassociation of the URLRequest from the URLRequestJob). This is |
+ // the disassociation of the URLRequest from the URLRequestJob). This is |
// safe because the URLRequestJob (and any filters) are guaranteed to be |
// deleted before the URLRequestContext is destroyed. |
const URLRequestContext* const url_request_context_; |
@@ -129,6 +129,11 @@ class NET_EXPORT_PRIVATE SdchFilter : public Filter { |
// by checking within this mime type (we may do a meta-refresh via html). |
std::string mime_type_; |
+ // If the response was encoded with a dictionary different than those |
+ // advertised (e.g. a cached response using an old dictionary), this |
+ // variable preserves that dictionary from deletion during decoding. |
+ scoped_ptr<SdchManager::DictionarySet> unexpected_dictionary_handle_; |
+ |
DISALLOW_COPY_AND_ASSIGN(SdchFilter); |
}; |