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

Unified Diff: net/http/http_stream_factory_impl_request.h

Issue 6591030: Add HttpStreamFactory Job orphaning semantics. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updated comment. Created 9 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/http_stream_factory_impl_job.cc ('k') | net/http/http_stream_factory_impl_request.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_stream_factory_impl_request.h
diff --git a/net/http/http_stream_factory_impl_request.h b/net/http/http_stream_factory_impl_request.h
index e7eadbe9e8701f2f6da4ba99032097a5bce1953a..3c1b9960e31d6bb3971e9bafba07c93ca456f47b 100644
--- a/net/http/http_stream_factory_impl_request.h
+++ b/net/http/http_stream_factory_impl_request.h
@@ -5,6 +5,7 @@
#ifndef NET_HTTP_HTTP_STREAM_FACTORY_IMPL_REQUEST_H_
#define NET_HTTP_HTTP_STREAM_FACTORY_IMPL_REQUEST_H_
+#include <set>
#include "base/scoped_ptr.h"
#include "googleurl/src/gurl.h"
#include "net/base/net_log.h"
@@ -20,9 +21,6 @@ class HttpStreamFactoryImpl::Request : public HttpStreamRequest {
const BoundNetLog& net_log);
virtual ~Request();
- // Returns the Job that the Request started up.
- Job* job() const { return job_; }
-
// The GURL from the HttpRequestInfo the started the Request.
const GURL& url() const { return url_; }
@@ -32,8 +30,9 @@ class HttpStreamFactoryImpl::Request : public HttpStreamRequest {
// before knowing if SPDY is available.
void SetSpdySessionKey(const HostPortProxyPair& spdy_session_key);
- // Binds |job| to this request.
- void BindJob(HttpStreamFactoryImpl::Job* job);
+ // Attaches |job| to this request. Does not mean that Request will use |job|,
+ // but Request will own |job|.
+ void AttachJob(HttpStreamFactoryImpl::Job* job);
// Marks completion of the request. Must be called before OnStreamReady().
// |source| is the NetLog::Source generated by the Job that fulfilled this
@@ -47,23 +46,33 @@ class HttpStreamFactoryImpl::Request : public HttpStreamRequest {
// SpdySessionRequestMap.
void RemoveRequestFromSpdySessionRequestMap();
+ // Called by an attached Job if it sets up a SpdySession.
+ void OnSpdySessionReady(Job* job,
+ scoped_refptr<SpdySession> spdy_session,
+ bool direct);
+
// HttpStreamRequest::Delegate methods which we implement. Note we don't
// actually subclass HttpStreamRequest::Delegate.
- void OnStreamReady(const SSLConfig& used_ssl_config,
+ void OnStreamReady(Job* job,
+ const SSLConfig& used_ssl_config,
const ProxyInfo& used_proxy_info,
HttpStream* stream);
- void OnStreamFailed(int status, const SSLConfig& used_ssl_config);
- void OnCertificateError(int status,
+ void OnStreamFailed(Job* job, int status, const SSLConfig& used_ssl_config);
+ void OnCertificateError(Job* job,
+ int status,
const SSLConfig& used_ssl_config,
const SSLInfo& ssl_info);
- void OnNeedsProxyAuth(const HttpResponseInfo& proxy_response,
+ void OnNeedsProxyAuth(Job* job,
+ const HttpResponseInfo& proxy_response,
const SSLConfig& used_ssl_config,
const ProxyInfo& used_proxy_info,
HttpAuthController* auth_controller);
- void OnNeedsClientAuth(const SSLConfig& used_ssl_config,
+ void OnNeedsClientAuth(Job* job,
+ const SSLConfig& used_ssl_config,
SSLCertRequestInfo* cert_info);
void OnHttpsProxyTunnelResponse(
+ Job *job,
const HttpResponseInfo& response_info,
const SSLConfig& used_ssl_config,
const ProxyInfo& used_proxy_info,
@@ -79,13 +88,21 @@ class HttpStreamFactoryImpl::Request : public HttpStreamRequest {
virtual bool using_spdy() const;
private:
+ // Used to orphan all jobs in |jobs_| other than |job| which becomes "bound"
+ // to the request.
+ void OrphanJobsExcept(Job* job);
+
+ // Used to orphan all jobs in |jobs_|.
+ void OrphanJobs();
+
const GURL url_;
HttpStreamFactoryImpl* const factory_;
HttpStreamRequest::Delegate* const delegate_;
const BoundNetLog net_log_;
- // The |job_| that this request is tied to.
- HttpStreamFactoryImpl::Job* job_;
+ // At the point where Job is irrevocably tied to the Request, we set this.
+ scoped_ptr<Job> bound_job_;
+ std::set<HttpStreamFactoryImpl::Job*> jobs_;
scoped_ptr<const HostPortProxyPair> spdy_session_key_;
bool completed_;
« no previous file with comments | « net/http/http_stream_factory_impl_job.cc ('k') | net/http/http_stream_factory_impl_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698