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

Side by Side 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: fix a include typo Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_CONTROLLER_H_ 5 #ifndef NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_CONTROLLER_H_
6 #define NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_CONTROLLER_H_ 6 #define NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_CONTROLLER_H_
7 7
8 #include "net/http/http_stream_factory_impl_job.h" 8 #include "net/http/http_stream_factory_impl_job.h"
9 #include "net/http/http_stream_factory_impl_request.h" 9 #include "net/http/http_stream_factory_impl_request.h"
10 10
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 125
126 // Invoked when the |job| finishes pre-connecting sockets. 126 // Invoked when the |job| finishes pre-connecting sockets.
127 void OnPreconnectsComplete(Job* job) override; 127 void OnPreconnectsComplete(Job* job) override;
128 128
129 // Invoked to record connection attempts made by the socket layer to 129 // Invoked to record connection attempts made by the socket layer to
130 // Request if |job| is associated with Request. 130 // Request if |job| is associated with Request.
131 void AddConnectionAttemptsToRequest( 131 void AddConnectionAttemptsToRequest(
132 Job* job, 132 Job* job,
133 const ConnectionAttempts& attempts) override; 133 const ConnectionAttempts& attempts) override;
134 134
135 // Invoked when |job| finishes initiating a connection.
136 // Resume the other job if there's an error raised.
137 void OnConnectionInitialized(Job* job, int rv) override;
138
139 // Return false if |job| can advance to the next state. Otherwise, |job|
140 // will wait for Job::Resume() to be called before advancing.
141 bool ShouldWait(Job* job) override;
142
135 // Called when |job| determines the appropriate |spdy_session_key| for the 143 // Called when |job| determines the appropriate |spdy_session_key| for the
136 // Request. Note that this does not mean that SPDY is necessarily supported 144 // Request. Note that this does not mean that SPDY is necessarily supported
137 // for this SpdySessionKey, since we may need to wait for NPN to complete 145 // for this SpdySessionKey, since we may need to wait for NPN to complete
138 // before knowing if SPDY is available. 146 // before knowing if SPDY is available.
139 void SetSpdySessionKey(Job* job, 147 void SetSpdySessionKey(Job* job,
140 const SpdySessionKey& spdy_session_key) override; 148 const SpdySessionKey& spdy_session_key) override;
141 149
142 // Remove session from the SpdySessionRequestMap. 150 // Remove session from the SpdySessionRequestMap.
143 void RemoveRequestFromSpdySessionRequestMapForJob(Job* job) override; 151 void RemoveRequestFromSpdySessionRequestMapForJob(Job* job) override;
144 const BoundNetLog* GetNetLog(Job* job) const override; 152 const BoundNetLog* GetNetLog(Job* job) const override;
153
154 void MaybeSetWaitTimeForMainJob(const base::TimeDelta& delay) override;
155
145 WebSocketHandshakeStreamBase::CreateHelper* 156 WebSocketHandshakeStreamBase::CreateHelper*
146 websocket_handshake_stream_create_helper() override; 157 websocket_handshake_stream_create_helper() override;
147 158
148 private: 159 private:
149 FRIEND_TEST_ALL_PREFIXES(HttpStreamFactoryImplRequestTest, DelayMainJob); 160 friend class JobControllerPeer;
150 161
151 // Creates Job(s) for |request_|. Job(s) will be owned by |this|. 162 // Creates Job(s) for |request_|. Job(s) will be owned by |this|.
152 void CreateJobs(const HttpRequestInfo& request_info, 163 void CreateJobs(const HttpRequestInfo& request_info,
153 RequestPriority priority, 164 RequestPriority priority,
154 const SSLConfig& server_ssl_config, 165 const SSLConfig& server_ssl_config,
155 const SSLConfig& proxy_ssl_config, 166 const SSLConfig& proxy_ssl_config,
156 HttpStreamRequest::Delegate* delegate, 167 HttpStreamRequest::Delegate* delegate,
157 HttpStreamRequest::StreamType stream_type, 168 HttpStreamRequest::StreamType stream_type,
158 const BoundNetLog& net_log); 169 const BoundNetLog& net_log);
159 170
(...skipping 16 matching lines...) Expand all
176 // Called when a Job succeeds. 187 // Called when a Job succeeds.
177 void OnJobSucceeded(Job* job); 188 void OnJobSucceeded(Job* job);
178 189
179 // Marks completion of the |request_|. 190 // Marks completion of the |request_|.
180 void MarkRequestComplete(bool was_npn_negotiated, 191 void MarkRequestComplete(bool was_npn_negotiated,
181 NextProto protocol_negotiated, 192 NextProto protocol_negotiated,
182 bool using_spdy); 193 bool using_spdy);
183 194
184 void MaybeNotifyFactoryOfCompletion(); 195 void MaybeNotifyFactoryOfCompletion();
185 196
197 // Called to resume the main job with delay.
198 void MaybeResumeMainJob(Job* job, const base::TimeDelta& delay);
199
200 void ResumeMainJob();
201
186 // Returns true if QUIC is whitelisted for |host|. 202 // Returns true if QUIC is whitelisted for |host|.
187 bool IsQuicWhitelistedForHost(const std::string& host); 203 bool IsQuicWhitelistedForHost(const std::string& host);
188 204
189 AlternativeService GetAlternativeServiceFor( 205 AlternativeService GetAlternativeServiceFor(
190 const HttpRequestInfo& request_info, 206 const HttpRequestInfo& request_info,
191 HttpStreamRequest::Delegate* delegate, 207 HttpStreamRequest::Delegate* delegate,
192 HttpStreamRequest::StreamType stream_type); 208 HttpStreamRequest::StreamType stream_type);
193 209
194 AlternativeService GetAlternativeServiceForInternal( 210 AlternativeService GetAlternativeServiceForInternal(
195 const HttpRequestInfo& request_info, 211 const HttpRequestInfo& request_info,
(...skipping 20 matching lines...) Expand all
216 232
217 // |main_job_| is a job waiting to see if |alternative_job_| can reuse a 233 // |main_job_| is a job waiting to see if |alternative_job_| can reuse a
218 // connection. If |alternative_job_| is unable to do so, |this| will notify 234 // connection. If |alternative_job_| is unable to do so, |this| will notify
219 // |main_job_| to proceed and then race the two jobs. 235 // |main_job_| to proceed and then race the two jobs.
220 std::unique_ptr<Job> main_job_; 236 std::unique_ptr<Job> main_job_;
221 std::unique_ptr<Job> alternative_job_; 237 std::unique_ptr<Job> alternative_job_;
222 238
223 // True if a Job has ever been bound to the |request_|. 239 // True if a Job has ever been bound to the |request_|.
224 bool job_bound_; 240 bool job_bound_;
225 241
242 // True if the main job has to wait for the alternative job: i.e., the main
243 // job must not create a connection until it is resumed.
244 bool main_job_is_blocked_;
245 // Waiting time for the main job before it is resumed.
246 base::TimeDelta main_job_wait_time_;
247
226 // At the point where a Job is irrevocably tied to |request_|, we set this. 248 // At the point where a Job is irrevocably tied to |request_|, we set this.
227 // It will be nulled when the |request_| is finished. 249 // It will be nulled when the |request_| is finished.
228 Job* bound_job_; 250 Job* bound_job_;
251
252 base::WeakPtrFactory<JobController> ptr_factory_;
229 }; 253 };
230 254
231 } // namespace net 255 } // namespace net
232 256
233 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_CONTROLLER_H_ 257 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_CONTROLLER_H_
OLDNEW
« no previous file with comments | « net/http/http_stream_factory_impl_job.cc ('k') | net/http/http_stream_factory_impl_job_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698