| 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/metrics/histogram_macros.h" | 16 #include "base/metrics/histogram_macros.h" |
| 17 #include "base/metrics/sparse_histogram.h" | 17 #include "base/metrics/sparse_histogram.h" |
| 18 #include "base/profiler/scoped_tracker.h" | 18 #include "base/profiler/scoped_tracker.h" |
| 19 #include "base/single_thread_task_runner.h" | 19 #include "base/single_thread_task_runner.h" |
| 20 #include "base/stl_util.h" | 20 #include "base/stl_util.h" |
| 21 #include "base/strings/string_number_conversions.h" | 21 #include "base/strings/string_number_conversions.h" |
| 22 #include "base/strings/string_util.h" | 22 #include "base/strings/string_util.h" |
| 23 #include "base/strings/stringprintf.h" | 23 #include "base/strings/stringprintf.h" |
| 24 #include "base/strings/utf_string_conversions.h" | 24 #include "base/strings/utf_string_conversions.h" |
| 25 #include "base/threading/thread_task_runner_handle.h" | 25 #include "base/threading/thread_task_runner_handle.h" |
| 26 #include "base/time/time.h" | 26 #include "base/time/time.h" |
| 27 #include "base/trace_event/memory_allocator_dump.h" |
| 28 #include "base/trace_event/process_memory_dump.h" |
| 27 #include "base/trace_event/trace_event.h" | 29 #include "base/trace_event/trace_event.h" |
| 28 #include "base/values.h" | 30 #include "base/values.h" |
| 29 #include "crypto/ec_private_key.h" | 31 #include "crypto/ec_private_key.h" |
| 30 #include "crypto/ec_signature_creator.h" | 32 #include "crypto/ec_signature_creator.h" |
| 31 #include "net/base/proxy_delegate.h" | 33 #include "net/base/proxy_delegate.h" |
| 32 #include "net/cert/asn1_util.h" | 34 #include "net/cert/asn1_util.h" |
| 33 #include "net/cert/cert_verify_result.h" | 35 #include "net/cert/cert_verify_result.h" |
| 34 #include "net/cert/ct_policy_status.h" | 36 #include "net/cert/ct_policy_status.h" |
| 35 #include "net/http/http_log_util.h" | 37 #include "net/http/http_log_util.h" |
| 36 #include "net/http/http_network_session.h" | 38 #include "net/http/http_network_session.h" |
| (...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 963 bool SpdySession::CloseOneIdleConnection() { | 965 bool SpdySession::CloseOneIdleConnection() { |
| 964 CHECK(!in_io_loop_); | 966 CHECK(!in_io_loop_); |
| 965 DCHECK(pool_); | 967 DCHECK(pool_); |
| 966 if (active_streams_.empty()) { | 968 if (active_streams_.empty()) { |
| 967 DoDrainSession(ERR_CONNECTION_CLOSED, "Closing idle connection."); | 969 DoDrainSession(ERR_CONNECTION_CLOSED, "Closing idle connection."); |
| 968 } | 970 } |
| 969 // Return false as the socket wasn't immediately closed. | 971 // Return false as the socket wasn't immediately closed. |
| 970 return false; | 972 return false; |
| 971 } | 973 } |
| 972 | 974 |
| 975 void SpdySession::DumpMemoryStats( |
| 976 base::trace_event::ProcessMemoryDump* pmd, |
| 977 const std::string& parent_absolute_name) const { |
| 978 std::string name = |
| 979 base::StringPrintf("%s/session_%p", parent_absolute_name.c_str(), this); |
| 980 base::trace_event::MemoryAllocatorDump* session_dump = |
| 981 pmd->CreateAllocatorDump(name); |
| 982 session_dump->AddString("active", "", is_active() ? "1" : "0"); |
| 983 connection_->DumpMemoryStats(pmd, name); |
| 984 } |
| 985 |
| 973 void SpdySession::EnqueueStreamWrite( | 986 void SpdySession::EnqueueStreamWrite( |
| 974 const base::WeakPtr<SpdyStream>& stream, | 987 const base::WeakPtr<SpdyStream>& stream, |
| 975 SpdyFrameType frame_type, | 988 SpdyFrameType frame_type, |
| 976 std::unique_ptr<SpdyBufferProducer> producer) { | 989 std::unique_ptr<SpdyBufferProducer> producer) { |
| 977 DCHECK(frame_type == HEADERS || frame_type == DATA); | 990 DCHECK(frame_type == HEADERS || frame_type == DATA); |
| 978 EnqueueWrite(stream->priority(), frame_type, std::move(producer), stream); | 991 EnqueueWrite(stream->priority(), frame_type, std::move(producer), stream); |
| 979 } | 992 } |
| 980 | 993 |
| 981 std::unique_ptr<SpdySerializedFrame> SpdySession::CreateHeaders( | 994 std::unique_ptr<SpdySerializedFrame> SpdySession::CreateHeaders( |
| 982 SpdyStreamId stream_id, | 995 SpdyStreamId stream_id, |
| (...skipping 2011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2994 if (!queue->empty()) { | 3007 if (!queue->empty()) { |
| 2995 SpdyStreamId stream_id = queue->front(); | 3008 SpdyStreamId stream_id = queue->front(); |
| 2996 queue->pop_front(); | 3009 queue->pop_front(); |
| 2997 return stream_id; | 3010 return stream_id; |
| 2998 } | 3011 } |
| 2999 } | 3012 } |
| 3000 return 0; | 3013 return 0; |
| 3001 } | 3014 } |
| 3002 | 3015 |
| 3003 } // namespace net | 3016 } // namespace net |
| OLD | NEW |