Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(623)

Side by Side Diff: net/url_request/url_request_job.h

Issue 2447083003: Move fail on suspend logic from URLRequestJob to TcpClientSocket.
Patch Set: . Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/socket/transport_client_socket_pool.cc ('k') | net/url_request/url_request_job.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/filter/source_stream.h" 22 #include "net/filter/source_stream.h"
24 #include "net/socket/connection_attempts.h" 23 #include "net/socket/connection_attempts.h"
25 #include "net/url_request/redirect_info.h" 24 #include "net/url_request/redirect_info.h"
26 #include "net/url_request/url_request.h" 25 #include "net/url_request/url_request.h"
(...skipping 10 matching lines...) Expand all
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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 int64_t prefilter_bytes_read() const { return prefilter_bytes_read_; } 205 int64_t prefilter_bytes_read() const { return prefilter_bytes_read_; }
207 206
208 // These methods are not applicable to all connections. 207 // These methods are not applicable to all connections.
209 virtual bool GetMimeType(std::string* mime_type) const; 208 virtual bool GetMimeType(std::string* mime_type) const;
210 virtual int GetResponseCode() const; 209 virtual int GetResponseCode() const;
211 210
212 // Returns the socket address for the connection. 211 // Returns the socket address for the connection.
213 // See url_request.h for details. 212 // See url_request.h for details.
214 virtual HostPortPair GetSocketAddress() const; 213 virtual HostPortPair GetSocketAddress() const;
215 214
216 // base::PowerObserver methods:
217 // We invoke URLRequestJob::Kill on suspend (crbug.com/4606).
218 void OnSuspend() override;
219
220 // Called after a NetworkDelegate has been informed that the URLRequest 215 // Called after a NetworkDelegate has been informed that the URLRequest
221 // will be destroyed. This is used to track that no pending callbacks 216 // will be destroyed. This is used to track that no pending callbacks
222 // exist at destruction time of the URLRequestJob, unless they have been 217 // exist at destruction time of the URLRequestJob, unless they have been
223 // canceled by an explicit NetworkDelegate::NotifyURLRequestDestroyed() call. 218 // canceled by an explicit NetworkDelegate::NotifyURLRequestDestroyed() call.
224 virtual void NotifyURLRequestDestroyed(); 219 virtual void NotifyURLRequestDestroyed();
225 220
226 // Populates |out| with the connection attempts made at the socket layer in 221 // Populates |out| with the connection attempts made at the socket layer in
227 // the course of executing the URLRequestJob. Should be called after the job 222 // the course of executing the URLRequestJob. Should be called after the job
228 // has failed or the response headers have been received. 223 // has failed or the response headers have been received.
229 virtual void GetConnectionAttempts(ConnectionAttempts* out) const; 224 virtual void GetConnectionAttempts(ConnectionAttempts* out) const;
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 CompletionCallback read_raw_callback_; 433 CompletionCallback read_raw_callback_;
439 434
440 base::WeakPtrFactory<URLRequestJob> weak_factory_; 435 base::WeakPtrFactory<URLRequestJob> weak_factory_;
441 436
442 DISALLOW_COPY_AND_ASSIGN(URLRequestJob); 437 DISALLOW_COPY_AND_ASSIGN(URLRequestJob);
443 }; 438 };
444 439
445 } // namespace net 440 } // namespace net
446 441
447 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_H_ 442 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_H_
OLDNEW
« no previous file with comments | « net/socket/transport_client_socket_pool.cc ('k') | net/url_request/url_request_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698