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 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1058 bool SpdySession::CloseOneIdleConnection() { | 1056 bool SpdySession::CloseOneIdleConnection() { |
1059 CHECK(!in_io_loop_); | 1057 CHECK(!in_io_loop_); |
1060 DCHECK(pool_); | 1058 DCHECK(pool_); |
1061 if (active_streams_.empty()) { | 1059 if (active_streams_.empty()) { |
1062 DoDrainSession(ERR_CONNECTION_CLOSED, "Closing idle connection."); | 1060 DoDrainSession(ERR_CONNECTION_CLOSED, "Closing idle connection."); |
1063 } | 1061 } |
1064 // Return false as the socket wasn't immediately closed. | 1062 // Return false as the socket wasn't immediately closed. |
1065 return false; | 1063 return false; |
1066 } | 1064 } |
1067 | 1065 |
1068 void SpdySession::DumpMemoryStats( | 1066 void SpdySession::DumpMemoryStats(StreamSocket::SocketMemoryStats* stats, |
1069 base::trace_event::ProcessMemoryDump* pmd, | 1067 bool* is_session_active) const { |
1070 const std::string& parent_absolute_name) const { | 1068 *is_session_active = is_active(); |
1071 std::string name = | 1069 connection_->DumpMemoryStats(stats); |
1072 base::StringPrintf("%s/session_%p", parent_absolute_name.c_str(), this); | |
1073 base::trace_event::MemoryAllocatorDump* session_dump = | |
1074 pmd->CreateAllocatorDump(name); | |
1075 session_dump->AddString("active", "", is_active() ? "1" : "0"); | |
1076 connection_->DumpMemoryStats(pmd, name); | |
1077 } | 1070 } |
1078 | 1071 |
1079 void SpdySession::EnqueueStreamWrite( | 1072 void SpdySession::EnqueueStreamWrite( |
1080 const base::WeakPtr<SpdyStream>& stream, | 1073 const base::WeakPtr<SpdyStream>& stream, |
1081 SpdyFrameType frame_type, | 1074 SpdyFrameType frame_type, |
1082 std::unique_ptr<SpdyBufferProducer> producer) { | 1075 std::unique_ptr<SpdyBufferProducer> producer) { |
1083 DCHECK(frame_type == HEADERS || frame_type == DATA); | 1076 DCHECK(frame_type == HEADERS || frame_type == DATA); |
1084 EnqueueWrite(stream->priority(), frame_type, std::move(producer), stream); | 1077 EnqueueWrite(stream->priority(), frame_type, std::move(producer), stream); |
1085 } | 1078 } |
1086 | 1079 |
(...skipping 2044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3131 if (!queue->empty()) { | 3124 if (!queue->empty()) { |
3132 SpdyStreamId stream_id = queue->front(); | 3125 SpdyStreamId stream_id = queue->front(); |
3133 queue->pop_front(); | 3126 queue->pop_front(); |
3134 return stream_id; | 3127 return stream_id; |
3135 } | 3128 } |
3136 } | 3129 } |
3137 return 0; | 3130 return 0; |
3138 } | 3131 } |
3139 | 3132 |
3140 } // namespace net | 3133 } // namespace net |
OLD | NEW |