| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 |
| 11 #include "base/basictypes.h" | |
| 12 #include "base/ref_counted.h" | 11 #include "base/ref_counted.h" |
| 13 #include "net/base/auth.h" | |
| 14 #include "net/base/filter.h" | 12 #include "net/base/filter.h" |
| 15 #include "net/base/load_states.h" | 13 #include "net/base/load_states.h" |
| 16 #include "net/url_request/url_request_status.h" | |
| 17 | 14 |
| 18 namespace net { | 15 namespace net { |
| 16 class AuthChallengeInfo; |
| 19 class HttpResponseInfo; | 17 class HttpResponseInfo; |
| 20 class IOBuffer; | 18 class IOBuffer; |
| 21 class UploadData; | 19 class UploadData; |
| 22 } | 20 } |
| 23 | 21 |
| 24 class GURL; | 22 class GURL; |
| 25 class URLRequest; | 23 class URLRequest; |
| 24 class URLRequestStatus; |
| 26 class URLRequestJobMetrics; | 25 class URLRequestJobMetrics; |
| 27 | 26 |
| 28 // The URLRequestJob is using RefCounterThreadSafe because some sub classes | 27 // The URLRequestJob is using RefCounterThreadSafe because some sub classes |
| 29 // can be destroyed on multiple threads. This is the case of the | 28 // can be destroyed on multiple threads. This is the case of the |
| 30 // UrlRequestFileJob. | 29 // UrlRequestFileJob. |
| 31 class URLRequestJob : public base::RefCountedThreadSafe<URLRequestJob> { | 30 class URLRequestJob : public base::RefCountedThreadSafe<URLRequestJob> { |
| 32 public: | 31 public: |
| 33 explicit URLRequestJob(URLRequest* request); | 32 explicit URLRequestJob(URLRequest* request); |
| 34 virtual ~URLRequestJob(); | 33 virtual ~URLRequestJob(); |
| 35 | 34 |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 } | 193 } |
| 195 | 194 |
| 196 protected: | 195 protected: |
| 197 // Notifies the job that headers have been received. | 196 // Notifies the job that headers have been received. |
| 198 void NotifyHeadersComplete(); | 197 void NotifyHeadersComplete(); |
| 199 | 198 |
| 200 // Notifies the request that the job has completed a Read operation. | 199 // Notifies the request that the job has completed a Read operation. |
| 201 void NotifyReadComplete(int bytes_read); | 200 void NotifyReadComplete(int bytes_read); |
| 202 | 201 |
| 203 // Notifies the request that a start error has occurred. | 202 // Notifies the request that a start error has occurred. |
| 204 void NotifyStartError(const URLRequestStatus &status); | 203 void NotifyStartError(const URLRequestStatus& status); |
| 205 | 204 |
| 206 // NotifyDone marks when we are done with a request. It is really | 205 // NotifyDone marks when we are done with a request. It is really |
| 207 // a glorified set_status, but also does internal state checking and | 206 // a glorified set_status, but also does internal state checking and |
| 208 // job tracking. It should be called once per request, when the job is | 207 // job tracking. It should be called once per request, when the job is |
| 209 // finished doing all IO. | 208 // finished doing all IO. |
| 210 void NotifyDone(const URLRequestStatus &status); | 209 void NotifyDone(const URLRequestStatus& status); |
| 211 | 210 |
| 212 // Some work performed by NotifyDone must be completed on a separate task | 211 // Some work performed by NotifyDone must be completed on a separate task |
| 213 // so as to avoid re-entering the delegate. This method exists to perform | 212 // so as to avoid re-entering the delegate. This method exists to perform |
| 214 // that work. | 213 // that work. |
| 215 void CompleteNotifyDone(); | 214 void CompleteNotifyDone(); |
| 216 | 215 |
| 217 // Used as an asynchronous callback for Kill to notify the URLRequest that | 216 // Used as an asynchronous callback for Kill to notify the URLRequest that |
| 218 // we were canceled. | 217 // we were canceled. |
| 219 void NotifyCanceled(); | 218 void NotifyCanceled(); |
| 220 | 219 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 244 bool ReadFilteredData(int *bytes_read); | 243 bool ReadFilteredData(int *bytes_read); |
| 245 | 244 |
| 246 // The request that initiated this job. This value MAY BE NULL if the | 245 // The request that initiated this job. This value MAY BE NULL if the |
| 247 // request was released by DetachRequest(). | 246 // request was released by DetachRequest(). |
| 248 URLRequest* request_; | 247 URLRequest* request_; |
| 249 | 248 |
| 250 // The status of the job. | 249 // The status of the job. |
| 251 const URLRequestStatus GetStatus(); | 250 const URLRequestStatus GetStatus(); |
| 252 | 251 |
| 253 // Set the status of the job. | 252 // Set the status of the job. |
| 254 void SetStatus(const URLRequestStatus &status); | 253 void SetStatus(const URLRequestStatus& status); |
| 255 | 254 |
| 256 // Whether the job is doing performance profiling | 255 // Whether the job is doing performance profiling |
| 257 bool is_profiling_; | 256 bool is_profiling_; |
| 258 | 257 |
| 259 // Contains IO performance measurement when profiling is enabled. | 258 // Contains IO performance measurement when profiling is enabled. |
| 260 scoped_ptr<URLRequestJobMetrics> metrics_; | 259 scoped_ptr<URLRequestJobMetrics> metrics_; |
| 261 | 260 |
| 262 private: | 261 private: |
| 263 // When data filtering is enabled, this function is used to read data | 262 // When data filtering is enabled, this function is used to read data |
| 264 // for the filter. Returns true if raw data was read. Returns false if | 263 // for the filter. Returns true if raw data was read. Returns false if |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 // OnResponseStarted callback and potentially redirect callbacks as well. | 296 // OnResponseStarted callback and potentially redirect callbacks as well. |
| 298 bool has_handled_response_; | 297 bool has_handled_response_; |
| 299 | 298 |
| 300 // Expected content size | 299 // Expected content size |
| 301 int64 expected_content_size_; | 300 int64 expected_content_size_; |
| 302 | 301 |
| 303 DISALLOW_COPY_AND_ASSIGN(URLRequestJob); | 302 DISALLOW_COPY_AND_ASSIGN(URLRequestJob); |
| 304 }; | 303 }; |
| 305 | 304 |
| 306 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_H_ | 305 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_H_ |
| 307 | |
| OLD | NEW |