| OLD | NEW |
| 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 #include "net/http/http_stream_factory_impl_job_controller.h" | 5 #include "net/http/http_stream_factory_impl_job_controller.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 DCHECK(request_); | 621 DCHECK(request_); |
| 622 return &request_->net_log(); | 622 return &request_->net_log(); |
| 623 } | 623 } |
| 624 | 624 |
| 625 void HttpStreamFactoryImpl::JobController::MaybeSetWaitTimeForMainJob( | 625 void HttpStreamFactoryImpl::JobController::MaybeSetWaitTimeForMainJob( |
| 626 const base::TimeDelta& delay) { | 626 const base::TimeDelta& delay) { |
| 627 if (main_job_is_blocked_) | 627 if (main_job_is_blocked_) |
| 628 main_job_wait_time_ = delay; | 628 main_job_wait_time_ = delay; |
| 629 } | 629 } |
| 630 | 630 |
| 631 bool HttpStreamFactoryImpl::JobController::HasPendingMainJob() const { |
| 632 return main_job_.get() != nullptr; |
| 633 } |
| 634 |
| 635 bool HttpStreamFactoryImpl::JobController::HasPendingAltJob() const { |
| 636 return alternative_job_.get() != nullptr; |
| 637 } |
| 638 |
| 639 size_t HttpStreamFactoryImpl::JobController::EstimateMemoryUsage() const { |
| 640 size_t estimated_size = 0; |
| 641 if (main_job_) |
| 642 estimated_size += main_job_->EstimateMemoryUsage(); |
| 643 if (alternative_job_) |
| 644 estimated_size += alternative_job_->EstimateMemoryUsage(); |
| 645 return estimated_size; |
| 646 } |
| 647 |
| 631 WebSocketHandshakeStreamBase::CreateHelper* HttpStreamFactoryImpl:: | 648 WebSocketHandshakeStreamBase::CreateHelper* HttpStreamFactoryImpl:: |
| 632 JobController::websocket_handshake_stream_create_helper() { | 649 JobController::websocket_handshake_stream_create_helper() { |
| 633 DCHECK(request_); | 650 DCHECK(request_); |
| 634 return request_->websocket_handshake_stream_create_helper(); | 651 return request_->websocket_handshake_stream_create_helper(); |
| 635 } | 652 } |
| 636 | 653 |
| 637 void HttpStreamFactoryImpl::JobController::CreateJobs( | 654 void HttpStreamFactoryImpl::JobController::CreateJobs( |
| 638 const HttpRequestInfo& request_info, | 655 const HttpRequestInfo& request_info, |
| 639 RequestPriority priority, | 656 RequestPriority priority, |
| 640 const SSLConfig& server_ssl_config, | 657 const SSLConfig& server_ssl_config, |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1097 return; | 1114 return; |
| 1098 DCHECK(alternative_job_->alternative_proxy_server().is_valid()); | 1115 DCHECK(alternative_job_->alternative_proxy_server().is_valid()); |
| 1099 alternative_job_->Start(request_->stream_type()); | 1116 alternative_job_->Start(request_->stream_type()); |
| 1100 } | 1117 } |
| 1101 | 1118 |
| 1102 bool HttpStreamFactoryImpl::JobController::IsJobOrphaned(Job* job) const { | 1119 bool HttpStreamFactoryImpl::JobController::IsJobOrphaned(Job* job) const { |
| 1103 return !request_ || (job_bound_ && bound_job_ != job); | 1120 return !request_ || (job_bound_ && bound_job_ != job); |
| 1104 } | 1121 } |
| 1105 | 1122 |
| 1106 } // namespace net | 1123 } // namespace net |
| OLD | NEW |