| 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 d63715631611ee8c7ca750e13cf5a16d446f8b02..b189b8ca2eb0b45474041de10f2e992ea9e1d6d4 100644
|
| --- a/net/http/http_stream_factory_impl_request.h
|
| +++ b/net/http/http_stream_factory_impl_request.h
|
| @@ -26,8 +26,10 @@ class SpdySession;
|
|
|
| class HttpStreamFactoryImpl::Request : public HttpStreamRequest {
|
| public:
|
| + // Request will notify |job_controller| when it's destructed.
|
| + // Thus |job_controller| is valid for the lifetime of the |this| Request.
|
| Request(const GURL& url,
|
| - HttpStreamFactoryImpl* factory,
|
| + JobController* job_controller,
|
| HttpStreamRequest::Delegate* delegate,
|
| WebSocketHandshakeStreamBase::CreateHelper*
|
| websocket_handshake_stream_create_helper,
|
| @@ -41,39 +43,22 @@ class HttpStreamFactoryImpl::Request : public HttpStreamRequest {
|
|
|
| const BoundNetLog& net_log() const { return net_log_; }
|
|
|
| - // Called when the Job determines the appropriate |spdy_session_key| for the
|
| - // Request. Note that this does not mean that SPDY is necessarily supported
|
| - // for this SpdySessionKey, since we may need to wait for NPN to complete
|
| - // before knowing if SPDY is available.
|
| + // Called when the JobController determines the appropriate |spdy_session_key|
|
| + // for the Request. Note that this does not mean that SPDY is necessarily
|
| + // supported for this SpdySessionKey, since we may need to wait for NPN to
|
| + // complete before knowing if SPDY is available.
|
| void SetSpdySessionKey(const SpdySessionKey& spdy_session_key);
|
| bool HasSpdySessionKey() const;
|
|
|
| - // 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().
|
| void Complete(bool was_npn_negotiated,
|
| NextProto protocol_negotiated,
|
| bool using_spdy);
|
|
|
| - // If this Request has a |spdy_session_key_|, remove this session from the
|
| - // SpdySessionRequestMap.
|
| - void RemoveRequestFromSpdySessionRequestMap();
|
| -
|
| - // Called by an attached Job if it sets up a SpdySession.
|
| - // |stream| is null when |stream_type| is HttpStreamRequest::HTTP_STREAM.
|
| - // |bidirectional_stream_spdy_impl| is null when |stream_type| is
|
| - // HttpStreamRequest::BIDIRECTIONAL_STREAM.
|
| - void OnNewSpdySessionReady(
|
| - Job* job,
|
| - std::unique_ptr<HttpStream> stream,
|
| - std::unique_ptr<BidirectionalStreamImpl> bidirectional_stream_spdy_impl,
|
| - const base::WeakPtr<SpdySession>& spdy_session,
|
| - bool direct);
|
| -
|
| - // Called by an attached Job to record connection attempts made by the socket
|
| - // layer for this stream request.
|
| + void ResetSpdySessionKey();
|
| +
|
| + // Called by JobController to record connection attempts made by the socket
|
| + // layer in an attached Job for this stream request.
|
| void AddConnectionAttempts(const ConnectionAttempts& attempts);
|
|
|
| WebSocketHandshakeStreamBase::CreateHelper*
|
| @@ -84,37 +69,29 @@ class HttpStreamFactoryImpl::Request : public HttpStreamRequest {
|
| // HttpStreamRequest::Delegate methods which we implement. Note we don't
|
| // actually subclass HttpStreamRequest::Delegate.
|
|
|
| - void OnStreamReady(Job* job,
|
| - const SSLConfig& used_ssl_config,
|
| + void OnStreamReady(const SSLConfig& used_ssl_config,
|
| const ProxyInfo& used_proxy_info,
|
| HttpStream* stream);
|
| - void OnBidirectionalStreamImplReady(Job* job,
|
| - const SSLConfig& used_ssl_config,
|
| + void OnBidirectionalStreamImplReady(const SSLConfig& used_ssl_config,
|
| const ProxyInfo& used_proxy_info,
|
| BidirectionalStreamImpl* stream);
|
|
|
| - void OnWebSocketHandshakeStreamReady(Job* job,
|
| - const SSLConfig& used_ssl_config,
|
| + void OnWebSocketHandshakeStreamReady(const SSLConfig& used_ssl_config,
|
| const ProxyInfo& used_proxy_info,
|
| WebSocketHandshakeStreamBase* stream);
|
| - void OnStreamFailed(Job* job,
|
| - int status,
|
| + void OnStreamFailed(int status,
|
| const SSLConfig& used_ssl_config,
|
| SSLFailureState ssl_failure_state);
|
| - void OnCertificateError(Job* job,
|
| - int status,
|
| + void OnCertificateError(int status,
|
| const SSLConfig& used_ssl_config,
|
| const SSLInfo& ssl_info);
|
| - void OnNeedsProxyAuth(Job* job,
|
| - const HttpResponseInfo& proxy_response,
|
| + void OnNeedsProxyAuth(const HttpResponseInfo& proxy_response,
|
| const SSLConfig& used_ssl_config,
|
| const ProxyInfo& used_proxy_info,
|
| HttpAuthController* auth_controller);
|
| - void OnNeedsClientAuth(Job* job,
|
| - const SSLConfig& used_ssl_config,
|
| + void OnNeedsClientAuth(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,
|
| @@ -130,30 +107,22 @@ class HttpStreamFactoryImpl::Request : public HttpStreamRequest {
|
| bool using_spdy() const override;
|
| const ConnectionAttempts& connection_attempts() const override;
|
| HttpStreamRequest::StreamType stream_type() const { return stream_type_; }
|
| + const SpdySessionKey* spdy_session_key() const {
|
| + return spdy_session_key_.get();
|
| + }
|
|
|
| private:
|
| - // Used to bind |job| to the request and orphan all other jobs in |jobs_|.
|
| - void BindJob(Job* job);
|
| -
|
| - // Used to orphan all jobs in |jobs_|.
|
| - void OrphanJobs();
|
| -
|
| - // Used to cancel all jobs in |jobs_|.
|
| - void CancelJobs();
|
| + const GURL url_;
|
|
|
| - // Called when a Job succeeds.
|
| - void OnJobSucceeded(Job* job);
|
| + // Unowned.
|
| + // Safe pointer as |this| Request doesn't outlive the |job_controller_|.
|
| + JobController* const job_controller_;
|
|
|
| - const GURL url_;
|
| - HttpStreamFactoryImpl* const factory_;
|
| WebSocketHandshakeStreamBase::CreateHelper* const
|
| websocket_handshake_stream_create_helper_;
|
| HttpStreamRequest::Delegate* const delegate_;
|
| const BoundNetLog net_log_;
|
|
|
| - // At the point where Job is irrevocably tied to the Request, we set this.
|
| - std::unique_ptr<Job> bound_job_;
|
| - std::set<HttpStreamFactoryImpl::Job*> jobs_;
|
| std::unique_ptr<const SpdySessionKey> spdy_session_key_;
|
|
|
| bool completed_;
|
|
|