| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef NET_FILTER_SDCH_SOURCE_STREAM_H_ | 5 #ifndef NET_FILTER_SDCH_SOURCE_STREAM_H_ |
| 6 #define NET_FILTER_SDCH_SOURCE_STREAM_H_ | 6 #define NET_FILTER_SDCH_SOURCE_STREAM_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> |
| 9 | 10 |
| 10 #include "base/macros.h" | 11 #include "base/macros.h" |
| 11 #include "net/base/net_export.h" | 12 #include "net/base/net_export.h" |
| 12 #include "net/base/sdch_dictionary.h" | 13 #include "net/base/sdch_dictionary.h" |
| 13 #include "net/base/sdch_manager.h" | 14 #include "net/base/sdch_manager.h" |
| 14 #include "net/filter/filter_source_stream.h" | 15 #include "net/filter/filter_source_stream.h" |
| 15 #include "net/filter/source_stream.h" | 16 #include "net/filter/source_stream.h" |
| 16 | 17 |
| 17 namespace open_vcdiff { | 18 namespace open_vcdiff { |
| 18 class VCDiffStreamingDecoder; | 19 class VCDiffStreamingDecoder; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 43 class NET_EXPORT_PRIVATE Delegate { | 44 class NET_EXPORT_PRIVATE Delegate { |
| 44 public: | 45 public: |
| 45 enum ErrorRecovery { | 46 enum ErrorRecovery { |
| 46 // Do not recover the error. | 47 // Do not recover the error. |
| 47 NONE, | 48 NONE, |
| 48 // Pass remaining input unchanged to downstream. | 49 // Pass remaining input unchanged to downstream. |
| 49 PASS_THROUGH, | 50 PASS_THROUGH, |
| 50 // Pass an alternative output to downstream. | 51 // Pass an alternative output to downstream. |
| 51 REPLACE_OUTPUT, | 52 REPLACE_OUTPUT, |
| 52 }; | 53 }; |
| 53 virtual ~Delegate(){}; | 54 virtual ~Delegate() {} |
| 54 | 55 |
| 55 // Called by the SdchSourceStream if an error occurs while parsing the | 56 // Called by the SdchSourceStream if an error occurs while parsing the |
| 56 // server-sent dictionary ID, or if the specified dictionary can't be loaded | 57 // server-sent dictionary ID, or if the specified dictionary can't be loaded |
| 57 // (i.e., GetDictionary returned false). This method is expected to handle | 58 // (i.e., GetDictionary returned false). This method is expected to handle |
| 58 // the error condition by returning a ErrorRecovery enum. If REPLACE_OUTPUT | 59 // the error condition by returning a ErrorRecovery enum. If REPLACE_OUTPUT |
| 59 // is returned, it will also write the output to be replaced with to | 60 // is returned, it will also write the output to be replaced with to |
| 60 // |replace_output|. | 61 // |replace_output|. |
| 61 virtual ErrorRecovery OnDictionaryIdError(std::string* replace_output) = 0; | 62 virtual ErrorRecovery OnDictionaryIdError(std::string* replace_output) = 0; |
| 62 | 63 |
| 63 // Called by the SdchSourceStream if the specified dictionary can't be | 64 // Called by the SdchSourceStream if the specified dictionary can't be |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 virtual void OnStreamDestroyed(InputState input_state, | 99 virtual void OnStreamDestroyed(InputState input_state, |
| 99 bool buffered_output_present, | 100 bool buffered_output_present, |
| 100 bool decoding_not_finished) = 0; | 101 bool decoding_not_finished) = 0; |
| 101 }; | 102 }; |
| 102 | 103 |
| 103 SdchSourceStream(std::unique_ptr<SourceStream> previous, | 104 SdchSourceStream(std::unique_ptr<SourceStream> previous, |
| 104 std::unique_ptr<Delegate> delegate, | 105 std::unique_ptr<Delegate> delegate, |
| 105 SourceStream::SourceType type); | 106 SourceStream::SourceType type); |
| 106 ~SdchSourceStream() override; | 107 ~SdchSourceStream() override; |
| 107 | 108 |
| 109 void DumpMemoryStatsImpl( |
| 110 base::trace_event::MemoryAllocatorDump* dump) const override; |
| 111 |
| 108 private: | 112 private: |
| 109 // SourceStream implementation: | 113 // SourceStream implementation: |
| 110 std::string GetTypeAsString() const override; | 114 std::string GetTypeAsString() const override; |
| 111 int FilterData(IOBuffer* output_buffer, | 115 int FilterData(IOBuffer* output_buffer, |
| 112 int output_buffer_size, | 116 int output_buffer_size, |
| 113 IOBuffer* input_buffer, | 117 IOBuffer* input_buffer, |
| 114 int input_buffer_size, | 118 int input_buffer_size, |
| 115 int* consumed_bytes, | 119 int* consumed_bytes, |
| 116 bool upstream_end_reached) override; | 120 bool upstream_end_reached) override; |
| 117 | 121 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 138 | 142 |
| 139 // State of the input stream. | 143 // State of the input stream. |
| 140 InputState input_state_; | 144 InputState input_state_; |
| 141 | 145 |
| 142 DISALLOW_COPY_AND_ASSIGN(SdchSourceStream); | 146 DISALLOW_COPY_AND_ASSIGN(SdchSourceStream); |
| 143 }; | 147 }; |
| 144 | 148 |
| 145 } // namespace net | 149 } // namespace net |
| 146 | 150 |
| 147 #endif // NET_FILTER_SDCH_SOURCE_STREAM_H_ | 151 #endif // NET_FILTER_SDCH_SOURCE_STREAM_H_ |
| OLD | NEW |