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

Side by Side Diff: net/http/http_stream_factory_impl_job_controller.cc

Issue 2802113002: One minor cleanup for JobController::EstimateMemoryUsage() (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #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
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/metrics/histogram_macros.h" 12 #include "base/metrics/histogram_macros.h"
13 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
14 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
15 #include "base/threading/thread_task_runner_handle.h" 15 #include "base/threading/thread_task_runner_handle.h"
16 #include "base/trace_event/memory_usage_estimator.h"
16 #include "base/values.h" 17 #include "base/values.h"
17 #include "net/base/host_mapping_rules.h" 18 #include "net/base/host_mapping_rules.h"
18 #include "net/base/proxy_delegate.h" 19 #include "net/base/proxy_delegate.h"
19 #include "net/http/bidirectional_stream_impl.h" 20 #include "net/http/bidirectional_stream_impl.h"
20 #include "net/http/transport_security_state.h" 21 #include "net/http/transport_security_state.h"
21 #include "net/log/net_log_capture_mode.h" 22 #include "net/log/net_log_capture_mode.h"
22 #include "net/log/net_log_event_type.h" 23 #include "net/log/net_log_event_type.h"
23 #include "net/log/net_log_source.h" 24 #include "net/log/net_log_source.h"
24 #include "net/log/net_log_with_source.h" 25 #include "net/log/net_log_with_source.h"
25 #include "net/proxy/proxy_server.h" 26 #include "net/proxy/proxy_server.h"
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 673
673 bool HttpStreamFactoryImpl::JobController::HasPendingMainJob() const { 674 bool HttpStreamFactoryImpl::JobController::HasPendingMainJob() const {
674 return main_job_.get() != nullptr; 675 return main_job_.get() != nullptr;
675 } 676 }
676 677
677 bool HttpStreamFactoryImpl::JobController::HasPendingAltJob() const { 678 bool HttpStreamFactoryImpl::JobController::HasPendingAltJob() const {
678 return alternative_job_.get() != nullptr; 679 return alternative_job_.get() != nullptr;
679 } 680 }
680 681
681 size_t HttpStreamFactoryImpl::JobController::EstimateMemoryUsage() const { 682 size_t HttpStreamFactoryImpl::JobController::EstimateMemoryUsage() const {
682 size_t estimated_size = 0; 683 return base::trace_event::EstimateMemoryUsage(main_job_) +
683 if (main_job_) 684 base::trace_event::EstimateMemoryUsage(alternative_job_);
684 estimated_size += main_job_->EstimateMemoryUsage();
685 if (alternative_job_)
686 estimated_size += alternative_job_->EstimateMemoryUsage();
687 return estimated_size;
688 } 685 }
689 686
690 WebSocketHandshakeStreamBase::CreateHelper* HttpStreamFactoryImpl:: 687 WebSocketHandshakeStreamBase::CreateHelper* HttpStreamFactoryImpl::
691 JobController::websocket_handshake_stream_create_helper() { 688 JobController::websocket_handshake_stream_create_helper() {
692 DCHECK(request_); 689 DCHECK(request_);
693 return request_->websocket_handshake_stream_create_helper(); 690 return request_->websocket_handshake_stream_create_helper();
694 } 691 }
695 692
696 void HttpStreamFactoryImpl::JobController::CreateJobs( 693 void HttpStreamFactoryImpl::JobController::CreateJobs(
697 const HttpRequestInfo& request_info, 694 const HttpRequestInfo& request_info,
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
1151 return; 1148 return;
1152 DCHECK(alternative_job_->alternative_proxy_server().is_valid()); 1149 DCHECK(alternative_job_->alternative_proxy_server().is_valid());
1153 alternative_job_->Start(request_->stream_type()); 1150 alternative_job_->Start(request_->stream_type());
1154 } 1151 }
1155 1152
1156 bool HttpStreamFactoryImpl::JobController::IsJobOrphaned(Job* job) const { 1153 bool HttpStreamFactoryImpl::JobController::IsJobOrphaned(Job* job) const {
1157 return !request_ || (job_bound_ && bound_job_ != job); 1154 return !request_ || (job_bound_ && bound_job_ != job);
1158 } 1155 }
1159 1156
1160 } // namespace net 1157 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698