From cb54b3b24d1b9b5e1aaaaa28478da63c90857c5f Mon Sep 17 00:00:00 2001 From: "vandebo@chromium.org" Date: Thu, 3 Jun 2010 16:28:55 +0000 Subject: Fix leaky spdy sessions and remove suppression. BUG=44738 TEST=heap checker no longer complains and tests still pass Review URL: http://codereview.chromium.org/2477004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48837 0039d316-1c4b-4281-b951-d872f2087c98 --- net/spdy/spdy_network_transaction_unittest.cc | 4 +++- net/spdy/spdy_session_pool.cc | 5 +++-- net/spdy/spdy_session_pool.h | 5 ++++- 3 files changed, 10 insertions(+), 4 deletions(-) (limited to 'net/spdy') diff --git a/net/spdy/spdy_network_transaction_unittest.cc b/net/spdy/spdy_network_transaction_unittest.cc index e8278a5..d40d86b 100644 --- a/net/spdy/spdy_network_transaction_unittest.cc +++ b/net/spdy/spdy_network_transaction_unittest.cc @@ -469,8 +469,10 @@ class SpdyNetworkTransactionTest : public PlatformTest { return out; out.rv = callback.WaitForResult(); - if (out.rv != OK) + if (out.rv != OK) { + session->spdy_session_pool()->ClearSessions(); return out; + } const HttpResponseInfo* response = trans->GetResponseInfo(); EXPECT_TRUE(response->headers != NULL); diff --git a/net/spdy/spdy_session_pool.cc b/net/spdy/spdy_session_pool.cc index cd505a8..a0310e8 100644 --- a/net/spdy/spdy_session_pool.cc +++ b/net/spdy/spdy_session_pool.cc @@ -107,7 +107,7 @@ void SpdySessionPool::RemoveSessionList(const HostPortPair& host_port_pair) { } } -void SpdySessionPool::CloseAllSessions() { +void SpdySessionPool::RemoveAllSessions(bool close) { while (sessions_.size()) { SpdySessionList* list = sessions_.begin()->second; DCHECK(list); @@ -115,7 +115,8 @@ void SpdySessionPool::CloseAllSessions() { while (list->size()) { scoped_refptr session = list->front(); list->pop_front(); - session->CloseAllStreams(net::ERR_ABORTED); + if (close) + session->CloseAllStreams(net::ERR_ABORTED); } delete list; } diff --git a/net/spdy/spdy_session_pool.h b/net/spdy/spdy_session_pool.h index d7569ba..2a1cb7b 100644 --- a/net/spdy/spdy_session_pool.h +++ b/net/spdy/spdy_session_pool.h @@ -54,7 +54,7 @@ class SpdySessionPool : public base::RefCounted { bool HasSession(const HostPortPair& host_port_pair)const; // Close all Spdy Sessions; used for debugging. - void CloseAllSessions(); + void CloseAllSessions() { RemoveAllSessions(true); } // Removes a SpdySession from the SpdySessionPool. void Remove(const scoped_refptr& session); @@ -62,6 +62,7 @@ class SpdySessionPool : public base::RefCounted { private: friend class base::RefCounted; friend class SpdySessionPoolPeer; // For testing. + friend class SpdyNetworkTransactionTest; // For testing. typedef std::list > SpdySessionList; typedef std::map SpdySessionsMap; @@ -74,6 +75,8 @@ class SpdySessionPool : public base::RefCounted { const SpdySessionList* GetSessionList( const HostPortPair& host_port_pair) const; void RemoveSessionList(const HostPortPair& host_port_pair); + void ClearSessions() { RemoveAllSessions(false); } + void RemoveAllSessions(bool close); // This is our weak session pool - one session per domain. SpdySessionsMap sessions_; -- cgit v1.1