| 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 // 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 28 matching lines...) Expand all Loading... |
| 39 // they are done (e.g. a pass-through filter will always | 39 // they are done (e.g. a pass-through filter will always |
| 40 // say FILTER_NEED_MORE_DATA), so the consumer will also need to | 40 // say FILTER_NEED_MORE_DATA), so the consumer will also need to |
| 41 // recognize the state of |no_more_input_data_available && | 41 // recognize the state of |no_more_input_data_available && |
| 42 // filter->stream_data_len() == 0| as FILTER_DONE. | 42 // filter->stream_data_len() == 0| as FILTER_DONE. |
| 43 // | 43 // |
| 44 // The lifetime of a Filter instance is completely controlled by its caller. | 44 // The lifetime of a Filter instance is completely controlled by its caller. |
| 45 | 45 |
| 46 #ifndef NET_FILTER_FILTER_H__ | 46 #ifndef NET_FILTER_FILTER_H__ |
| 47 #define NET_FILTER_FILTER_H__ | 47 #define NET_FILTER_FILTER_H__ |
| 48 | 48 |
| 49 #include <stdint.h> |
| 50 |
| 49 #include <string> | 51 #include <string> |
| 50 #include <vector> | 52 #include <vector> |
| 51 | 53 |
| 52 #include "base/basictypes.h" | |
| 53 #include "base/gtest_prod_util.h" | 54 #include "base/gtest_prod_util.h" |
| 55 #include "base/macros.h" |
| 54 #include "base/memory/ref_counted.h" | 56 #include "base/memory/ref_counted.h" |
| 55 #include "base/memory/scoped_ptr.h" | 57 #include "base/memory/scoped_ptr.h" |
| 56 #include "base/time/time.h" | 58 #include "base/time/time.h" |
| 57 #include "net/base/net_export.h" | 59 #include "net/base/net_export.h" |
| 58 #include "net/base/sdch_manager.h" | 60 #include "net/base/sdch_manager.h" |
| 59 | 61 |
| 60 class GURL; | 62 class GURL; |
| 61 | 63 |
| 62 namespace net { | 64 namespace net { |
| 63 | 65 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 virtual base::Time GetRequestTime() const = 0; | 108 virtual base::Time GetRequestTime() const = 0; |
| 107 | 109 |
| 108 // Is data supplied from cache, or fresh across the net? | 110 // Is data supplied from cache, or fresh across the net? |
| 109 virtual bool IsCachedContent() const = 0; | 111 virtual bool IsCachedContent() const = 0; |
| 110 | 112 |
| 111 // Was this data flagged as a response to a request with an SDCH dictionary? | 113 // Was this data flagged as a response to a request with an SDCH dictionary? |
| 112 virtual SdchManager::DictionarySet* SdchDictionariesAdvertised() const = 0; | 114 virtual SdchManager::DictionarySet* SdchDictionariesAdvertised() const = 0; |
| 113 | 115 |
| 114 // How many bytes were read from the net or cache so far (and potentially | 116 // How many bytes were read from the net or cache so far (and potentially |
| 115 // pushed into a filter for processing)? | 117 // pushed into a filter for processing)? |
| 116 virtual int64 GetByteReadCount() const = 0; | 118 virtual int64_t GetByteReadCount() const = 0; |
| 117 | 119 |
| 118 // What response code was received with the associated network transaction? | 120 // What response code was received with the associated network transaction? |
| 119 // For example: 200 is ok. 4xx are error codes. etc. | 121 // For example: 200 is ok. 4xx are error codes. etc. |
| 120 virtual int GetResponseCode() const = 0; | 122 virtual int GetResponseCode() const = 0; |
| 121 | 123 |
| 122 // The URLRequestContext associated with the request. | 124 // The URLRequestContext associated with the request. |
| 123 virtual const URLRequestContext* GetURLRequestContext() const = 0; | 125 virtual const URLRequestContext* GetURLRequestContext() const = 0; |
| 124 | 126 |
| 125 // The following method forces the context to emit a specific set of | 127 // The following method forces the context to emit a specific set of |
| 126 // statistics as selected by the argument. | 128 // statistics as selected by the argument. |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 | 308 |
| 307 // The filter type this filter was constructed from. | 309 // The filter type this filter was constructed from. |
| 308 FilterType type_id_; | 310 FilterType type_id_; |
| 309 | 311 |
| 310 DISALLOW_COPY_AND_ASSIGN(Filter); | 312 DISALLOW_COPY_AND_ASSIGN(Filter); |
| 311 }; | 313 }; |
| 312 | 314 |
| 313 } // namespace net | 315 } // namespace net |
| 314 | 316 |
| 315 #endif // NET_FILTER_FILTER_H__ | 317 #endif // NET_FILTER_FILTER_H__ |
| OLD | NEW |