| OLD | NEW |
| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/location.h" | 13 #include "base/location.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/metrics/histogram_macros.h" | 15 #include "base/metrics/histogram_macros.h" |
| 16 #include "base/single_thread_task_runner.h" | 16 #include "base/single_thread_task_runner.h" |
| 17 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
| 18 #include "base/strings/string_piece.h" | 18 #include "base/strings/string_piece.h" |
| 19 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
| 20 #include "base/strings/stringprintf.h" | 20 #include "base/strings/stringprintf.h" |
| 21 #include "base/threading/thread_task_runner_handle.h" | 21 #include "base/threading/thread_task_runner_handle.h" |
| 22 #include "base/trace_event/memory_usage_estimator.h" |
| 22 #include "base/values.h" | 23 #include "base/values.h" |
| 23 #include "net/log/net_log.h" | 24 #include "net/log/net_log.h" |
| 24 #include "net/log/net_log_capture_mode.h" | 25 #include "net/log/net_log_capture_mode.h" |
| 25 #include "net/log/net_log_event_type.h" | 26 #include "net/log/net_log_event_type.h" |
| 26 #include "net/spdy/spdy_buffer_producer.h" | 27 #include "net/spdy/spdy_buffer_producer.h" |
| 27 #include "net/spdy/spdy_http_utils.h" | 28 #include "net/spdy/spdy_http_utils.h" |
| 28 #include "net/spdy/spdy_session.h" | 29 #include "net/spdy/spdy_session.h" |
| 29 | 30 |
| 30 namespace net { | 31 namespace net { |
| 31 | 32 |
| (...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 if (type_ == SPDY_PUSH_STREAM) { | 814 if (type_ == SPDY_PUSH_STREAM) { |
| 814 load_timing_info->push_start = recv_first_byte_time_; | 815 load_timing_info->push_start = recv_first_byte_time_; |
| 815 bool done_receiving = IsClosed() || (!pending_recv_data_.empty() && | 816 bool done_receiving = IsClosed() || (!pending_recv_data_.empty() && |
| 816 !pending_recv_data_.back()); | 817 !pending_recv_data_.back()); |
| 817 if (done_receiving) | 818 if (done_receiving) |
| 818 load_timing_info->push_end = recv_last_byte_time_; | 819 load_timing_info->push_end = recv_last_byte_time_; |
| 819 } | 820 } |
| 820 return result; | 821 return result; |
| 821 } | 822 } |
| 822 | 823 |
| 824 size_t SpdyStream::EstimateMemoryUsage() const { |
| 825 // TODO(xunjieli): https://crbug.com/669108. Estimate |pending_send_data_| |
| 826 // once scoped_refptr support is in. |
| 827 return base::trace_event::EstimateMemoryUsage(url_) + |
| 828 base::trace_event::EstimateMemoryUsage(request_headers_) + |
| 829 base::trace_event::EstimateMemoryUsage(url_from_header_block_) + |
| 830 base::trace_event::EstimateMemoryUsage(pending_recv_data_) + |
| 831 base::trace_event::EstimateMemoryUsage(response_headers_); |
| 832 } |
| 833 |
| 823 void SpdyStream::UpdateHistograms() { | 834 void SpdyStream::UpdateHistograms() { |
| 824 // We need at least the receive timers to be filled in, as otherwise | 835 // We need at least the receive timers to be filled in, as otherwise |
| 825 // metrics can be bogus. | 836 // metrics can be bogus. |
| 826 if (recv_first_byte_time_.is_null() || recv_last_byte_time_.is_null()) | 837 if (recv_first_byte_time_.is_null() || recv_last_byte_time_.is_null()) |
| 827 return; | 838 return; |
| 828 | 839 |
| 829 base::TimeTicks effective_send_time; | 840 base::TimeTicks effective_send_time; |
| 830 if (type_ == SPDY_PUSH_STREAM) { | 841 if (type_ == SPDY_PUSH_STREAM) { |
| 831 // Push streams shouldn't have |send_time_| filled in. | 842 // Push streams shouldn't have |send_time_| filled in. |
| 832 DCHECK(send_time_.is_null()); | 843 DCHECK(send_time_.is_null()); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, | 952 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, |
| 942 state); | 953 state); |
| 943 break; | 954 break; |
| 944 } | 955 } |
| 945 return description; | 956 return description; |
| 946 } | 957 } |
| 947 | 958 |
| 948 #undef STATE_CASE | 959 #undef STATE_CASE |
| 949 | 960 |
| 950 } // namespace net | 961 } // namespace net |
| OLD | NEW |