| 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 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 DCHECK(request_); | 628 DCHECK(request_); |
| 629 return &request_->net_log(); | 629 return &request_->net_log(); |
| 630 } | 630 } |
| 631 | 631 |
| 632 void HttpStreamFactoryImpl::JobController::MaybeSetWaitTimeForMainJob( | 632 void HttpStreamFactoryImpl::JobController::MaybeSetWaitTimeForMainJob( |
| 633 const base::TimeDelta& delay) { | 633 const base::TimeDelta& delay) { |
| 634 if (main_job_is_blocked_) | 634 if (main_job_is_blocked_) |
| 635 main_job_wait_time_ = delay; | 635 main_job_wait_time_ = delay; |
| 636 } | 636 } |
| 637 | 637 |
| 638 bool HttpStreamFactoryImpl::JobController::HasPendingMainJob() const { |
| 639 return main_job_.get() != nullptr; |
| 640 } |
| 641 |
| 642 bool HttpStreamFactoryImpl::JobController::HasPendingAltJob() const { |
| 643 return alternative_job_.get() != nullptr; |
| 644 } |
| 645 |
| 646 size_t HttpStreamFactoryImpl::JobController::EstimateMemoryUsage() const { |
| 647 size_t estimated_size = 0; |
| 648 if (main_job_) |
| 649 estimated_size += main_job_->EstimateMemoryUsage(); |
| 650 if (alternative_job_) |
| 651 estimated_size += alternative_job_->EstimateMemoryUsage(); |
| 652 return estimated_size; |
| 653 } |
| 654 |
| 638 WebSocketHandshakeStreamBase::CreateHelper* HttpStreamFactoryImpl:: | 655 WebSocketHandshakeStreamBase::CreateHelper* HttpStreamFactoryImpl:: |
| 639 JobController::websocket_handshake_stream_create_helper() { | 656 JobController::websocket_handshake_stream_create_helper() { |
| 640 DCHECK(request_); | 657 DCHECK(request_); |
| 641 return request_->websocket_handshake_stream_create_helper(); | 658 return request_->websocket_handshake_stream_create_helper(); |
| 642 } | 659 } |
| 643 | 660 |
| 644 void HttpStreamFactoryImpl::JobController::CreateJobs( | 661 void HttpStreamFactoryImpl::JobController::CreateJobs( |
| 645 const HttpRequestInfo& request_info, | 662 const HttpRequestInfo& request_info, |
| 646 RequestPriority priority, | 663 RequestPriority priority, |
| 647 const SSLConfig& server_ssl_config, | 664 const SSLConfig& server_ssl_config, |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1094 return; | 1111 return; |
| 1095 DCHECK(alternative_job_->alternative_proxy_server().is_valid()); | 1112 DCHECK(alternative_job_->alternative_proxy_server().is_valid()); |
| 1096 alternative_job_->Start(request_->stream_type()); | 1113 alternative_job_->Start(request_->stream_type()); |
| 1097 } | 1114 } |
| 1098 | 1115 |
| 1099 bool HttpStreamFactoryImpl::JobController::IsJobOrphaned(Job* job) const { | 1116 bool HttpStreamFactoryImpl::JobController::IsJobOrphaned(Job* job) const { |
| 1100 return !request_ || (job_bound_ && bound_job_ != job); | 1117 return !request_ || (job_bound_ && bound_job_ != job); |
| 1101 } | 1118 } |
| 1102 | 1119 |
| 1103 } // namespace net | 1120 } // namespace net |
| OLD | NEW |