OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 23 matching lines...) Loading... |
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. |
41 static const size_t kSdchPacketHistogramCount = 5; | 41 static const size_t kSdchPacketHistogramCount = 5; |
42 | 42 |
43 explicit URLRequestJob(URLRequest* request); | 43 explicit URLRequestJob(URLRequest* request); |
44 virtual ~URLRequestJob(); | |
45 | 44 |
46 // Returns the request that owns this job. THIS POINTER MAY BE NULL if the | 45 // Returns the request that owns this job. THIS POINTER MAY BE NULL if the |
47 // request was destroyed. | 46 // request was destroyed. |
48 URLRequest* request() const { | 47 URLRequest* request() const { |
49 return request_; | 48 return request_; |
50 } | 49 } |
51 | 50 |
52 // Sets the upload data, most requests have no upload data, so this is a NOP. | 51 // Sets the upload data, most requests have no upload data, so this is a NOP. |
53 // Job types supporting upload data will override this. | 52 // Job types supporting upload data will override this. |
54 virtual void SetUpload(net::UploadData* upload) { } | 53 virtual void SetUpload(net::UploadData* upload) { } |
(...skipping 156 matching lines...) Loading... |
211 virtual bool GetMimeType(std::string* mime_type) const { return false; } | 210 virtual bool GetMimeType(std::string* mime_type) const { return false; } |
212 virtual bool GetURL(GURL* gurl) const; | 211 virtual bool GetURL(GURL* gurl) const; |
213 virtual base::Time GetRequestTime() const; | 212 virtual base::Time GetRequestTime() const; |
214 virtual bool IsCachedContent() const { return false; } | 213 virtual bool IsCachedContent() const { return false; } |
215 virtual int64 GetByteReadCount() const; | 214 virtual int64 GetByteReadCount() const; |
216 virtual int GetResponseCode() const { return -1; } | 215 virtual int GetResponseCode() const { return -1; } |
217 virtual int GetInputStreamBufferSize() const { return kFilterBufSize; } | 216 virtual int GetInputStreamBufferSize() const { return kFilterBufSize; } |
218 virtual void RecordPacketStats(StatisticSelector statistic) const; | 217 virtual void RecordPacketStats(StatisticSelector statistic) const; |
219 | 218 |
220 protected: | 219 protected: |
| 220 friend class base::RefCountedThreadSafe<URLRequestJob>; |
| 221 virtual ~URLRequestJob(); |
| 222 |
221 // Notifies the job that headers have been received. | 223 // Notifies the job that headers have been received. |
222 void NotifyHeadersComplete(); | 224 void NotifyHeadersComplete(); |
223 | 225 |
224 // Notifies the request that the job has completed a Read operation. | 226 // Notifies the request that the job has completed a Read operation. |
225 void NotifyReadComplete(int bytes_read); | 227 void NotifyReadComplete(int bytes_read); |
226 | 228 |
227 // Notifies the request that a start error has occurred. | 229 // Notifies the request that a start error has occurred. |
228 void NotifyStartError(const URLRequestStatus& status); | 230 void NotifyStartError(const URLRequestStatus& status); |
229 | 231 |
230 // NotifyDone marks when we are done with a request. It is really | 232 // NotifyDone marks when we are done with a request. It is really |
(...skipping 163 matching lines...) Loading... |
394 base::Time final_packet_time_; | 396 base::Time final_packet_time_; |
395 | 397 |
396 // The count of the number of packets, some of which may not have been timed. | 398 // The count of the number of packets, some of which may not have been timed. |
397 // We're ignoring overflow, as 1430 x 2^31 is a LOT of bytes. | 399 // We're ignoring overflow, as 1430 x 2^31 is a LOT of bytes. |
398 int observed_packet_count_; | 400 int observed_packet_count_; |
399 | 401 |
400 DISALLOW_COPY_AND_ASSIGN(URLRequestJob); | 402 DISALLOW_COPY_AND_ASSIGN(URLRequestJob); |
401 }; | 403 }; |
402 | 404 |
403 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_H_ | 405 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_H_ |
OLD | NEW |