diff options
author | vandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-03 16:28:55 +0000 |
---|---|---|
committer | vandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-03 16:28:55 +0000 |
commit | cb54b3b24d1b9b5e1aaaaa28478da63c90857c5f (patch) | |
tree | da427579f19487e2a276aa3fc371d0fc6fa8a63e | |
parent | 9310b2601bf040a5da92b6183c493ab0746bcd09 (diff) | |
download | chromium_src-cb54b3b24d1b9b5e1aaaaa28478da63c90857c5f.zip chromium_src-cb54b3b24d1b9b5e1aaaaa28478da63c90857c5f.tar.gz chromium_src-cb54b3b24d1b9b5e1aaaaa28478da63c90857c5f.tar.bz2 |
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
-rw-r--r-- | net/spdy/spdy_network_transaction_unittest.cc | 4 | ||||
-rw-r--r-- | net/spdy/spdy_session_pool.cc | 5 | ||||
-rw-r--r-- | net/spdy/spdy_session_pool.h | 5 | ||||
-rw-r--r-- | tools/heapcheck/suppressions.txt | 28 |
4 files changed, 10 insertions, 32 deletions
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<SpdySession> 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<SpdySessionPool> { 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<SpdySession>& session); @@ -62,6 +62,7 @@ class SpdySessionPool : public base::RefCounted<SpdySessionPool> { private: friend class base::RefCounted<SpdySessionPool>; friend class SpdySessionPoolPeer; // For testing. + friend class SpdyNetworkTransactionTest; // For testing. typedef std::list<scoped_refptr<SpdySession> > SpdySessionList; typedef std::map<HostPortPair, SpdySessionList*> SpdySessionsMap; @@ -74,6 +75,8 @@ class SpdySessionPool : public base::RefCounted<SpdySessionPool> { 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_; diff --git a/tools/heapcheck/suppressions.txt b/tools/heapcheck/suppressions.txt index d0e83a6..aeb1e1bb 100644 --- a/tools/heapcheck/suppressions.txt +++ b/tools/heapcheck/suppressions.txt @@ -417,31 +417,3 @@ fun:::RunTest_EnsureTaskDeletion* fun:MessageLoopTest_*EnsureTaskDeletion_*::TestBody } -{ - bug_44738_a - Heapcheck:Leak - ... - fun:Histogram::FactoryGet - fun:Histogram::FactoryGet - fun:ClientSocketPoolHistograms - fun:HttpNetworkSession - fun:net::HttpNetworkLayer::GetSession - fun:net::HttpNetworkLayer::CreateTransaction -} -{ - bug_44738_b - Heapcheck:Leak - ... - fun:LinearHistogram::FactoryGet - fun:ClientSocketPoolHistograms - fun:HttpNetworkSession -} -# Wildcarding "operator+" -{ - bug_44738_c - Heapcheck:Leak - ... - fun:std::operator* - fun:ClientSocketPoolHistograms - fun:HttpNetworkSession -} |