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

Side by Side Diff: net/spdy/spdy_stream.cc

Issue 2665283003: Improve memory estimate of SpdySessionPool in net/ MemoryDumpProvider. (Closed)
Patch Set: address bnc comments Created 3 years, 10 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 #include "net/spdy/spdy_stream.h" 5 #include "net/spdy/spdy_stream.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/location.h" 12 #include "base/location.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/metrics/histogram_macros.h" 14 #include "base/metrics/histogram_macros.h"
15 #include "base/single_thread_task_runner.h" 15 #include "base/single_thread_task_runner.h"
16 #include "base/strings/string_number_conversions.h" 16 #include "base/strings/string_number_conversions.h"
17 #include "base/strings/string_piece.h" 17 #include "base/strings/string_piece.h"
18 #include "base/strings/string_util.h" 18 #include "base/strings/string_util.h"
19 #include "base/strings/stringprintf.h" 19 #include "base/strings/stringprintf.h"
20 #include "base/threading/thread_task_runner_handle.h" 20 #include "base/threading/thread_task_runner_handle.h"
21 #include "base/trace_event/memory_usage_estimator.h"
21 #include "base/values.h" 22 #include "base/values.h"
22 #include "net/log/net_log.h" 23 #include "net/log/net_log.h"
23 #include "net/log/net_log_capture_mode.h" 24 #include "net/log/net_log_capture_mode.h"
24 #include "net/log/net_log_event_type.h" 25 #include "net/log/net_log_event_type.h"
25 #include "net/spdy/spdy_buffer_producer.h" 26 #include "net/spdy/spdy_buffer_producer.h"
26 #include "net/spdy/spdy_http_utils.h" 27 #include "net/spdy/spdy_http_utils.h"
27 #include "net/spdy/spdy_session.h" 28 #include "net/spdy/spdy_session.h"
28 29
29 namespace net { 30 namespace net {
30 31
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 if (type_ == SPDY_PUSH_STREAM) { 813 if (type_ == SPDY_PUSH_STREAM) {
813 load_timing_info->push_start = recv_first_byte_time_; 814 load_timing_info->push_start = recv_first_byte_time_;
814 bool done_receiving = IsClosed() || (!pending_recv_data_.empty() && 815 bool done_receiving = IsClosed() || (!pending_recv_data_.empty() &&
815 !pending_recv_data_.back()); 816 !pending_recv_data_.back());
816 if (done_receiving) 817 if (done_receiving)
817 load_timing_info->push_end = recv_last_byte_time_; 818 load_timing_info->push_end = recv_last_byte_time_;
818 } 819 }
819 return result; 820 return result;
820 } 821 }
821 822
823 size_t SpdyStream::EstimateMemoryUsage() const {
824 return base::trace_event::EstimateMemoryUsage(url_) +
825 base::trace_event::EstimateMemoryUsage(request_headers_);
DmitrySkiba 2017/02/02 18:16:27 Please also estimate url_from_header_block_ and pe
xunjieli 2017/02/03 22:25:10 Done.
826 }
827
822 void SpdyStream::UpdateHistograms() { 828 void SpdyStream::UpdateHistograms() {
823 // We need at least the receive timers to be filled in, as otherwise 829 // We need at least the receive timers to be filled in, as otherwise
824 // metrics can be bogus. 830 // metrics can be bogus.
825 if (recv_first_byte_time_.is_null() || recv_last_byte_time_.is_null()) 831 if (recv_first_byte_time_.is_null() || recv_last_byte_time_.is_null())
826 return; 832 return;
827 833
828 base::TimeTicks effective_send_time; 834 base::TimeTicks effective_send_time;
829 if (type_ == SPDY_PUSH_STREAM) { 835 if (type_ == SPDY_PUSH_STREAM) {
830 // Push streams shouldn't have |send_time_| filled in. 836 // Push streams shouldn't have |send_time_| filled in.
831 DCHECK(send_time_.is_null()); 837 DCHECK(send_time_.is_null());
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, 946 description = base::StringPrintf("Unknown state 0x%08X (%u)", state,
941 state); 947 state);
942 break; 948 break;
943 } 949 }
944 return description; 950 return description;
945 } 951 }
946 952
947 #undef STATE_CASE 953 #undef STATE_CASE
948 954
949 } // namespace net 955 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698