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

Unified Diff: net/http/http_stream_factory_impl_job_controller.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: More tests with Resume logic 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_controller.h
diff --git a/net/http/http_stream_factory_impl_job_controller.h b/net/http/http_stream_factory_impl_job_controller.h
index db1e572672b3f2efee0a1f4238266ac88bdd536f..bf77a29a9922818f619a9ca2a24e0c187a9f648b 100644
--- a/net/http/http_stream_factory_impl_job_controller.h
+++ b/net/http/http_stream_factory_impl_job_controller.h
@@ -133,6 +133,15 @@ class HttpStreamFactoryImpl::JobController
Job* job,
const ConnectionAttempts& attempts) override;
+ // Invoked when |job| finishes initiating a connection.
+ // Resume the other job if there's an error raised.
+ void OnConnectionInitialized(Job* job, int rv) override;
+
+ // Return false if |job| has no blocking job and there's no wait time,
+ // i.e., |job| won't call Job::ResumeAfterDelay(). Else true and resume
Ryan Hamilton 2016/07/12 00:21:45 ResumeAfterDelay is now dead, right? Perhaps this
Zhongyi Shi 2016/07/12 23:03:12 Done.
+ // |job| with appropriate wait time.
+ bool ShouldWait(Job* job) override;
+
// 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
@@ -143,11 +152,14 @@ class HttpStreamFactoryImpl::JobController
// Remove session from the SpdySessionRequestMap.
void RemoveRequestFromSpdySessionRequestMapForJob(Job* job) override;
const BoundNetLog* GetNetLog(Job* job) const override;
+
+ void SetWaitTimeForMainJob(const base::TimeDelta& delay) override;
+
WebSocketHandshakeStreamBase::CreateHelper*
websocket_handshake_stream_create_helper() override;
private:
- FRIEND_TEST_ALL_PREFIXES(HttpStreamFactoryImplRequestTest, DelayMainJob);
+ friend class JobControllerPeer;
// Creates Job(s) for |request_|. Job(s) will be owned by |this|.
void CreateJobs(const HttpRequestInfo& request_info,
@@ -184,6 +196,11 @@ class HttpStreamFactoryImpl::JobController
void MaybeNotifyFactoryOfCompletion();
+ // Called to resume the main job with delay.
+ void MaybeResumeMainJob(Job* job, const base::TimeDelta& delay);
+
+ void ResumeMainJob();
+
// Returns true if QUIC is whitelisted for |host|.
bool IsQuicWhitelistedForHost(const std::string& host);
@@ -224,9 +241,16 @@ class HttpStreamFactoryImpl::JobController
// True if a Job has ever been bound to the |request_|.
bool job_bound_;
+ // True if the |main_job_| has to wait for |alternative_job_|. The delay
+ // is specified in |main_job_wait_time_|.
+ bool main_job_is_blocked_;
Ryan Hamilton 2016/07/12 00:21:45 Let's comment this a bit more. When main_job_is_
Zhongyi Shi 2016/07/12 23:03:12 Done.
+ base::TimeDelta main_job_wait_time_;
+
// At the point where a Job is irrevocably tied to |request_|, we set this.
// It will be nulled when the |request_| is finished.
Job* bound_job_;
+
+ base::WeakPtrFactory<JobController> ptr_factory_;
};
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698