summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-22 12:23:12 +0000
committerakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-22 12:23:12 +0000
commit1be8d639dedc8693ffac31f7912079abb4685750 (patch)
tree94682d179075680d294dd7ee43f394261f02d52e /net
parent8cb4c7cefe0eff0e19f0cc1860f21c64cc8b3b39 (diff)
downloadchromium_src-1be8d639dedc8693ffac31f7912079abb4685750.zip
chromium_src-1be8d639dedc8693ffac31f7912079abb4685750.tar.gz
chromium_src-1be8d639dedc8693ffac31f7912079abb4685750.tar.bz2
[SPDY] Make SpdySession not ref-counted
BUG=255701 TBR=rch@chromium.org Review URL: https://codereview.chromium.org/18765003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212874 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/spdy/spdy_session.h7
-rw-r--r--net/spdy/spdy_session_pool.cc11
-rw-r--r--net/spdy/spdy_session_pool.h4
3 files changed, 10 insertions, 12 deletions
diff --git a/net/spdy/spdy_session.h b/net/spdy/spdy_session.h
index dd2e0da..4965255 100644
--- a/net/spdy/spdy_session.h
+++ b/net/spdy/spdy_session.h
@@ -180,8 +180,7 @@ class NET_EXPORT_PRIVATE SpdyStreamRequest {
DISALLOW_COPY_AND_ASSIGN(SpdyStreamRequest);
};
-class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>,
- public BufferedSpdyFramerVisitorInterface,
+class NET_EXPORT SpdySession : public BufferedSpdyFramerVisitorInterface,
public SpdyFramerDebugVisitorInterface,
public LayeredPool {
public:
@@ -215,6 +214,8 @@ class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>,
const HostPortPair& trusted_spdy_proxy,
NetLog* net_log);
+ virtual ~SpdySession();
+
const HostPortPair& host_port_pair() const {
return spdy_session_key_.host_port_proxy_pair().first;
}
@@ -552,8 +553,6 @@ class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>,
SESSION_CLOSED_AND_REMOVED,
};
- virtual ~SpdySession();
-
// Checks whether a stream for the given |url| can be created or
// retrieved from the set of unclaimed push streams. Returns OK if
// so. Otherwise, the session is closed and an error <
diff --git a/net/spdy/spdy_session_pool.cc b/net/spdy/spdy_session_pool.cc
index 6c3b78c..9efb20c 100644
--- a/net/spdy/spdy_session_pool.cc
+++ b/net/spdy/spdy_session_pool.cc
@@ -85,7 +85,7 @@ net::Error SpdySessionPool::CreateAvailableSessionFromSocket(
UMA_HISTOGRAM_ENUMERATION(
"Net.SpdySessionGet", IMPORTED_FROM_SOCKET, SPDY_SESSION_GET_MAX);
- scoped_refptr<SpdySession> new_session(
+ scoped_ptr<SpdySession> new_session(
new SpdySession(key,
http_server_properties_,
verify_domain_authentication_,
@@ -106,13 +106,12 @@ net::Error SpdySessionPool::CreateAvailableSessionFromSocket(
DCHECK_NE(error, ERR_IO_PENDING);
if (error != OK) {
- new_session = NULL;
available_session->reset();
return error;
}
- sessions_.insert(new_session);
*available_session = new_session->GetWeakPtr();
+ sessions_.insert(new_session.release());
MapKeyToAvailableSession(key, *available_session);
net_log.AddEvent(
@@ -231,10 +230,8 @@ void SpdySessionPool::RemoveUnavailableSession(
SessionSet::iterator it = sessions_.find(unavailable_session.get());
CHECK(it != sessions_.end());
- scoped_refptr<SpdySession> last_ref(*it);
+ scoped_ptr<SpdySession> owned_session(*it);
sessions_.erase(it);
-
- CHECK(last_ref->HasOneRef());
}
// Make a copy of |sessions_| in the Close* functions below to avoid
@@ -323,7 +320,7 @@ const SpdySessionKey& SpdySessionPool::NormalizeListKey(
void SpdySessionPool::MapKeyToAvailableSession(
const SpdySessionKey& key,
const base::WeakPtr<SpdySession>& session) {
- DCHECK(ContainsKey(sessions_, scoped_refptr<SpdySession>(session.get())));
+ DCHECK(ContainsKey(sessions_, session.get()));
const SpdySessionKey& normalized_key = NormalizeListKey(key);
std::pair<AvailableSessionMap::iterator, bool> result =
available_sessions_.insert(std::make_pair(normalized_key, session));
diff --git a/net/spdy/spdy_session_pool.h b/net/spdy/spdy_session_pool.h
index 86425e2..362be55 100644
--- a/net/spdy/spdy_session_pool.h
+++ b/net/spdy/spdy_session_pool.h
@@ -144,7 +144,7 @@ class NET_EXPORT SpdySessionPool
private:
friend class SpdySessionPoolPeer; // For testing.
- typedef std::set<scoped_refptr<SpdySession> > SessionSet;
+ typedef std::set<SpdySession*> SessionSet;
typedef std::vector<base::WeakPtr<SpdySession> > WeakSessionList;
typedef std::map<SpdySessionKey, base::WeakPtr<SpdySession> >
AvailableSessionMap;
@@ -189,6 +189,8 @@ class NET_EXPORT SpdySessionPool
// The set of all sessions. This is a superset of the sessions in
// |available_sessions_|.
+ //
+ // |sessions_| owns all its SpdySession objects.
SessionSet sessions_;
// This is a map of available sessions by key. A session may appear