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 30 matching lines...) Expand all Loading... |
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> | 49 #include <stdint.h> |
50 | 50 |
| 51 #include <memory> |
51 #include <string> | 52 #include <string> |
52 #include <vector> | 53 #include <vector> |
53 | 54 |
54 #include "base/gtest_prod_util.h" | 55 #include "base/gtest_prod_util.h" |
55 #include "base/macros.h" | 56 #include "base/macros.h" |
56 #include "base/memory/ref_counted.h" | 57 #include "base/memory/ref_counted.h" |
57 #include "base/memory/scoped_ptr.h" | |
58 #include "base/time/time.h" | 58 #include "base/time/time.h" |
59 #include "net/base/net_export.h" | 59 #include "net/base/net_export.h" |
60 #include "net/base/sdch_manager.h" | 60 #include "net/base/sdch_manager.h" |
61 | 61 |
62 class GURL; | 62 class GURL; |
63 | 63 |
64 namespace net { | 64 namespace net { |
65 | 65 |
66 class BoundNetLog; | 66 class BoundNetLog; |
67 class IOBuffer; | 67 class IOBuffer; |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 // Helper function to empty our output into the next filter's input. | 301 // Helper function to empty our output into the next filter's input. |
302 void PushDataIntoNextFilter(); | 302 void PushDataIntoNextFilter(); |
303 | 303 |
304 // Constructs a filter with an internal buffer of the given size. | 304 // Constructs a filter with an internal buffer of the given size. |
305 // Only meant to be called by unit tests that need to control the buffer size. | 305 // Only meant to be called by unit tests that need to control the buffer size. |
306 static Filter* FactoryForTests(const std::vector<FilterType>& filter_types, | 306 static Filter* FactoryForTests(const std::vector<FilterType>& filter_types, |
307 const FilterContext& filter_context, | 307 const FilterContext& filter_context, |
308 int buffer_size); | 308 int buffer_size); |
309 | 309 |
310 // An optional filter to process output from this filter. | 310 // An optional filter to process output from this filter. |
311 scoped_ptr<Filter> next_filter_; | 311 std::unique_ptr<Filter> next_filter_; |
312 | 312 |
313 // Remember what status or local filter last returned so we can better handle | 313 // Remember what status or local filter last returned so we can better handle |
314 // chained filters. | 314 // chained filters. |
315 FilterStatus last_status_; | 315 FilterStatus last_status_; |
316 | 316 |
317 // The filter type this filter was constructed from. | 317 // The filter type this filter was constructed from. |
318 FilterType type_id_; | 318 FilterType type_id_; |
319 | 319 |
320 DISALLOW_COPY_AND_ASSIGN(Filter); | 320 DISALLOW_COPY_AND_ASSIGN(Filter); |
321 }; | 321 }; |
322 | 322 |
323 } // namespace net | 323 } // namespace net |
324 | 324 |
325 #endif // NET_FILTER_FILTER_H__ | 325 #endif // NET_FILTER_FILTER_H__ |
OLD | NEW |