Chromium Code Reviews| 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 // |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 // encoding. If the hash is not plausible, then the payload is probably not | 88 // encoding. If the hash is not plausible, then the payload is probably not |
| 89 // an SDCH encoded bundle, and various error recovery strategies can be | 89 // an SDCH encoded bundle, and various error recovery strategies can be |
| 90 // attempted. | 90 // attempted. |
| 91 bool dictionary_hash_is_plausible_; | 91 bool dictionary_hash_is_plausible_; |
| 92 | 92 |
| 93 // We hold an in-memory copy of the dictionary during the entire decoding, as | 93 // We hold an in-memory copy of the dictionary during the entire decoding, as |
| 94 // it is used directly by the VC-DIFF decoding system. | 94 // it is used directly by the VC-DIFF decoding system. |
| 95 // That char* data is part of the dictionary_ we hold a reference to. | 95 // That char* data is part of the dictionary_ we hold a reference to. |
| 96 scoped_refptr<SdchManager::Dictionary> dictionary_; | 96 scoped_refptr<SdchManager::Dictionary> dictionary_; |
| 97 | 97 |
| 98 // We keep a copy of the URLRequestContext for use in the destructor, (at | |
| 99 // which point GetURLRequestContext() will likely return null because of | |
| 100 // the disassociation of the URLRequest from the URLRequestJob). This is | |
| 101 // safe because the URLRequestJob (and any filters) are guaranteed to be | |
| 102 // deleted before the URLRequestContext is destroyed. | |
| 103 const URLRequestContext * const url_request_context_; | |
|
jar (doing other things)
2014/06/13 18:28:48
nit: no space before the asterisk. (like lines 43,
Randy Smith (Not in Mondays)
2014/06/13 19:40:12
Whoops; done.
| |
| 104 | |
| 98 // The decoder may demand a larger output buffer than the target of | 105 // The decoder may demand a larger output buffer than the target of |
| 99 // ReadFilteredData so we buffer the excess output between calls. | 106 // ReadFilteredData so we buffer the excess output between calls. |
| 100 std::string dest_buffer_excess_; | 107 std::string dest_buffer_excess_; |
| 101 // To avoid moving strings around too much, we save the index into | 108 // To avoid moving strings around too much, we save the index into |
| 102 // dest_buffer_excess_ that has the next byte to output. | 109 // dest_buffer_excess_ that has the next byte to output. |
| 103 size_t dest_buffer_excess_index_; | 110 size_t dest_buffer_excess_index_; |
| 104 | 111 |
| 105 // To get stats on activities, we keep track of source and target bytes. | 112 // To get stats on activities, we keep track of source and target bytes. |
| 106 // Visit about:histograms/Sdch to see histogram data. | 113 // Visit about:histograms/Sdch to see histogram data. |
| 107 size_t source_bytes_; | 114 size_t source_bytes_; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 119 // To facilitate error recovery, allow filter to know if content is text/html | 126 // To facilitate error recovery, allow filter to know if content is text/html |
| 120 // by checking within this mime type (we may do a meta-refresh via html). | 127 // by checking within this mime type (we may do a meta-refresh via html). |
| 121 std::string mime_type_; | 128 std::string mime_type_; |
| 122 | 129 |
| 123 DISALLOW_COPY_AND_ASSIGN(SdchFilter); | 130 DISALLOW_COPY_AND_ASSIGN(SdchFilter); |
| 124 }; | 131 }; |
| 125 | 132 |
| 126 } // namespace net | 133 } // namespace net |
| 127 | 134 |
| 128 #endif // NET_FILTER_SDCH_FILTER_H_ | 135 #endif // NET_FILTER_SDCH_FILTER_H_ |
| OLD | NEW |