Chromium Code Reviews| 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_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ | 5 #ifndef NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ |
| 6 #define NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ | 6 #define NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 34 // An HttpStreamRequestImpl exists for each stream which is in progress of being | 34 // An HttpStreamRequestImpl exists for each stream which is in progress of being |
| 35 // created for the StreamFactory. | 35 // created for the StreamFactory. |
| 36 class HttpStreamFactoryImpl::Job { | 36 class HttpStreamFactoryImpl::Job { |
| 37 public: | 37 public: |
| 38 Job(HttpStreamFactoryImpl* stream_factory, | 38 Job(HttpStreamFactoryImpl* stream_factory, |
| 39 HttpNetworkSession* session, | 39 HttpNetworkSession* session, |
| 40 const HttpRequestInfo& request_info, | 40 const HttpRequestInfo& request_info, |
| 41 RequestPriority priority, | 41 RequestPriority priority, |
| 42 const SSLConfig& server_ssl_config, | 42 const SSLConfig& server_ssl_config, |
| 43 const SSLConfig& proxy_ssl_config, | 43 const SSLConfig& proxy_ssl_config, |
| 44 NetLog* net_log); | 44 NetLog* net_log, |
| 45 AlternateProtocolInfo alternate_protocol); | |
|
Ryan Hamilton
2015/01/30 23:12:51
I'm not sure that I'm a fan of moving this to the
Bence
2015/01/31 00:32:01
Well, if you look at https://codereview.chromium.o
Ryan Hamilton
2015/01/31 01:17:48
I'm not sure that's the best way to accomplish thi
Bence
2015/02/02 15:08:17
Excellent idea! Done.
| |
| 45 ~Job(); | 46 ~Job(); |
| 46 | 47 |
| 47 // Start initiates the process of creating a new HttpStream. |request| will be | 48 // Start initiates the process of creating a new HttpStream. |request| will be |
| 48 // notified upon completion if the Job has not been Orphan()'d. | 49 // notified upon completion if the Job has not been Orphan()'d. |
| 49 void Start(Request* request); | 50 void Start(Request* request); |
| 50 | 51 |
| 51 // Preconnect will attempt to request |num_streams| sockets from the | 52 // Preconnect will attempt to request |num_streams| sockets from the |
| 52 // appropriate ClientSocketPool. | 53 // appropriate ClientSocketPool. |
| 53 int Preconnect(int num_streams); | 54 int Preconnect(int num_streams); |
| 54 | 55 |
| 55 int RestartTunnelWithProxyAuth(const AuthCredentials& credentials); | 56 int RestartTunnelWithProxyAuth(const AuthCredentials& credentials); |
| 56 LoadState GetLoadState() const; | 57 LoadState GetLoadState() const; |
| 57 | 58 |
| 58 // Marks this Job as the "alternate" job, from Alternate-Protocol. Tracks the | 59 // Marks this Job as the "alternate" job, from Alternate-Protocol. Tracks the |
| 59 // original url so we can mark the Alternate-Protocol as broken if | 60 // original url so we can mark the Alternate-Protocol as broken if |
| 60 // we fail to connect. |alternate| specifies the alternate protocol to use | 61 // we fail to connect. |
| 61 // and alternate port to connect to. | 62 void MarkAsAlternate(const GURL& original_url); |
| 62 void MarkAsAlternate(const GURL& original_url, | |
| 63 AlternateProtocolInfo alternate); | |
| 64 | 63 |
| 65 // Tells |this| to wait for |job| to resume it. | 64 // Tells |this| to wait for |job| to resume it. |
| 66 void WaitFor(Job* job); | 65 void WaitFor(Job* job); |
| 67 | 66 |
| 68 // Tells |this| that |job| has determined it still needs to continue | 67 // Tells |this| that |job| has determined it still needs to continue |
| 69 // connecting, so allow |this| to continue. If this is not called, then | 68 // connecting, so allow |this| to continue. If this is not called, then |
| 70 // |request_| is expected to cancel |this| by deleting it. | 69 // |request_| is expected to cancel |this| by deleting it. |
| 71 void Resume(Job* job); | 70 void Resume(Job* job); |
| 72 | 71 |
| 73 // Used to detach the Job from |request|. | 72 // Used to detach the Job from |request|. |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 268 HostPortPair origin_; | 267 HostPortPair origin_; |
| 269 | 268 |
| 270 // The origin url we're trying to reach. This url may be different from the | 269 // The origin url we're trying to reach. This url may be different from the |
| 271 // original request when host mapping rules are set-up. | 270 // original request when host mapping rules are set-up. |
| 272 GURL origin_url_; | 271 GURL origin_url_; |
| 273 | 272 |
| 274 // If this is a Job for an "Alternate-Protocol", then this will be non-NULL | 273 // If this is a Job for an "Alternate-Protocol", then this will be non-NULL |
| 275 // and will specify the original URL. | 274 // and will specify the original URL. |
| 276 scoped_ptr<GURL> original_url_; | 275 scoped_ptr<GURL> original_url_; |
| 277 | 276 |
| 277 // AlternateProtocol for the alternate job (regardless of whether it is this | |
| 278 // job or not). | |
| 279 AlternateProtocolInfo alternate_protocol_; | |
| 280 | |
| 278 // This is the Job we're dependent on. It will notify us if/when it's OK to | 281 // This is the Job we're dependent on. It will notify us if/when it's OK to |
| 279 // proceed. | 282 // proceed. |
| 280 Job* blocking_job_; | 283 Job* blocking_job_; |
| 281 | 284 |
| 282 // |waiting_job_| is a Job waiting to see if |this| can reuse a connection. | 285 // |waiting_job_| is a Job waiting to see if |this| can reuse a connection. |
| 283 // If |this| is unable to do so, we'll notify |waiting_job_| that it's ok to | 286 // If |this| is unable to do so, we'll notify |waiting_job_| that it's ok to |
| 284 // proceed and then race the two Jobs. | 287 // proceed and then race the two Jobs. |
| 285 Job* waiting_job_; | 288 Job* waiting_job_; |
| 286 | 289 |
| 287 // True if handling a HTTPS request, or using SPDY with SSL | 290 // True if handling a HTTPS request, or using SPDY with SSL |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 336 JobStatus other_job_status_; | 339 JobStatus other_job_status_; |
| 337 | 340 |
| 338 base::WeakPtrFactory<Job> ptr_factory_; | 341 base::WeakPtrFactory<Job> ptr_factory_; |
| 339 | 342 |
| 340 DISALLOW_COPY_AND_ASSIGN(Job); | 343 DISALLOW_COPY_AND_ASSIGN(Job); |
| 341 }; | 344 }; |
| 342 | 345 |
| 343 } // namespace net | 346 } // namespace net |
| 344 | 347 |
| 345 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ | 348 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ |
| OLD | NEW |