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_session.h" | 5 #include "net/spdy/spdy_session.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <map> | 9 #include <map> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/location.h" | 14 #include "base/location.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/memory/ptr_util.h" | 16 #include "base/memory/ptr_util.h" |
17 #include "base/metrics/histogram_macros.h" | 17 #include "base/metrics/histogram_macros.h" |
18 #include "base/metrics/sparse_histogram.h" | 18 #include "base/metrics/sparse_histogram.h" |
19 #include "base/profiler/scoped_tracker.h" | 19 #include "base/profiler/scoped_tracker.h" |
20 #include "base/single_thread_task_runner.h" | 20 #include "base/single_thread_task_runner.h" |
21 #include "base/stl_util.h" | 21 #include "base/stl_util.h" |
22 #include "base/strings/string_number_conversions.h" | 22 #include "base/strings/string_number_conversions.h" |
23 #include "base/strings/string_util.h" | 23 #include "base/strings/string_util.h" |
24 #include "base/strings/stringprintf.h" | 24 #include "base/strings/stringprintf.h" |
25 #include "base/strings/utf_string_conversions.h" | 25 #include "base/strings/utf_string_conversions.h" |
26 #include "base/threading/thread_task_runner_handle.h" | 26 #include "base/threading/thread_task_runner_handle.h" |
27 #include "base/time/time.h" | 27 #include "base/time/time.h" |
28 #include "base/trace_event/memory_allocator_dump.h" | |
29 #include "base/trace_event/process_memory_dump.h" | |
30 #include "base/trace_event/trace_event.h" | 28 #include "base/trace_event/trace_event.h" |
31 #include "base/values.h" | 29 #include "base/values.h" |
32 #include "crypto/ec_private_key.h" | 30 #include "crypto/ec_private_key.h" |
33 #include "crypto/ec_signature_creator.h" | 31 #include "crypto/ec_signature_creator.h" |
34 #include "net/base/proxy_delegate.h" | 32 #include "net/base/proxy_delegate.h" |
35 #include "net/cert/asn1_util.h" | 33 #include "net/cert/asn1_util.h" |
36 #include "net/cert/cert_verify_result.h" | 34 #include "net/cert/cert_verify_result.h" |
37 #include "net/cert/ct_policy_status.h" | 35 #include "net/cert/ct_policy_status.h" |
38 #include "net/http/http_log_util.h" | 36 #include "net/http/http_log_util.h" |
39 #include "net/http/http_network_session.h" | 37 #include "net/http/http_network_session.h" |
(...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1024 bool SpdySession::CloseOneIdleConnection() { | 1022 bool SpdySession::CloseOneIdleConnection() { |
1025 CHECK(!in_io_loop_); | 1023 CHECK(!in_io_loop_); |
1026 DCHECK(pool_); | 1024 DCHECK(pool_); |
1027 if (active_streams_.empty()) { | 1025 if (active_streams_.empty()) { |
1028 DoDrainSession(ERR_CONNECTION_CLOSED, "Closing idle connection."); | 1026 DoDrainSession(ERR_CONNECTION_CLOSED, "Closing idle connection."); |
1029 } | 1027 } |
1030 // Return false as the socket wasn't immediately closed. | 1028 // Return false as the socket wasn't immediately closed. |
1031 return false; | 1029 return false; |
1032 } | 1030 } |
1033 | 1031 |
1034 void SpdySession::DumpMemoryStats( | 1032 void SpdySession::DumpMemoryStats(StreamSocket::SocketMemoryStats* stats, |
1035 base::trace_event::ProcessMemoryDump* pmd, | 1033 bool* is_session_active) const { |
1036 const std::string& parent_absolute_name) const { | 1034 *is_session_active = is_active(); |
1037 std::string name = | 1035 connection_->DumpMemoryStats(stats); |
1038 base::StringPrintf("%s/session_%p", parent_absolute_name.c_str(), this); | |
1039 base::trace_event::MemoryAllocatorDump* session_dump = | |
1040 pmd->CreateAllocatorDump(name); | |
1041 session_dump->AddString("active", "", is_active() ? "1" : "0"); | |
1042 connection_->DumpMemoryStats(pmd, name); | |
1043 } | 1036 } |
1044 | 1037 |
1045 void SpdySession::EnqueueStreamWrite( | 1038 void SpdySession::EnqueueStreamWrite( |
1046 const base::WeakPtr<SpdyStream>& stream, | 1039 const base::WeakPtr<SpdyStream>& stream, |
1047 SpdyFrameType frame_type, | 1040 SpdyFrameType frame_type, |
1048 std::unique_ptr<SpdyBufferProducer> producer) { | 1041 std::unique_ptr<SpdyBufferProducer> producer) { |
1049 DCHECK(frame_type == HEADERS || frame_type == DATA); | 1042 DCHECK(frame_type == HEADERS || frame_type == DATA); |
1050 EnqueueWrite(stream->priority(), frame_type, std::move(producer), stream); | 1043 EnqueueWrite(stream->priority(), frame_type, std::move(producer), stream); |
1051 } | 1044 } |
1052 | 1045 |
(...skipping 2014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3067 if (!queue->empty()) { | 3060 if (!queue->empty()) { |
3068 SpdyStreamId stream_id = queue->front(); | 3061 SpdyStreamId stream_id = queue->front(); |
3069 queue->pop_front(); | 3062 queue->pop_front(); |
3070 return stream_id; | 3063 return stream_id; |
3071 } | 3064 } |
3072 } | 3065 } |
3073 return 0; | 3066 return 0; |
3074 } | 3067 } |
3075 | 3068 |
3076 } // namespace net | 3069 } // namespace net |
OLD | NEW |