| Index: net/http/http_stream_factory_impl_job.h
|
| diff --git a/net/http/http_stream_factory_impl_job.h b/net/http/http_stream_factory_impl_job.h
|
| index e24f1bae50f7f555856d50ed8bfeb0ea431906bf..a1a3290f51e28c452e1354e88b5a2ddee8b9df8a 100644
|
| --- a/net/http/http_stream_factory_impl_job.h
|
| +++ b/net/http/http_stream_factory_impl_job.h
|
| @@ -115,6 +115,13 @@ class HttpStreamFactoryImpl::Job {
|
| Job* job,
|
| const ConnectionAttempts& attempts) = 0;
|
|
|
| + // Invoked when |job| finishes initiating a connection.
|
| + virtual void OnConnectionInitialized(Job* job, int rv) = 0;
|
| +
|
| + // Return false if |job| can advance to the next state. Otherwise, |job|
|
| + // will wait for Job::Resume() to be called before advancing.
|
| + virtual bool ShouldWait(Job* job) = 0;
|
| +
|
| // Called when |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
|
| @@ -130,6 +137,8 @@ class HttpStreamFactoryImpl::Job {
|
| virtual WebSocketHandshakeStreamBase::CreateHelper*
|
| websocket_handshake_stream_create_helper() = 0;
|
|
|
| + virtual void MaybeSetWaitTimeForMainJob(const base::TimeDelta& delay) = 0;
|
| +
|
| virtual bool for_websockets() = 0;
|
| };
|
|
|
| @@ -165,7 +174,7 @@ class HttpStreamFactoryImpl::Job {
|
|
|
| // Start initiates the process of creating a new HttpStream.
|
| // |delegate_| will be notified upon completion.
|
| - virtual void Start(HttpStreamRequest::StreamType stream_type);
|
| + void Start(HttpStreamRequest::StreamType stream_type);
|
|
|
| // Preconnect will attempt to request |num_streams| sockets from the
|
| // appropriate ClientSocketPool.
|
| @@ -174,14 +183,9 @@ class HttpStreamFactoryImpl::Job {
|
| int RestartTunnelWithProxyAuth(const AuthCredentials& credentials);
|
| LoadState GetLoadState() const;
|
|
|
| - // Tells |this| to wait for |job| to resume it.
|
| - void WaitFor(Job* job);
|
| -
|
| - // Tells |this| that |job| has determined it still needs to continue
|
| - // connecting, so allow |this| to continue after the specified |delay|. If
|
| - // this is not called, then |request_| is expected to cancel |this| by
|
| - // deleting it.
|
| - void Resume(Job* job, const base::TimeDelta& delay);
|
| + // Tells |this| that |delegate_| has determined it still needs to continue
|
| + // connecting.
|
| + virtual void Resume();
|
|
|
| // Called to detach |this| Job. May resume the other Job, will disconnect
|
| // the socket for |this| Job, and notify |delegate| upon completion.
|
| @@ -204,6 +208,7 @@ class HttpStreamFactoryImpl::Job {
|
| return std::move(bidirectional_stream_impl_);
|
| }
|
|
|
| + bool is_waiting() const { return next_state_ == STATE_WAIT_COMPLETE; }
|
| const SSLConfig& server_ssl_config() const;
|
| const SSLConfig& proxy_ssl_config() const;
|
| const ProxyInfo& proxy_info() const;
|
| @@ -218,7 +223,7 @@ class HttpStreamFactoryImpl::Job {
|
| JobType job_type() const { return job_type_; }
|
|
|
| private:
|
| - FRIEND_TEST_ALL_PREFIXES(HttpStreamFactoryImplRequestTest, DelayMainJob);
|
| + friend class HttpStreamFactoryImplJobPeer;
|
|
|
| enum State {
|
| STATE_START,
|
| @@ -242,8 +247,8 @@ class HttpStreamFactoryImpl::Job {
|
| // existing SpdySession. In that case, the http and npn-spdy jobs will race.
|
| // When QUIC protocol is used by the npn-spdy job, then http job will wait
|
| // for |wait_time_| when the http job was resumed.
|
| - STATE_WAIT_FOR_JOB,
|
| - STATE_WAIT_FOR_JOB_COMPLETE,
|
| + STATE_WAIT,
|
| + STATE_WAIT_COMPLETE,
|
|
|
| STATE_INIT_CONNECTION,
|
| STATE_INIT_CONNECTION_COMPLETE,
|
| @@ -265,9 +270,6 @@ class HttpStreamFactoryImpl::Job {
|
| STATUS_SUCCEEDED
|
| };
|
|
|
| - // Resume the |this| job after the specified |wait_time_|.
|
| - void ResumeAfterDelay();
|
| -
|
| void OnStreamReadyCallback();
|
| void OnBidirectionalStreamImplReadyCallback();
|
| void OnWebSocketHandshakeStreamReadyCallback();
|
| @@ -286,6 +288,7 @@ class HttpStreamFactoryImpl::Job {
|
| int RunLoop(int result);
|
| int DoLoop(int result);
|
| int StartInternal();
|
| + int DoInitConnectionImpl();
|
|
|
| // Each of these methods corresponds to a State value. Those with an input
|
| // argument receive the result from the previous state. If a method returns
|
| @@ -294,8 +297,8 @@ class HttpStreamFactoryImpl::Job {
|
| int DoStart();
|
| int DoResolveProxy();
|
| int DoResolveProxyComplete(int result);
|
| - int DoWaitForJob();
|
| - int DoWaitForJobComplete(int result);
|
| + int DoWait();
|
| + int DoWaitComplete(int result);
|
| int DoInitConnection();
|
| int DoInitConnectionComplete(int result);
|
| int DoWaitingUserAction(int result);
|
| @@ -411,17 +414,6 @@ class HttpStreamFactoryImpl::Job {
|
|
|
| JobType job_type_;
|
|
|
| - // This is the Job we're dependent on. It will notify us if/when it's OK to
|
| - // proceed.
|
| - Job* blocking_job_;
|
| -
|
| - // |waiting_job_| is a Job waiting to see if |this| can reuse a connection.
|
| - // If |this| is unable to do so, we'll notify |waiting_job_| that it's ok to
|
| - // proceed and then race the two Jobs.
|
| - Job* waiting_job_;
|
| -
|
| - base::TimeDelta wait_time_;
|
| -
|
| // True if handling a HTTPS request, or using SPDY with SSL
|
| bool using_ssl_;
|
|
|
|
|