| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // SdchFilter applies open_vcdiff content decoding to a datastream. | 5 // SdchFilter applies open_vcdiff content decoding to a datastream. |
| 6 // This decoding uses a pre-cached dictionary of text fragments to decode | 6 // This decoding uses a pre-cached dictionary of text fragments to decode |
| 7 // (expand) the stream back to its original contents. | 7 // (expand) the stream back to its original contents. |
| 8 // | 8 // |
| 9 // This SdchFilter internally uses open_vcdiff/vcdec library to do decoding. | 9 // This SdchFilter internally uses open_vcdiff/vcdec library to do decoding. |
| 10 // | 10 // |
| 11 // SdchFilter is also a subclass of Filter. See the latter's header file | 11 // SdchFilter is also a subclass of Filter. See the latter's header file |
| 12 // filter.h for sample usage. | 12 // filter.h for sample usage. |
| 13 | 13 |
| 14 #ifndef NET_FILTER_SDCH_FILTER_H_ | 14 #ifndef NET_FILTER_SDCH_FILTER_H_ |
| 15 #define NET_FILTER_SDCH_FILTER_H_ | 15 #define NET_FILTER_SDCH_FILTER_H_ |
| 16 | 16 |
| 17 #include <string> | 17 #include <string> |
| 18 | 18 |
| 19 #include "base/memory/scoped_ptr.h" | 19 #include "base/memory/scoped_ptr.h" |
| 20 #include "net/base/net_export.h" | 20 #include "net/base/net_export.h" |
| 21 #include "net/base/sdch_dictionary.h" |
| 21 #include "net/base/sdch_manager.h" | 22 #include "net/base/sdch_manager.h" |
| 22 #include "net/filter/filter.h" | 23 #include "net/filter/filter.h" |
| 23 | 24 |
| 24 namespace open_vcdiff { | 25 namespace open_vcdiff { |
| 25 class VCDiffStreamingDecoder; | 26 class VCDiffStreamingDecoder; |
| 26 } | 27 } |
| 27 | 28 |
| 28 namespace net { | 29 namespace net { |
| 29 | 30 |
| 30 class NET_EXPORT_PRIVATE SdchFilter : public Filter { | 31 class NET_EXPORT_PRIVATE SdchFilter : public Filter { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // sdch payload, we check to see if it is plausible, meaning it has a null | 89 // sdch payload, we check to see if it is plausible, meaning it has a null |
| 89 // termination, and has 8 characters that are possible in a net-safe base64 | 90 // termination, and has 8 characters that are possible in a net-safe base64 |
| 90 // encoding. If the hash is not plausible, then the payload is probably not | 91 // encoding. If the hash is not plausible, then the payload is probably not |
| 91 // an SDCH encoded bundle, and various error recovery strategies can be | 92 // an SDCH encoded bundle, and various error recovery strategies can be |
| 92 // attempted. | 93 // attempted. |
| 93 bool dictionary_hash_is_plausible_; | 94 bool dictionary_hash_is_plausible_; |
| 94 | 95 |
| 95 // Validity of this pointer is guaranteed by either the FilterContext holding | 96 // Validity of this pointer is guaranteed by either the FilterContext holding |
| 96 // a containing SdchManager::DictionarySet, or this object holding a | 97 // a containing SdchManager::DictionarySet, or this object holding a |
| 97 // container in |unexpected_dictionary_handle_| below. | 98 // container in |unexpected_dictionary_handle_| below. |
| 98 const SdchManager::Dictionary *dictionary_; | 99 const SdchDictionary* dictionary_; |
| 99 | 100 |
| 100 // We keep a copy of the URLRequestContext for use in the destructor, (at | 101 // We keep a copy of the URLRequestContext for use in the destructor, (at |
| 101 // which point GetURLRequestContext() will likely return null because of | 102 // which point GetURLRequestContext() will likely return null because of |
| 102 // the disassociation of the URLRequest from the URLRequestJob). This is | 103 // the disassociation of the URLRequest from the URLRequestJob). This is |
| 103 // safe because the URLRequestJob (and any filters) are guaranteed to be | 104 // safe because the URLRequestJob (and any filters) are guaranteed to be |
| 104 // deleted before the URLRequestContext is destroyed. | 105 // deleted before the URLRequestContext is destroyed. |
| 105 const URLRequestContext* const url_request_context_; | 106 const URLRequestContext* const url_request_context_; |
| 106 | 107 |
| 107 // The decoder may demand a larger output buffer than the target of | 108 // The decoder may demand a larger output buffer than the target of |
| 108 // ReadFilteredData so we buffer the excess output between calls. | 109 // ReadFilteredData so we buffer the excess output between calls. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 133 // advertised (e.g. a cached response using an old dictionary), this | 134 // advertised (e.g. a cached response using an old dictionary), this |
| 134 // variable preserves that dictionary from deletion during decoding. | 135 // variable preserves that dictionary from deletion during decoding. |
| 135 scoped_ptr<SdchManager::DictionarySet> unexpected_dictionary_handle_; | 136 scoped_ptr<SdchManager::DictionarySet> unexpected_dictionary_handle_; |
| 136 | 137 |
| 137 DISALLOW_COPY_AND_ASSIGN(SdchFilter); | 138 DISALLOW_COPY_AND_ASSIGN(SdchFilter); |
| 138 }; | 139 }; |
| 139 | 140 |
| 140 } // namespace net | 141 } // namespace net |
| 141 | 142 |
| 142 #endif // NET_FILTER_SDCH_FILTER_H_ | 143 #endif // NET_FILTER_SDCH_FILTER_H_ |
| OLD | NEW |