OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "base/power_monitor/power_observer.h" | |
17 #include "net/base/host_port_pair.h" | 16 #include "net/base/host_port_pair.h" |
18 #include "net/base/load_states.h" | 17 #include "net/base/load_states.h" |
19 #include "net/base/net_error_details.h" | 18 #include "net/base/net_error_details.h" |
20 #include "net/base/net_export.h" | 19 #include "net/base/net_export.h" |
21 #include "net/base/request_priority.h" | 20 #include "net/base/request_priority.h" |
22 #include "net/cookies/canonical_cookie.h" | 21 #include "net/cookies/canonical_cookie.h" |
23 #include "net/socket/connection_attempts.h" | 22 #include "net/socket/connection_attempts.h" |
24 #include "net/url_request/redirect_info.h" | 23 #include "net/url_request/redirect_info.h" |
25 #include "net/url_request/url_request.h" | 24 #include "net/url_request/url_request.h" |
26 #include "url/gurl.h" | 25 #include "url/gurl.h" |
(...skipping 10 matching lines...) Expand all Loading... |
37 struct LoadTimingInfo; | 36 struct LoadTimingInfo; |
38 class NetworkDelegate; | 37 class NetworkDelegate; |
39 class ProxyServer; | 38 class ProxyServer; |
40 class SSLCertRequestInfo; | 39 class SSLCertRequestInfo; |
41 class SSLInfo; | 40 class SSLInfo; |
42 class SSLPrivateKey; | 41 class SSLPrivateKey; |
43 class UploadDataStream; | 42 class UploadDataStream; |
44 class URLRequestStatus; | 43 class URLRequestStatus; |
45 class X509Certificate; | 44 class X509Certificate; |
46 | 45 |
47 class NET_EXPORT URLRequestJob : public base::PowerObserver { | 46 class NET_EXPORT URLRequestJob { |
48 public: | 47 public: |
49 explicit URLRequestJob(URLRequest* request, | 48 explicit URLRequestJob(URLRequest* request, |
50 NetworkDelegate* network_delegate); | 49 NetworkDelegate* network_delegate); |
51 ~URLRequestJob() override; | 50 virtual ~URLRequestJob(); |
52 | 51 |
53 // Returns the request that owns this job. | 52 // Returns the request that owns this job. |
54 URLRequest* request() const { | 53 URLRequest* request() const { |
55 return request_; | 54 return request_; |
56 } | 55 } |
57 | 56 |
58 // Sets the upload data, most requests have no upload data, so this is a NOP. | 57 // Sets the upload data, most requests have no upload data, so this is a NOP. |
59 // Job types supporting upload data will override this. | 58 // Job types supporting upload data will override this. |
60 virtual void SetUpload(UploadDataStream* upload_data_stream); | 59 virtual void SetUpload(UploadDataStream* upload_data_stream); |
61 | 60 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 int64_t prefilter_bytes_read() const { return prefilter_bytes_read_; } | 213 int64_t prefilter_bytes_read() const { return prefilter_bytes_read_; } |
215 | 214 |
216 // These methods are not applicable to all connections. | 215 // These methods are not applicable to all connections. |
217 virtual bool GetMimeType(std::string* mime_type) const; | 216 virtual bool GetMimeType(std::string* mime_type) const; |
218 virtual int GetResponseCode() const; | 217 virtual int GetResponseCode() const; |
219 | 218 |
220 // Returns the socket address for the connection. | 219 // Returns the socket address for the connection. |
221 // See url_request.h for details. | 220 // See url_request.h for details. |
222 virtual HostPortPair GetSocketAddress() const; | 221 virtual HostPortPair GetSocketAddress() const; |
223 | 222 |
224 // base::PowerObserver methods: | |
225 // We invoke URLRequestJob::Kill on suspend (crbug.com/4606). | |
226 void OnSuspend() override; | |
227 | |
228 // Called after a NetworkDelegate has been informed that the URLRequest | 223 // Called after a NetworkDelegate has been informed that the URLRequest |
229 // will be destroyed. This is used to track that no pending callbacks | 224 // will be destroyed. This is used to track that no pending callbacks |
230 // exist at destruction time of the URLRequestJob, unless they have been | 225 // exist at destruction time of the URLRequestJob, unless they have been |
231 // canceled by an explicit NetworkDelegate::NotifyURLRequestDestroyed() call. | 226 // canceled by an explicit NetworkDelegate::NotifyURLRequestDestroyed() call. |
232 virtual void NotifyURLRequestDestroyed(); | 227 virtual void NotifyURLRequestDestroyed(); |
233 | 228 |
234 // Populates |out| with the connection attempts made at the socket layer in | 229 // Populates |out| with the connection attempts made at the socket layer in |
235 // the course of executing the URLRequestJob. Should be called after the job | 230 // the course of executing the URLRequestJob. Should be called after the job |
236 // has failed or the response headers have been received. | 231 // has failed or the response headers have been received. |
237 virtual void GetConnectionAttempts(ConnectionAttempts* out) const; | 232 virtual void GetConnectionAttempts(ConnectionAttempts* out) const; |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 int64_t last_notified_total_sent_bytes_; | 448 int64_t last_notified_total_sent_bytes_; |
454 | 449 |
455 base::WeakPtrFactory<URLRequestJob> weak_factory_; | 450 base::WeakPtrFactory<URLRequestJob> weak_factory_; |
456 | 451 |
457 DISALLOW_COPY_AND_ASSIGN(URLRequestJob); | 452 DISALLOW_COPY_AND_ASSIGN(URLRequestJob); |
458 }; | 453 }; |
459 | 454 |
460 } // namespace net | 455 } // namespace net |
461 | 456 |
462 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_H_ | 457 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_H_ |
OLD | NEW |