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

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: Remove ResumeAfterDelay Created 4 years, 6 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 | « no previous file | net/http/http_stream_factory_impl_job.cc » ('j') | net/http/http_stream_factory_impl_job.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..3e1308ee19bd8e26d165b70fd5521fcad15e5830 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::OnIOComplete() to be called before advancing.
+ virtual bool ShouldWait(Job* job) const = 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,10 @@ class HttpStreamFactoryImpl::Job {
virtual WebSocketHandshakeStreamBase::CreateHelper*
websocket_handshake_stream_create_helper() = 0;
+ virtual bool main_job_is_blocked() = 0;
Ryan Hamilton 2016/07/01 00:13:30 Do we need this method? I would think this should
Zhongyi Shi 2016/07/11 23:04:56 Done.
+ virtual const base::TimeDelta& wait_time_for_main_job() const = 0;
Ryan Hamilton 2016/07/01 00:13:30 ditto
Zhongyi Shi 2016/07/11 23:04:57 Removed. Used in the request_unittests. But I have
+ virtual void set_wait_time_for_main_job(const base::TimeDelta& delay) = 0;
Ryan Hamilton 2016/07/01 00:13:30 This needs to be CamelCase, since it's virtual.
Zhongyi Shi 2016/07/11 23:04:56 Done.
+
virtual bool for_websockets() = 0;
};
@@ -175,14 +186,11 @@ 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
+ // Tells |this| that |delegate_| 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
+ // this is not called, then Request is expected to cancel |this| by
Ryan Hamilton 2016/07/01 00:13:30 The request will not actually cancel the job, righ
// deleting it.
- void Resume(Job* job, const base::TimeDelta& delay);
+ virtual void Resume(const base::TimeDelta& delay);
// Called to detach |this| Job. May resume the other Job, will disconnect
// the socket for |this| Job, and notify |delegate| upon completion.
@@ -221,6 +229,8 @@ class HttpStreamFactoryImpl::Job {
private:
FRIEND_TEST_ALL_PREFIXES(HttpStreamFactoryImplRequestTest, DelayMainJob);
+ friend class HttpStreamFactoryImplJobPeer;
+
enum State {
STATE_START,
STATE_RESOLVE_PROXY,
@@ -243,8 +253,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 +321,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();
@@ -332,6 +339,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
@@ -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.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698