| OLD | NEW |
| 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 // Filter performs filtering on data streams. Sample usage: | 5 // Filter performs filtering on data streams. Sample usage: |
| 6 // | 6 // |
| 7 // IStream* pre_filter_source; | 7 // IStream* pre_filter_source; |
| 8 // ... | 8 // ... |
| 9 // Filter* filter = Filter::Factory(filter_type, size); | 9 // Filter* filter = Filter::Factory(filter_type, size); |
| 10 // int pre_filter_data_len = filter->stream_buffer_size(); | 10 // int pre_filter_data_len = filter->stream_buffer_size(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #pragma once | 31 #pragma once |
| 32 | 32 |
| 33 #include <string> | 33 #include <string> |
| 34 #include <vector> | 34 #include <vector> |
| 35 | 35 |
| 36 #include "base/basictypes.h" | 36 #include "base/basictypes.h" |
| 37 #include "base/gtest_prod_util.h" | 37 #include "base/gtest_prod_util.h" |
| 38 #include "base/memory/ref_counted.h" | 38 #include "base/memory/ref_counted.h" |
| 39 #include "base/memory/scoped_ptr.h" | 39 #include "base/memory/scoped_ptr.h" |
| 40 #include "base/time.h" | 40 #include "base/time.h" |
| 41 #include "net/base/net_api.h" | 41 #include "net/base/net_export.h" |
| 42 | 42 |
| 43 class GURL; | 43 class GURL; |
| 44 | 44 |
| 45 namespace net { | 45 namespace net { |
| 46 | 46 |
| 47 class IOBuffer; | 47 class IOBuffer; |
| 48 | 48 |
| 49 //------------------------------------------------------------------------------ | 49 //------------------------------------------------------------------------------ |
| 50 // Define an interface class that allows access to contextual information | 50 // Define an interface class that allows access to contextual information |
| 51 // supplied by the owner of this filter. In the case where there are a chain of | 51 // supplied by the owner of this filter. In the case where there are a chain of |
| 52 // filters, there is only one owner of all the chained filters, and that context | 52 // filters, there is only one owner of all the chained filters, and that context |
| 53 // is passed to the constructor of all those filters. To be clear, the context | 53 // is passed to the constructor of all those filters. To be clear, the context |
| 54 // does NOT reflect the position in a chain, or the fact that there are prior | 54 // does NOT reflect the position in a chain, or the fact that there are prior |
| 55 // or later filters in a chain. | 55 // or later filters in a chain. |
| 56 class NET_TEST FilterContext { | 56 class NET_EXPORT_PRIVATE FilterContext { |
| 57 public: | 57 public: |
| 58 // Enum to control what histograms are emitted near end-of-life of this | 58 // Enum to control what histograms are emitted near end-of-life of this |
| 59 // instance. | 59 // instance. |
| 60 enum StatisticSelector { | 60 enum StatisticSelector { |
| 61 SDCH_DECODE, | 61 SDCH_DECODE, |
| 62 SDCH_PASSTHROUGH, | 62 SDCH_PASSTHROUGH, |
| 63 SDCH_EXPERIMENT_DECODE, | 63 SDCH_EXPERIMENT_DECODE, |
| 64 SDCH_EXPERIMENT_HOLDBACK, | 64 SDCH_EXPERIMENT_HOLDBACK, |
| 65 }; | 65 }; |
| 66 | 66 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 94 // What response code was received with the associated network transaction? | 94 // What response code was received with the associated network transaction? |
| 95 // For example: 200 is ok. 4xx are error codes. etc. | 95 // For example: 200 is ok. 4xx are error codes. etc. |
| 96 virtual int GetResponseCode() const = 0; | 96 virtual int GetResponseCode() const = 0; |
| 97 | 97 |
| 98 // The following method forces the context to emit a specific set of | 98 // The following method forces the context to emit a specific set of |
| 99 // statistics as selected by the argument. | 99 // statistics as selected by the argument. |
| 100 virtual void RecordPacketStats(StatisticSelector statistic) const = 0; | 100 virtual void RecordPacketStats(StatisticSelector statistic) const = 0; |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 //------------------------------------------------------------------------------ | 103 //------------------------------------------------------------------------------ |
| 104 class NET_TEST Filter { | 104 class NET_EXPORT_PRIVATE Filter { |
| 105 public: | 105 public: |
| 106 // Return values of function ReadFilteredData. | 106 // Return values of function ReadFilteredData. |
| 107 enum FilterStatus { | 107 enum FilterStatus { |
| 108 // Read filtered data successfully | 108 // Read filtered data successfully |
| 109 FILTER_OK, | 109 FILTER_OK, |
| 110 // Read filtered data successfully, and the data in the buffer has been | 110 // Read filtered data successfully, and the data in the buffer has been |
| 111 // consumed by the filter, but more data is needed in order to continue | 111 // consumed by the filter, but more data is needed in order to continue |
| 112 // filtering. At this point, the caller is free to reuse the filter | 112 // filtering. At this point, the caller is free to reuse the filter |
| 113 // buffer to provide more data. | 113 // buffer to provide more data. |
| 114 FILTER_NEED_MORE_DATA, | 114 FILTER_NEED_MORE_DATA, |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 // Remember what status or local filter last returned so we can better handle | 268 // Remember what status or local filter last returned so we can better handle |
| 269 // chained filters. | 269 // chained filters. |
| 270 FilterStatus last_status_; | 270 FilterStatus last_status_; |
| 271 | 271 |
| 272 DISALLOW_COPY_AND_ASSIGN(Filter); | 272 DISALLOW_COPY_AND_ASSIGN(Filter); |
| 273 }; | 273 }; |
| 274 | 274 |
| 275 } // namespace net | 275 } // namespace net |
| 276 | 276 |
| 277 #endif // NET_BASE_FILTER_H__ | 277 #endif // NET_BASE_FILTER_H__ |
| OLD | NEW |