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

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

Issue 6969077: net: Add NET_API to net/base (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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
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 // 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
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 42
42 class GURL; 43 class GURL;
43 44
44 namespace net { 45 namespace net {
45 46
46 class IOBuffer; 47 class IOBuffer;
47 48
48 //------------------------------------------------------------------------------ 49 //------------------------------------------------------------------------------
49 // Define an interface class that allows access to contextual information 50 // Define an interface class that allows access to contextual information
50 // 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
51 // 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
52 // 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
53 // 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
54 // or later filters in a chain. 55 // or later filters in a chain.
55 class FilterContext { 56 class NET_TEST FilterContext {
56 public: 57 public:
57 // 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
58 // instance. 59 // instance.
59 enum StatisticSelector { 60 enum StatisticSelector {
60 SDCH_DECODE, 61 SDCH_DECODE,
61 SDCH_PASSTHROUGH, 62 SDCH_PASSTHROUGH,
62 SDCH_EXPERIMENT_DECODE, 63 SDCH_EXPERIMENT_DECODE,
63 SDCH_EXPERIMENT_HOLDBACK, 64 SDCH_EXPERIMENT_HOLDBACK,
64 }; 65 };
65 66
(...skipping 27 matching lines...) Expand all
93 // What response code was received with the associated network transaction? 94 // What response code was received with the associated network transaction?
94 // For example: 200 is ok. 4xx are error codes. etc. 95 // For example: 200 is ok. 4xx are error codes. etc.
95 virtual int GetResponseCode() const = 0; 96 virtual int GetResponseCode() const = 0;
96 97
97 // 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
98 // statistics as selected by the argument. 99 // statistics as selected by the argument.
99 virtual void RecordPacketStats(StatisticSelector statistic) const = 0; 100 virtual void RecordPacketStats(StatisticSelector statistic) const = 0;
100 }; 101 };
101 102
102 //------------------------------------------------------------------------------ 103 //------------------------------------------------------------------------------
103 class Filter { 104 class NET_TEST Filter {
104 public: 105 public:
105 // Return values of function ReadFilteredData. 106 // Return values of function ReadFilteredData.
106 enum FilterStatus { 107 enum FilterStatus {
107 // Read filtered data successfully 108 // Read filtered data successfully
108 FILTER_OK, 109 FILTER_OK,
109 // 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
110 // 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
111 // 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
112 // buffer to provide more data. 113 // buffer to provide more data.
113 FILTER_NEED_MORE_DATA, 114 FILTER_NEED_MORE_DATA,
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 // 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
268 // chained filters. 269 // chained filters.
269 FilterStatus last_status_; 270 FilterStatus last_status_;
270 271
271 DISALLOW_COPY_AND_ASSIGN(Filter); 272 DISALLOW_COPY_AND_ASSIGN(Filter);
272 }; 273 };
273 274
274 } // namespace net 275 } // namespace net
275 276
276 #endif // NET_BASE_FILTER_H__ 277 #endif // NET_BASE_FILTER_H__
OLDNEW
« base/compiler_specific.h ('K') | « net/base/file_stream.h ('k') | net/base/host_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698