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

Side by Side Diff: net/base/sdch_filter.h

Issue 6516025: Remove GetInputStreamBufferSize() method from FilterContext. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add some sanity checks Created 9 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/base/mock_filter_context.cc ('k') | net/base/sdch_filter_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 11 matching lines...) Expand all
22 #include "net/base/sdch_manager.h" 22 #include "net/base/sdch_manager.h"
23 23
24 namespace open_vcdiff { 24 namespace open_vcdiff {
25 class VCDiffStreamingDecoder; 25 class VCDiffStreamingDecoder;
26 } 26 }
27 27
28 namespace net { 28 namespace net {
29 29
30 class SdchFilter : public Filter { 30 class SdchFilter : public Filter {
31 public: 31 public:
32 explicit SdchFilter(const FilterContext& filter_context);
33
34 virtual ~SdchFilter(); 32 virtual ~SdchFilter();
35 33
36 // Initializes filter decoding mode and internal control blocks. 34 // Initializes filter decoding mode and internal control blocks.
37 bool InitDecoding(Filter::FilterType filter_type); 35 bool InitDecoding(Filter::FilterType filter_type);
38 36
39 // Decode the pre-filter data and writes the output into |dest_buffer| 37 // Decode the pre-filter data and writes the output into |dest_buffer|
40 // The function returns FilterStatus. See filter.h for its description. 38 // The function returns FilterStatus. See filter.h for its description.
41 // 39 //
42 // Upon entry, *dest_len is the total size (in number of chars) of the 40 // Upon entry, *dest_len is the total size (in number of chars) of the
43 // destination buffer. Upon exit, *dest_len is the actual number of chars 41 // destination buffer. Upon exit, *dest_len is the actual number of chars
44 // written into the destination buffer. 42 // written into the destination buffer.
45 virtual FilterStatus ReadFilteredData(char* dest_buffer, int* dest_len); 43 virtual FilterStatus ReadFilteredData(char* dest_buffer, int* dest_len);
46 44
47 private: 45 private:
48 // Internal status. Once we enter an error state, we stop processing data. 46 // Internal status. Once we enter an error state, we stop processing data.
49 enum DecodingStatus { 47 enum DecodingStatus {
50 DECODING_UNINITIALIZED, 48 DECODING_UNINITIALIZED,
51 WAITING_FOR_DICTIONARY_SELECTION, 49 WAITING_FOR_DICTIONARY_SELECTION,
52 DECODING_IN_PROGRESS, 50 DECODING_IN_PROGRESS,
53 DECODING_ERROR, 51 DECODING_ERROR,
54 META_REFRESH_RECOVERY, // Decoding error being handled by a meta-refresh. 52 META_REFRESH_RECOVERY, // Decoding error being handled by a meta-refresh.
55 PASS_THROUGH, // Non-sdch content being passed without alteration. 53 PASS_THROUGH, // Non-sdch content being passed without alteration.
56 }; 54 };
57 55
56 // Only to be instantiated by Filter::Factory.
57 explicit SdchFilter(const FilterContext& filter_context);
58 friend class Filter;
59
58 // Identify the suggested dictionary, and initialize underlying decompressor. 60 // Identify the suggested dictionary, and initialize underlying decompressor.
59 Filter::FilterStatus InitializeDictionary(); 61 Filter::FilterStatus InitializeDictionary();
60 62
61 // Move data that was internally buffered (after decompression) to the 63 // Move data that was internally buffered (after decompression) to the
62 // specified dest_buffer. 64 // specified dest_buffer.
63 int OutputBufferExcess(char* const dest_buffer, size_t available_space); 65 int OutputBufferExcess(char* const dest_buffer, size_t available_space);
64 66
65 // Tracks the status of decoding. 67 // Tracks the status of decoding.
66 // This variable is initialized by InitDecoding and updated only by 68 // This variable is initialized by InitDecoding and updated only by
67 // ReadFilteredData. 69 // ReadFilteredData.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // To facilitate error recovery, allow filter to know if content is text/html 115 // To facilitate error recovery, allow filter to know if content is text/html
114 // by checking within this mime type (we may do a meta-refresh via html). 116 // by checking within this mime type (we may do a meta-refresh via html).
115 std::string mime_type_; 117 std::string mime_type_;
116 118
117 DISALLOW_COPY_AND_ASSIGN(SdchFilter); 119 DISALLOW_COPY_AND_ASSIGN(SdchFilter);
118 }; 120 };
119 121
120 } // namespace net 122 } // namespace net
121 123
122 #endif // NET_BASE_SDCH_FILTER_H_ 124 #endif // NET_BASE_SDCH_FILTER_H_
OLDNEW
« no previous file with comments | « net/base/mock_filter_context.cc ('k') | net/base/sdch_filter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698