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

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

Issue 711753003: Pin dictionaries from being deleted while request is outstanding. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporated comments; fixed try job errors. Created 6 years, 1 month 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
OLDNEW
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 48
49 #include <string> 49 #include <string>
50 #include <vector> 50 #include <vector>
51 51
52 #include "base/basictypes.h" 52 #include "base/basictypes.h"
53 #include "base/gtest_prod_util.h" 53 #include "base/gtest_prod_util.h"
54 #include "base/memory/ref_counted.h" 54 #include "base/memory/ref_counted.h"
55 #include "base/memory/scoped_ptr.h" 55 #include "base/memory/scoped_ptr.h"
56 #include "base/time/time.h" 56 #include "base/time/time.h"
57 #include "net/base/net_export.h" 57 #include "net/base/net_export.h"
58 #include "net/base/sdch_manager.h"
58 59
59 class GURL; 60 class GURL;
60 61
61 namespace net { 62 namespace net {
62 63
63 class URLRequestContext; 64 class URLRequestContext;
64 class IOBuffer; 65 class IOBuffer;
65 66
66 //------------------------------------------------------------------------------ 67 //------------------------------------------------------------------------------
67 // Define an interface class that allows access to contextual information 68 // Define an interface class that allows access to contextual information
68 // supplied by the owner of this filter. In the case where there are a chain of 69 // supplied by the owner of this filter. In the case where there are a chain of
69 // filters, there is only one owner of all the chained filters, and that context 70 // filters, there is only one owner of all the chained filters, and that context
70 // is passed to the constructor of all those filters. To be clear, the context 71 // is passed to the constructor of all those filters. To be clear, the context
71 // does NOT reflect the position in a chain, or the fact that there are prior 72 // does NOT reflect the position in a chain, or the fact that there are prior
72 // or later filters in a chain. 73 // or later filters in a chain.
74 //
75 // TODO(rdsmith): FilterContext is a grab-bag of methods which may or may
76 // not be relevant for any particular filter, and it's getting worse over
77 // time. In addition, it only supports two filters, sdch and gzip.
Ryan Sleevi 2014/11/14 03:21:25 s/sdch/SDCH/
Randy Smith (Not in Mondays) 2014/11/17 17:04:22 Done.
78 // It would make more sense to implement FilterContext as a
79 // base::SupportsUserData structure to which filter-specific information
80 // could be added by whatever the ultimate consumer of the filter chain is,
81 // and a particular filter (if included) could access that information.
73 class NET_EXPORT_PRIVATE FilterContext { 82 class NET_EXPORT_PRIVATE FilterContext {
74 public: 83 public:
75 // Enum to control what histograms are emitted near end-of-life of this 84 // Enum to control what histograms are emitted near end-of-life of this
76 // instance. 85 // instance.
77 enum StatisticSelector { 86 enum StatisticSelector {
78 SDCH_DECODE, 87 SDCH_DECODE,
79 SDCH_PASSTHROUGH, 88 SDCH_PASSTHROUGH,
80 SDCH_EXPERIMENT_DECODE, 89 SDCH_EXPERIMENT_DECODE,
81 SDCH_EXPERIMENT_HOLDBACK, 90 SDCH_EXPERIMENT_HOLDBACK,
82 }; 91 };
(...skipping 16 matching lines...) Expand all
99 // When was this data requested from a server? 108 // When was this data requested from a server?
100 virtual base::Time GetRequestTime() const = 0; 109 virtual base::Time GetRequestTime() const = 0;
101 110
102 // Is data supplied from cache, or fresh across the net? 111 // Is data supplied from cache, or fresh across the net?
103 virtual bool IsCachedContent() const = 0; 112 virtual bool IsCachedContent() const = 0;
104 113
105 // Is this a download? 114 // Is this a download?
106 virtual bool IsDownload() const = 0; 115 virtual bool IsDownload() const = 0;
107 116
108 // Was this data flagged as a response to a request with an SDCH dictionary? 117 // Was this data flagged as a response to a request with an SDCH dictionary?
109 virtual bool SdchResponseExpected() const = 0; 118 virtual SdchManager::DictionarySet* SdchDictionariesAdvertised() const = 0;
110 119
111 // How many bytes were read from the net or cache so far (and potentially 120 // How many bytes were read from the net or cache so far (and potentially
112 // pushed into a filter for processing)? 121 // pushed into a filter for processing)?
113 virtual int64 GetByteReadCount() const = 0; 122 virtual int64 GetByteReadCount() const = 0;
114 123
115 // What response code was received with the associated network transaction? 124 // What response code was received with the associated network transaction?
116 // For example: 200 is ok. 4xx are error codes. etc. 125 // For example: 200 is ok. 4xx are error codes. etc.
117 virtual int GetResponseCode() const = 0; 126 virtual int GetResponseCode() const = 0;
118 127
119 // The URLRequestContext associated with the request. 128 // The URLRequestContext associated with the request.
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 // Remember what status or local filter last returned so we can better handle 302 // Remember what status or local filter last returned so we can better handle
294 // chained filters. 303 // chained filters.
295 FilterStatus last_status_; 304 FilterStatus last_status_;
296 305
297 DISALLOW_COPY_AND_ASSIGN(Filter); 306 DISALLOW_COPY_AND_ASSIGN(Filter);
298 }; 307 };
299 308
300 } // namespace net 309 } // namespace net
301 310
302 #endif // NET_FILTER_FILTER_H__ 311 #endif // NET_FILTER_FILTER_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698