[SPDY] Make SpdySessionPool keep track of available sessions

Split a SpdySessionPool's sessions into available ones and unavailable ones.
Keep all sessions in a set, and all the available sessions in a map keyed
by SpdySessionKey. This is in preparation for making SpdySessionPool
own a session even if it receives a GOAWAY frame.

Split SpdySessionPool::Remove() into two functions -- MakeSessionUnavailable()
and RemoveUnavailableSession(). For now, sessions call them at the same
time, but in the future RemoveUnavailableSession() may be called later
than MakeSessionUnavailable() (for the GOAWAY case).

Don't add a SpdySession to a pool if it encountered an error during
initialization. Also, don't do some work in SpdySession::InitializeWithSocket()
if initialization fails.

Rename functions and variables in SpdySessionPool to be concise and
consistent. Inline a bunch of one-off functions. Rewrite the loop
in SpdySessionPool::RemoveAliases().

BUG=255701

Review URL: https://chromiumcodereview.appspot.com/18600010

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@210344 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/net/spdy/spdy_network_transaction_unittest.cc b/net/spdy/spdy_network_transaction_unittest.cc
index b533f29..e0e9cfc 100644
--- a/net/spdy/spdy_network_transaction_unittest.cc
+++ b/net/spdy/spdy_network_transaction_unittest.cc
@@ -563,7 +563,7 @@
     BoundNetLog log;
     const scoped_refptr<HttpNetworkSession>& session = helper.session();
     scoped_refptr<SpdySession> spdy_session =
-        session->spdy_session_pool()->GetIfExists(key, log);
+        session->spdy_session_pool()->FindAvailableSession(key, log);
     ASSERT_TRUE(spdy_session != NULL);
     EXPECT_EQ(0u, spdy_session->num_active_streams());
     EXPECT_EQ(0u, spdy_session->num_unclaimed_pushed_streams());