OLD | NEW |
1 // Copyright (c) 2010 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> |
11 | 11 |
12 #include "base/ref_counted.h" | 12 #include "base/ref_counted.h" |
13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
14 #include "base/string16.h" | 14 #include "base/string16.h" |
15 #include "base/time.h" | 15 #include "base/time.h" |
16 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
17 #include "net/base/filter.h" | 17 #include "net/base/filter.h" |
18 #include "net/base/load_states.h" | 18 #include "net/base/load_states.h" |
19 | 19 |
20 class URLRequestStatus; | |
21 | 20 |
22 namespace net { | 21 namespace net { |
23 | 22 |
24 class AuthChallengeInfo; | 23 class AuthChallengeInfo; |
25 class HttpRequestHeaders; | 24 class HttpRequestHeaders; |
26 class HttpResponseInfo; | 25 class HttpResponseInfo; |
27 class IOBuffer; | 26 class IOBuffer; |
28 class URLRequest; | 27 class URLRequest; |
29 class URLRequestJobMetrics; | 28 class URLRequestJobMetrics; |
30 class UploadData; | 29 class UploadData; |
| 30 class URLRequestStatus; |
31 class X509Certificate; | 31 class X509Certificate; |
32 | 32 |
33 class URLRequestJob : public base::RefCounted<URLRequestJob>, | 33 class URLRequestJob : public base::RefCounted<URLRequestJob>, |
34 public FilterContext { | 34 public FilterContext { |
35 public: | 35 public: |
36 // When histogramming results related to SDCH and/or an SDCH latency test, the | 36 // When histogramming results related to SDCH and/or an SDCH latency test, the |
37 // number of packets for which we need to record arrival times so as to | 37 // number of packets for which we need to record arrival times so as to |
38 // calculate interpacket latencies. We currently are only looking at the | 38 // calculate interpacket latencies. We currently are only looking at the |
39 // first few packets, as we're monitoring the impact of the initial TCP | 39 // first few packets, as we're monitoring the impact of the initial TCP |
40 // congestion window on stalling of transmissions. | 40 // congestion window on stalling of transmissions. |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 friend class base::RefCounted<URLRequestJob>; | 218 friend class base::RefCounted<URLRequestJob>; |
219 virtual ~URLRequestJob(); | 219 virtual ~URLRequestJob(); |
220 | 220 |
221 // Notifies the job that headers have been received. | 221 // Notifies the job that headers have been received. |
222 void NotifyHeadersComplete(); | 222 void NotifyHeadersComplete(); |
223 | 223 |
224 // Notifies the request that the job has completed a Read operation. | 224 // Notifies the request that the job has completed a Read operation. |
225 void NotifyReadComplete(int bytes_read); | 225 void NotifyReadComplete(int bytes_read); |
226 | 226 |
227 // Notifies the request that a start error has occurred. | 227 // Notifies the request that a start error has occurred. |
228 void NotifyStartError(const URLRequestStatus& status); | 228 void NotifyStartError(const net::URLRequestStatus& status); |
229 | 229 |
230 // NotifyDone marks when we are done with a request. It is really | 230 // NotifyDone marks when we are done with a request. It is really |
231 // a glorified set_status, but also does internal state checking and | 231 // a glorified set_status, but also does internal state checking and |
232 // job tracking. It should be called once per request, when the job is | 232 // job tracking. It should be called once per request, when the job is |
233 // finished doing all IO. | 233 // finished doing all IO. |
234 void NotifyDone(const URLRequestStatus& status); | 234 void NotifyDone(const net::URLRequestStatus& status); |
235 | 235 |
236 // Some work performed by NotifyDone must be completed on a separate task | 236 // Some work performed by NotifyDone must be completed on a separate task |
237 // so as to avoid re-entering the delegate. This method exists to perform | 237 // so as to avoid re-entering the delegate. This method exists to perform |
238 // that work. | 238 // that work. |
239 void CompleteNotifyDone(); | 239 void CompleteNotifyDone(); |
240 | 240 |
241 // Used as an asynchronous callback for Kill to notify the net::URLRequest | 241 // Used as an asynchronous callback for Kill to notify the net::URLRequest |
242 // that we were canceled. | 242 // that we were canceled. |
243 void NotifyCanceled(); | 243 void NotifyCanceled(); |
244 | 244 |
(...skipping 30 matching lines...) Expand all Loading... |
275 // be destroyed so that statistics can be gathered while the derived class is | 275 // 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 | 276 // still present to assist in calculations. This is used by URLRequestHttpJob |
277 // to get SDCH to emit stats. | 277 // to get SDCH to emit stats. |
278 void DestroyFilters() { filter_.reset(); } | 278 void DestroyFilters() { filter_.reset(); } |
279 | 279 |
280 // The request that initiated this job. This value MAY BE NULL if the | 280 // The request that initiated this job. This value MAY BE NULL if the |
281 // request was released by DetachRequest(). | 281 // request was released by DetachRequest(). |
282 net::URLRequest* request_; | 282 net::URLRequest* request_; |
283 | 283 |
284 // The status of the job. | 284 // The status of the job. |
285 const URLRequestStatus GetStatus(); | 285 const net::URLRequestStatus GetStatus(); |
286 | 286 |
287 // Set the status of the job. | 287 // Set the status of the job. |
288 void SetStatus(const URLRequestStatus& status); | 288 void SetStatus(const net::URLRequestStatus& status); |
289 | 289 |
290 // Whether the job is doing performance profiling | 290 // Whether the job is doing performance profiling |
291 bool is_profiling_; | 291 bool is_profiling_; |
292 | 292 |
293 // Contains IO performance measurement when profiling is enabled. | 293 // Contains IO performance measurement when profiling is enabled. |
294 scoped_ptr<URLRequestJobMetrics> metrics_; | 294 scoped_ptr<URLRequestJobMetrics> metrics_; |
295 | 295 |
296 // The number of bytes read before passing to the filter. | 296 // The number of bytes read before passing to the filter. |
297 int prefilter_bytes_read_; | 297 int prefilter_bytes_read_; |
298 // The number of bytes read after passing through the filter. | 298 // The number of bytes read after passing through the filter. |
(...skipping 119 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. | 418 // 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. | 419 // We're ignoring overflow, as 1430 x 2^31 is a LOT of bytes. |
420 int observed_packet_count_; | 420 int observed_packet_count_; |
421 | 421 |
422 DISALLOW_COPY_AND_ASSIGN(URLRequestJob); | 422 DISALLOW_COPY_AND_ASSIGN(URLRequestJob); |
423 }; | 423 }; |
424 | 424 |
425 } // namespace net | 425 } // namespace net |
426 | 426 |
427 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_H_ | 427 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_H_ |
OLD | NEW |