OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 namespace net { | 20 namespace net { |
21 class AuthChallengeInfo; | 21 class AuthChallengeInfo; |
22 class HttpRequestHeaders; | 22 class HttpRequestHeaders; |
23 class HttpResponseInfo; | 23 class HttpResponseInfo; |
24 class IOBuffer; | 24 class IOBuffer; |
25 class UploadData; | 25 class UploadData; |
26 class URLRequest; | |
26 class X509Certificate; | 27 class X509Certificate; |
27 } | 28 } // namespace net |
28 | 29 |
29 class URLRequest; | |
30 class URLRequestStatus; | 30 class URLRequestStatus; |
31 class URLRequestJobMetrics; | 31 class URLRequestJobMetrics; |
32 | 32 |
33 namespace net { | |
34 | |
33 class URLRequestJob : public base::RefCounted<URLRequestJob>, | 35 class URLRequestJob : public base::RefCounted<URLRequestJob>, |
34 public FilterContext { | 36 public FilterContext { |
35 public: | 37 public: |
36 // When histogramming results related to SDCH and/or an SDCH latency test, the | 38 // 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 | 39 // 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 | 40 // calculate interpacket latencies. We currently are only looking at the |
39 // first few packets, as we're monitoring the impact of the initial TCP | 41 // first few packets, as we're monitoring the impact of the initial TCP |
40 // congestion window on stalling of transmissions. | 42 // congestion window on stalling of transmissions. |
41 static const size_t kSdchPacketHistogramCount = 5; | 43 static const size_t kSdchPacketHistogramCount = 5; |
42 | 44 |
43 explicit URLRequestJob(URLRequest* request); | 45 explicit URLRequestJob(net::URLRequest* request); |
wtc
2010/11/30 01:51:53
Don't need to add net:: to URLRequest because most
| |
44 | 46 |
45 // Returns the request that owns this job. THIS POINTER MAY BE NULL if the | 47 // Returns the request that owns this job. THIS POINTER MAY BE NULL if the |
46 // request was destroyed. | 48 // request was destroyed. |
47 URLRequest* request() const { | 49 net::URLRequest* request() const { |
48 return request_; | 50 return request_; |
49 } | 51 } |
50 | 52 |
51 // Sets the upload data, most requests have no upload data, so this is a NOP. | 53 // Sets the upload data, most requests have no upload data, so this is a NOP. |
52 // Job types supporting upload data will override this. | 54 // Job types supporting upload data will override this. |
53 virtual void SetUpload(net::UploadData* upload); | 55 virtual void SetUpload(net::UploadData* upload); |
54 | 56 |
55 // Sets extra request headers for Job types that support request headers. | 57 // Sets extra request headers for Job types that support request headers. |
56 virtual void SetExtraRequestHeaders(const net::HttpRequestHeaders& headers); | 58 virtual void SetExtraRequestHeaders(const net::HttpRequestHeaders& headers); |
57 | 59 |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
271 void EnablePacketCounting(size_t max_packets_timed); | 273 void EnablePacketCounting(size_t max_packets_timed); |
272 | 274 |
273 // At or near destruction time, a derived class may request that the filters | 275 // At or near destruction time, a derived class may request that the filters |
274 // be destroyed so that statistics can be gathered while the derived class is | 276 // be destroyed so that statistics can be gathered while the derived class is |
275 // still present to assist in calculations. This is used by URLRequestHttpJob | 277 // still present to assist in calculations. This is used by URLRequestHttpJob |
276 // to get SDCH to emit stats. | 278 // to get SDCH to emit stats. |
277 void DestroyFilters() { filter_.reset(); } | 279 void DestroyFilters() { filter_.reset(); } |
278 | 280 |
279 // The request that initiated this job. This value MAY BE NULL if the | 281 // The request that initiated this job. This value MAY BE NULL if the |
280 // request was released by DetachRequest(). | 282 // request was released by DetachRequest(). |
281 URLRequest* request_; | 283 net::URLRequest* request_; |
282 | 284 |
283 // The status of the job. | 285 // The status of the job. |
284 const URLRequestStatus GetStatus(); | 286 const URLRequestStatus GetStatus(); |
285 | 287 |
286 // Set the status of the job. | 288 // Set the status of the job. |
287 void SetStatus(const URLRequestStatus& status); | 289 void SetStatus(const URLRequestStatus& status); |
288 | 290 |
289 // Whether the job is doing performance profiling | 291 // Whether the job is doing performance profiling |
290 bool is_profiling_; | 292 bool is_profiling_; |
291 | 293 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
413 // last time for use in histograms. | 415 // last time for use in histograms. |
414 base::Time final_packet_time_; | 416 base::Time final_packet_time_; |
415 | 417 |
416 // 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. |
417 // 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. |
418 int observed_packet_count_; | 420 int observed_packet_count_; |
419 | 421 |
420 DISALLOW_COPY_AND_ASSIGN(URLRequestJob); | 422 DISALLOW_COPY_AND_ASSIGN(URLRequestJob); |
421 }; | 423 }; |
422 | 424 |
425 } // namespace net | |
426 | |
427 typedef net::URLRequestJob URLRequestJob; | |
428 | |
423 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_H_ | 429 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_H_ |
OLD | NEW |