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

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: move resume logic up to controller 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..86c24b49601bc827f03e81778e4bc527f9b5cf27 100644
--- a/net/http/http_stream_factory_impl_job.h
+++ b/net/http/http_stream_factory_impl_job.h
@@ -116,6 +116,17 @@ class HttpStreamFactoryImpl::Job {
Job* job,
const ConnectionAttempts& attempts) = 0;
+ // Invoked to resume the main job when |job| initiates a connection but
+ // does not succeed.
+ virtual void OnInitConnectionNotSuccessful(
Ryan Hamilton 2016/06/29 23:12:28 Discussed offline. How about: virtual void OnConn
Zhongyi Shi 2016/06/30 22:53:39 Discussed offline. The controller will need to kno
+ Job* job,
+ const base::TimeDelta& delay) = 0;
+
+ // Return false if |job| has no blocking job and there's no wait time,
+ // i.e., |job| won't call Job::ResumeAfterDelay(). Else return true and
+ // resume |job| with appropriate wait time.
Ryan Hamilton 2016/06/29 23:12:28 How about something like: // Returns false if |jo
Zhongyi Shi 2016/06/30 22:53:39 Done.
+ virtual bool ShoudWait(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 +142,10 @@ class HttpStreamFactoryImpl::Job {
virtual WebSocketHandshakeStreamBase::CreateHelper*
websocket_handshake_stream_create_helper() = 0;
+ virtual bool blocking() = 0;
+ virtual const base::TimeDelta& wait_time_for_main_job() const = 0;
+ virtual void set_wait_time_for_main_job(const base::TimeDelta& delay) = 0;
Ryan Hamilton 2016/06/29 23:12:28 It's not obvious to me why these methods are neede
Zhongyi Shi 2016/06/30 22:53:39 The set method is mainly used for delayed TCP case
+
virtual bool for_websockets() = 0;
};
@@ -175,14 +190,14 @@ 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
// deleting it.
- void Resume(Job* job, const base::TimeDelta& delay);
+ virtual void Resume(const base::TimeDelta& delay);
+
+ // Resume |this| job after the specified |delay|.
+ void ResumeAfterDelay(const base::TimeDelta& delay);
Ryan Hamilton 2016/06/29 23:12:28 What is the difference between these two methods?
Zhongyi Shi 2016/06/30 22:53:39 In the old world, Resume calles ResumeAfterDelay i
// Called to detach |this| Job. May resume the other Job, will disconnect
// the socket for |this| Job, and notify |delegate| upon completion.
@@ -221,6 +236,8 @@ class HttpStreamFactoryImpl::Job {
private:
FRIEND_TEST_ALL_PREFIXES(HttpStreamFactoryImplRequestTest, DelayMainJob);
+ friend class HttpStreamFactoryImplJobPeer;
+
enum State {
STATE_START,
STATE_RESOLVE_PROXY,
@@ -243,8 +260,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 +328,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();
@@ -340,8 +354,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);
@@ -434,6 +448,8 @@ class HttpStreamFactoryImpl::Job {
CompletionCallback io_callback_;
std::unique_ptr<ClientSocketHandle> connection_;
HttpNetworkSession* const session_;
+ base::TimeDelta delay_;
+ State state_;
Ryan Hamilton 2016/06/29 23:12:28 nit: as discussed, can we remove this?
Zhongyi Shi 2016/06/30 22:53:39 Done.
State next_state_;
ProxyService::PacRequest* pac_request_;
SSLInfo ssl_info_;
@@ -457,17 +473,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