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 #ifndef NET_URL_REQUEST_URL_REQUEST_JOB_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_JOB_H_ |
6 #define NET_URL_REQUEST_URL_REQUEST_JOB_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_JOB_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 // Returns a array of strings showing the sequential encodings used on the | 122 // Returns a array of strings showing the sequential encodings used on the |
123 // content. | 123 // content. |
124 // For example, encoding_types[0] = FILTER_TYPE_SDCH and encoding_types[1] = | 124 // For example, encoding_types[0] = FILTER_TYPE_SDCH and encoding_types[1] = |
125 // FILTER_TYPE_GZIP, means the content was first encoded by sdch, and then | 125 // FILTER_TYPE_GZIP, means the content was first encoded by sdch, and then |
126 // result was encoded by gzip. To decode, a series of filters must be applied | 126 // result was encoded by gzip. To decode, a series of filters must be applied |
127 // in the reverse order (in the above example, ungzip first, and then sdch | 127 // in the reverse order (in the above example, ungzip first, and then sdch |
128 // expand). | 128 // expand). |
129 virtual bool GetContentEncodings( | 129 virtual bool GetContentEncodings( |
130 std::vector<Filter::FilterType>* encoding_types); | 130 std::vector<Filter::FilterType>* encoding_types); |
131 | 131 |
132 // Find out if this is a download. | |
133 virtual bool IsDownload() const; | |
134 | |
135 // Find out if this is a response to a request that advertised an SDCH | |
136 // dictionary. Only makes sense for some types of requests. | |
137 virtual bool IsSdchResponse() const; | |
138 | |
139 // Called to setup stream filter for this request. An example of filter is | 132 // Called to setup stream filter for this request. An example of filter is |
140 // content encoding/decoding. | 133 // content encoding/decoding. |
141 void SetupFilter(); | 134 void SetupFilter(); |
142 | 135 |
143 // Called to determine if this response is a redirect. Only makes sense | 136 // Called to determine if this response is a redirect. Only makes sense |
144 // for some types of requests. This method returns true if the response | 137 // for some types of requests. This method returns true if the response |
145 // is a redirect, and fills in the location param with the URL of the | 138 // is a redirect, and fills in the location param with the URL of the |
146 // redirect. The HTTP status code (e.g., 302) is filled into | 139 // redirect. The HTTP status code (e.g., 302) is filled into |
147 // |*http_status_code| to signify the type of redirect. | 140 // |*http_status_code| to signify the type of redirect. |
148 // | 141 // |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 } | 194 } |
202 | 195 |
203 // Whether we have processed the response for that request yet. | 196 // Whether we have processed the response for that request yet. |
204 bool has_response_started() const { return has_handled_response_; } | 197 bool has_response_started() const { return has_handled_response_; } |
205 | 198 |
206 // FilterContext methods: | 199 // FilterContext methods: |
207 // These methods are not applicable to all connections. | 200 // These methods are not applicable to all connections. |
208 virtual bool GetMimeType(std::string* mime_type) const; | 201 virtual bool GetMimeType(std::string* mime_type) const; |
209 virtual bool GetURL(GURL* gurl) const; | 202 virtual bool GetURL(GURL* gurl) const; |
210 virtual base::Time GetRequestTime() const; | 203 virtual base::Time GetRequestTime() const; |
| 204 virtual bool IsDownload() const; |
| 205 virtual bool IsSdchResponse() const; |
211 virtual bool IsCachedContent() const; | 206 virtual bool IsCachedContent() const; |
212 virtual int64 GetByteReadCount() const; | 207 virtual int64 GetByteReadCount() const; |
213 virtual int GetResponseCode() const; | 208 virtual int GetResponseCode() const; |
214 virtual int GetInputStreamBufferSize() const; | 209 virtual int GetInputStreamBufferSize() const; |
215 virtual void RecordPacketStats(StatisticSelector statistic) const; | 210 virtual void RecordPacketStats(StatisticSelector statistic) const; |
216 | 211 |
217 protected: | 212 protected: |
218 friend class base::RefCounted<URLRequestJob>; | 213 friend class base::RefCounted<URLRequestJob>; |
219 virtual ~URLRequestJob(); | 214 virtual ~URLRequestJob(); |
220 | 215 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 // Facilitate histogramming by turning on packet counting. | 265 // Facilitate histogramming by turning on packet counting. |
271 // If called more than once, the largest value will be used. | 266 // If called more than once, the largest value will be used. |
272 void EnablePacketCounting(size_t max_packets_timed); | 267 void EnablePacketCounting(size_t max_packets_timed); |
273 | 268 |
274 // At or near destruction time, a derived class may request that the filters | 269 // At or near destruction time, a derived class may request that the filters |
275 // be destroyed so that statistics can be gathered while the derived class is | 270 // be destroyed so that statistics can be gathered while the derived class is |
276 // still present to assist in calculations. This is used by URLRequestHttpJob | 271 // still present to assist in calculations. This is used by URLRequestHttpJob |
277 // to get SDCH to emit stats. | 272 // to get SDCH to emit stats. |
278 void DestroyFilters() { filter_.reset(); } | 273 void DestroyFilters() { filter_.reset(); } |
279 | 274 |
280 // The request that initiated this job. This value MAY BE NULL if the | |
281 // request was released by DetachRequest(). | |
282 net::URLRequest* request_; | |
283 | |
284 // The status of the job. | 275 // The status of the job. |
285 const net::URLRequestStatus GetStatus(); | 276 const net::URLRequestStatus GetStatus(); |
286 | 277 |
287 // Set the status of the job. | 278 // Set the status of the job. |
288 void SetStatus(const net::URLRequestStatus& status); | 279 void SetStatus(const net::URLRequestStatus& status); |
289 | 280 |
| 281 // The request that initiated this job. This value MAY BE NULL if the |
| 282 // request was released by DetachRequest(). |
| 283 net::URLRequest* request_; |
| 284 |
290 // Whether the job is doing performance profiling | 285 // Whether the job is doing performance profiling |
291 bool is_profiling_; | 286 bool is_profiling_; |
292 | 287 |
293 // Contains IO performance measurement when profiling is enabled. | 288 // Contains IO performance measurement when profiling is enabled. |
294 scoped_ptr<URLRequestJobMetrics> metrics_; | 289 scoped_ptr<URLRequestJobMetrics> metrics_; |
295 | 290 |
296 // The number of bytes read before passing to the filter. | 291 // The number of bytes read before passing to the filter. |
297 int prefilter_bytes_read_; | 292 int prefilter_bytes_read_; |
298 // The number of bytes read after passing through the filter. | 293 // The number of bytes read after passing through the filter. |
299 int postfilter_bytes_read_; | 294 int postfilter_bytes_read_; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 // The count of the number of packets, some of which may not have been timed. | 413 // The count of the number of packets, some of which may not have been timed. |
419 // We're ignoring overflow, as 1430 x 2^31 is a LOT of bytes. | 414 // We're ignoring overflow, as 1430 x 2^31 is a LOT of bytes. |
420 int observed_packet_count_; | 415 int observed_packet_count_; |
421 | 416 |
422 DISALLOW_COPY_AND_ASSIGN(URLRequestJob); | 417 DISALLOW_COPY_AND_ASSIGN(URLRequestJob); |
423 }; | 418 }; |
424 | 419 |
425 } // namespace net | 420 } // namespace net |
426 | 421 |
427 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_H_ | 422 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_H_ |
OLD | NEW |