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

Side by Side Diff: net/http/http_stream_factory_impl_job.h

Issue 2332193003: JobController3: Move MarkAlternativeServiceBroken to job controller (Closed)
Patch Set: rebase Created 4 years, 3 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_H_ 5 #ifndef NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_
6 #define NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ 6 #define NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 228
229 bool is_waiting() const { return next_state_ == STATE_WAIT_COMPLETE; } 229 bool is_waiting() const { return next_state_ == STATE_WAIT_COMPLETE; }
230 const SSLConfig& server_ssl_config() const; 230 const SSLConfig& server_ssl_config() const;
231 const SSLConfig& proxy_ssl_config() const; 231 const SSLConfig& proxy_ssl_config() const;
232 const ProxyInfo& proxy_info() const; 232 const ProxyInfo& proxy_info() const;
233 233
234 // Called to indicate that this job succeeded, and some other jobs 234 // Called to indicate that this job succeeded, and some other jobs
235 // will be orphaned. 235 // will be orphaned.
236 void ReportJobSucceededForRequest(); 236 void ReportJobSucceededForRequest();
237 237
238 // Marks that the other |job| has completed. 238 JobType job_type() const { return job_type_; }
239 virtual void MarkOtherJobComplete(const Job& job);
240 239
241 JobType job_type() const { return job_type_; } 240 const AlternativeService alternative_service() const {
241 return alternative_service_;
242 }
243
244 const ProxyServer alternative_proxy_server() const {
245 return alternative_proxy_server_;
246 }
242 247
243 private: 248 private:
244 friend class HttpStreamFactoryImplJobPeer; 249 friend class HttpStreamFactoryImplJobPeer;
245 250
246 enum State { 251 enum State {
247 STATE_START, 252 STATE_START,
248 STATE_RESOLVE_PROXY, 253 STATE_RESOLVE_PROXY,
249 STATE_RESOLVE_PROXY_COMPLETE, 254 STATE_RESOLVE_PROXY_COMPLETE,
250 255
251 // Note that when Alternate-Protocol says we can connect to an alternate 256 // Note that when Alternate-Protocol says we can connect to an alternate
(...skipping 22 matching lines...) Expand all
274 STATE_RESTART_TUNNEL_AUTH, 279 STATE_RESTART_TUNNEL_AUTH,
275 STATE_RESTART_TUNNEL_AUTH_COMPLETE, 280 STATE_RESTART_TUNNEL_AUTH_COMPLETE,
276 STATE_CREATE_STREAM, 281 STATE_CREATE_STREAM,
277 STATE_CREATE_STREAM_COMPLETE, 282 STATE_CREATE_STREAM_COMPLETE,
278 STATE_DRAIN_BODY_FOR_AUTH_RESTART, 283 STATE_DRAIN_BODY_FOR_AUTH_RESTART,
279 STATE_DRAIN_BODY_FOR_AUTH_RESTART_COMPLETE, 284 STATE_DRAIN_BODY_FOR_AUTH_RESTART_COMPLETE,
280 STATE_DONE, 285 STATE_DONE,
281 STATE_NONE 286 STATE_NONE
282 }; 287 };
283 288
284 enum JobStatus {
285 STATUS_RUNNING,
286 STATUS_FAILED,
287 STATUS_BROKEN,
288 STATUS_SUCCEEDED
289 };
290
291 void OnStreamReadyCallback(); 289 void OnStreamReadyCallback();
292 void OnBidirectionalStreamImplReadyCallback(); 290 void OnBidirectionalStreamImplReadyCallback();
293 void OnWebSocketHandshakeStreamReadyCallback(); 291 void OnWebSocketHandshakeStreamReadyCallback();
294 // This callback function is called when a new SPDY session is created. 292 // This callback function is called when a new SPDY session is created.
295 void OnNewSpdySessionReadyCallback(); 293 void OnNewSpdySessionReadyCallback();
296 void OnStreamFailedCallback(int result); 294 void OnStreamFailedCallback(int result);
297 void OnCertificateErrorCallback(int result, const SSLInfo& ssl_info); 295 void OnCertificateErrorCallback(int result, const SSLInfo& ssl_info);
298 void OnNeedsProxyAuthCallback(const HttpResponseInfo& response_info, 296 void OnNeedsProxyAuthCallback(const HttpResponseInfo& response_info,
299 HttpAuthController* auth_controller); 297 HttpAuthController* auth_controller);
300 void OnNeedsClientAuthCallback(SSLCertRequestInfo* cert_info); 298 void OnNeedsClientAuthCallback(SSLCertRequestInfo* cert_info);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 371
374 // Called to handle a client certificate request. 372 // Called to handle a client certificate request.
375 int HandleCertificateRequest(int error); 373 int HandleCertificateRequest(int error);
376 374
377 // Moves this stream request into SPDY mode. 375 // Moves this stream request into SPDY mode.
378 void SwitchToSpdyMode(); 376 void SwitchToSpdyMode();
379 377
380 // Should we force QUIC for this stream request. 378 // Should we force QUIC for this stream request.
381 bool ShouldForceQuic() const; 379 bool ShouldForceQuic() const;
382 380
383 void MaybeMarkAlternativeServiceBroken();
384
385 // May notify proxy delegate that the alternative proxy server is broken. The
386 // alternative proxy server is considered as broken if the alternative proxy
387 // server job failed, but the main job was successful.
388 void MaybeNotifyAlternativeProxyServerBroken() const;
389
390 ClientSocketPoolManager::SocketGroupType GetSocketGroup() const; 381 ClientSocketPoolManager::SocketGroupType GetSocketGroup() const;
391 382
392 void MaybeCopyConnectionAttemptsFromSocketOrHandle(); 383 void MaybeCopyConnectionAttemptsFromSocketOrHandle();
393 384
394 // Record histograms of latency until Connect() completes. 385 // Record histograms of latency until Connect() completes.
395 static void LogHttpConnectedMetrics(const ClientSocketHandle& handle); 386 static void LogHttpConnectedMetrics(const ClientSocketHandle& handle);
396 387
397 // Invoked by the transport socket pool after host resolution is complete 388 // Invoked by the transport socket pool after host resolution is complete
398 // to allow the connection to be aborted, if a matching SPDY session can 389 // to allow the connection to be aborted, if a matching SPDY session can
399 // be found. Will return ERR_SPDY_SESSION_ALREADY_EXISTS if such a 390 // be found. Will return ERR_SPDY_SESSION_ALREADY_EXISTS if such a
(...skipping 22 matching lines...) Expand all
422 // alternative service (after applying host mapping rules). 413 // alternative service (after applying host mapping rules).
423 const HostPortPair destination_; 414 const HostPortPair destination_;
424 415
425 // The origin url we're trying to reach. This url may be different from the 416 // The origin url we're trying to reach. This url may be different from the
426 // original request when host mapping rules are set-up. 417 // original request when host mapping rules are set-up.
427 const GURL origin_url_; 418 const GURL origin_url_;
428 419
429 // AlternativeService for this Job if this is an alternative Job. 420 // AlternativeService for this Job if this is an alternative Job.
430 const AlternativeService alternative_service_; 421 const AlternativeService alternative_service_;
431 422
432 // AlternativeService for the other Job if this is not an alternative Job.
433 AlternativeService other_job_alternative_service_;
434
435 // Alternative proxy server that should be used by |this| to fetch the 423 // Alternative proxy server that should be used by |this| to fetch the
436 // request. 424 // request.
437 const ProxyServer alternative_proxy_server_; 425 const ProxyServer alternative_proxy_server_;
438 426
439 // Alternative proxy server for the other job.
440 ProxyServer other_job_alternative_proxy_server_;
441
442 // Unowned. |this| job is owned by |delegate_|. 427 // Unowned. |this| job is owned by |delegate_|.
443 Delegate* delegate_; 428 Delegate* delegate_;
444 429
445 const JobType job_type_; 430 const JobType job_type_;
446 431
447 // True if handling a HTTPS request, or using SPDY with SSL 432 // True if handling a HTTPS request, or using SPDY with SSL
448 bool using_ssl_; 433 bool using_ssl_;
449 434
450 // True if this network transaction is using SPDY instead of HTTP. 435 // True if this network transaction is using SPDY instead of HTTP.
451 bool using_spdy_; 436 bool using_spdy_;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 471
487 // Initialized when we create a new SpdySession. 472 // Initialized when we create a new SpdySession.
488 base::WeakPtr<SpdySession> new_spdy_session_; 473 base::WeakPtr<SpdySession> new_spdy_session_;
489 474
490 // Initialized when we have an existing SpdySession. 475 // Initialized when we have an existing SpdySession.
491 base::WeakPtr<SpdySession> existing_spdy_session_; 476 base::WeakPtr<SpdySession> existing_spdy_session_;
492 477
493 // Only used if |new_spdy_session_| is non-NULL. 478 // Only used if |new_spdy_session_| is non-NULL.
494 bool spdy_session_direct_; 479 bool spdy_session_direct_;
495 480
496 JobStatus job_status_;
497 JobStatus other_job_status_;
498
499 // Type of stream that is requested. 481 // Type of stream that is requested.
500 HttpStreamRequest::StreamType stream_type_; 482 HttpStreamRequest::StreamType stream_type_;
501 483
502 base::WeakPtrFactory<Job> ptr_factory_; 484 base::WeakPtrFactory<Job> ptr_factory_;
503 485
504 DISALLOW_COPY_AND_ASSIGN(Job); 486 DISALLOW_COPY_AND_ASSIGN(Job);
505 }; 487 };
506 488
507 // Factory for creating Jobs. 489 // Factory for creating Jobs.
508 class HttpStreamFactoryImpl::JobFactory { 490 class HttpStreamFactoryImpl::JobFactory {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 const SSLConfig& server_ssl_config, 529 const SSLConfig& server_ssl_config,
548 const SSLConfig& proxy_ssl_config, 530 const SSLConfig& proxy_ssl_config,
549 HostPortPair destination, 531 HostPortPair destination,
550 GURL origin_url, 532 GURL origin_url,
551 NetLog* net_log) = 0; 533 NetLog* net_log) = 0;
552 }; 534 };
553 535
554 } // namespace net 536 } // namespace net
555 537
556 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ 538 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_
OLDNEW
« 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.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698