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

Unified Diff: net/spdy/spdy_session.cc

Issue 2665283003: Improve memory estimate of SpdySessionPool in net/ MemoryDumpProvider. (Closed)
Patch Set: rebased 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/spdy/spdy_session.h ('k') | net/spdy/spdy_session_key.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_session.cc
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index 2e3a31a457d7007b28022827c9cf73296ca9202e..aa8397af8cfd23e89c47993d5ea9ed4dc3494020 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -46,6 +46,7 @@
#include "net/log/net_log_with_source.h"
#include "net/proxy/proxy_server.h"
#include "net/socket/ssl_client_socket.h"
+#include "net/spdy/platform/api/spdy_estimate_memory_usage.h"
#include "net/spdy/spdy_buffer_producer.h"
#include "net/spdy/spdy_frame_builder.h"
#include "net/spdy/spdy_http_utils.h"
@@ -582,6 +583,10 @@ base::WeakPtr<SpdyStream> SpdyStreamRequest::ReleaseStream() {
return stream;
}
+size_t SpdyStreamRequest::EstimateMemoryUsage() const {
+ return base::trace_event::EstimateItemMemoryUsage(url_);
+}
+
void SpdyStreamRequest::OnRequestCompleteSuccess(
const base::WeakPtr<SpdyStream>& stream) {
DCHECK(session_);
@@ -660,6 +665,11 @@ SpdySession::UnclaimedPushedStreamContainer::insert(
stream_id, creation_time)));
}
+size_t SpdySession::UnclaimedPushedStreamContainer::EstimateMemoryUsage()
+ const {
+ return SpdyEstimateMemoryUsage(streams_);
+}
+
// static
bool SpdySession::CanPool(TransportSecurityState* transport_security_state,
const SSLInfo& ssl_info,
@@ -1349,10 +1359,27 @@ bool SpdySession::CloseOneIdleConnection() {
return false;
}
-void SpdySession::DumpMemoryStats(StreamSocket::SocketMemoryStats* stats,
- bool* is_session_active) const {
+size_t SpdySession::DumpMemoryStats(StreamSocket::SocketMemoryStats* stats,
+ bool* is_session_active) const {
+ // TODO(xunjieli): Include |pending_create_stream_queues_| when WeakPtr is
+ // supported in memory_usage_estimator.h.
*is_session_active = is_active();
connection_->DumpMemoryStats(stats);
+
+ // |connection_| is estimated in stats->total_size. |read_buffer_| is
+ // estimated in kReadBufferSize. TODO(xunjieli): Make them use EMU().
+ return stats->total_size + kReadBufferSize +
+ SpdyEstimateMemoryUsage(spdy_session_key_) +
+ SpdyEstimateMemoryUsage(pooled_aliases_) +
+ SpdyEstimateMemoryUsage(active_streams_) +
+ SpdyEstimateMemoryUsage(unclaimed_pushed_streams_) +
+ SpdyEstimateMemoryUsage(created_streams_) +
+ SpdyEstimateMemoryUsage(write_queue_) +
+ SpdyEstimateMemoryUsage(in_flight_write_) +
+ SpdyEstimateMemoryUsage(buffered_spdy_framer_) +
+ SpdyEstimateMemoryUsage(initial_settings_) +
+ SpdyEstimateMemoryUsage(stream_send_unstall_queue_) +
+ SpdyEstimateMemoryUsage(priority_dependency_state_);
}
// {,Try}CreateStream() can be called with |in_io_loop_| set if a stream is
« no previous file with comments | « net/spdy/spdy_session.h ('k') | net/spdy/spdy_session_key.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698