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

Unified Diff: net/http/http_stream_factory_impl_job.h

Issue 1952423002: JobController 2: Remove reference between HttpStreamFactoryImpl::Jobs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Job_Controller_1
Patch Set: use unmocked Job::Start() and asyncronous Proxy resolution in tests Created 4 years, 5 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
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 01dd6271eee2e3baef8b1424b620560a1d018ec1..9efeb2fb38a24f2be59ca45d7838779e04714702 100644
--- a/net/http/http_stream_factory_impl_job.h
+++ b/net/http/http_stream_factory_impl_job.h
@@ -116,6 +116,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
@@ -131,6 +138,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;
};
@@ -175,14 +184,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.
@@ -205,6 +209,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,8 +223,14 @@ class HttpStreamFactoryImpl::Job {
JobType job_type() const { return job_type_; }
+ protected:
+ int StartInternal();
+ void set_stream_type(HttpStreamRequest::StreamType stream_type) {
+ stream_type_ = stream_type;
+ }
+
private:
- FRIEND_TEST_ALL_PREFIXES(HttpStreamFactoryImplRequestTest, DelayMainJob);
+ friend class HttpStreamFactoryImplJobPeer;
enum State {
STATE_START,
@@ -243,8 +254,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,
@@ -311,9 +322,6 @@ class HttpStreamFactoryImpl::Job {
const bool is_spdy_alternative_;
};
- // Resume the |this| job after the specified |wait_time_|.
- void ResumeAfterDelay();
-
void OnStreamReadyCallback();
void OnBidirectionalStreamImplReadyCallback();
void OnWebSocketHandshakeStreamReadyCallback();
@@ -331,7 +339,7 @@ class HttpStreamFactoryImpl::Job {
void OnIOComplete(int result);
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
@@ -340,8 +348,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);
@@ -457,17 +465,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_;
« no previous file with comments | « no previous file | net/http/http_stream_factory_impl_job.cc » ('j') | net/http/http_stream_factory_impl_job_controller_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698