summaryrefslogtreecommitdiffstats
path: root/net/spdy/spdy_session.h
diff options
context:
space:
mode:
authorukai@chromium.org <ukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-18 07:16:26 +0000
committerukai@chromium.org <ukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-18 07:16:26 +0000
commitf3b61f9de846be52ecd105039c4d548e3053234c (patch)
treed2033c37b675f77c1e883bc075d1e82d5e6084b8 /net/spdy/spdy_session.h
parent89a3da9808c7f1b0b5481ce1d6b1c45cdcc01040 (diff)
downloadchromium_src-f3b61f9de846be52ecd105039c4d548e3053234c.zip
chromium_src-f3b61f9de846be52ecd105039c4d548e3053234c.tar.gz
chromium_src-f3b61f9de846be52ecd105039c4d548e3053234c.tar.bz2
Refactor SpdyStream to get HTTP specific out of the interface and members.
Add SpdyStream::Delegate interface and SpdyHttpStream implements SpdyStream::Delegate. SpdyHeaderBlock<->HTTP request/response conversion functions moved from spdy_session.cc to spdy_http_stream.cc. All interface between SpdySession and SpdyStream uses SpdyHeaderBlock instead of HttpRequestInfo,HttpResponseInfo. BUG=42320 TEST=none Review URL: http://codereview.chromium.org/2667002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50215 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/spdy/spdy_session.h')
-rw-r--r--net/spdy/spdy_session.h49
1 files changed, 29 insertions, 20 deletions
diff --git a/net/spdy/spdy_session.h b/net/spdy/spdy_session.h
index 4d70d22..01c649a 100644
--- a/net/spdy/spdy_session.h
+++ b/net/spdy/spdy_session.h
@@ -31,11 +31,8 @@
namespace net {
-class SpdyHttpStream;
class SpdyStream;
class HttpNetworkSession;
-struct HttpRequestInfo;
-class HttpResponseInfo;
class BoundNetLog;
class SSLInfo;
@@ -59,20 +56,32 @@ class SpdySession : public base::RefCounted<SpdySession>,
const TCPSocketParams& destination,
RequestPriority priority);
- // Get a stream for a given |request|. In the typical case, this will involve
- // the creation of a new stream (and will send the SYN frame). If the server
- // initiates a stream, it might already exist for a given path. The server
- // might also not have initiated the stream yet, but indicated it will via
- // X-Associated-Content.
- // Returns the new or existing stream. Never returns NULL.
- scoped_refptr<SpdyHttpStream> GetOrCreateStream(
- const HttpRequestInfo& request,
- const UploadDataStream* upload_data,
+ // Get a pushed stream for a given |url|.
+ // If the server initiates a stream, it might already exist for a given path.
+ // The server might also not have initiated the stream yet, but indicated it
+ // will via X-Associated-Content.
+ // Returns existing stream or NULL.
+ scoped_refptr<SpdyStream> GetPushStream(
+ const GURL& url,
+ const BoundNetLog& stream_net_log);
+
+ // Create a new stream for a given |url|.
+ // Returns the new stream. Never returns NULL.
+ const scoped_refptr<SpdyStream>& CreateStream(
+ const GURL& url,
+ RequestPriority priority,
const BoundNetLog& stream_net_log);
// Used by SpdySessionPool to initialize with a pre-existing SSL socket.
void InitializeWithSSLSocket(ClientSocketHandle* connection);
+ // Send the SYN frame for |stream_id|.
+ int WriteSynStream(
+ spdy::SpdyStreamId stream_id,
+ RequestPriority priority,
+ spdy::SpdyControlFlags flags,
+ const linked_ptr<spdy::SpdyHeaderBlock>& headers);
+
// Write a data frame to the stream.
// Used to create and queue a data frame for the given stream.
int WriteStreamData(spdy::SpdyStreamId stream_id, net::IOBuffer* data,
@@ -91,13 +100,16 @@ class SpdySession : public base::RefCounted<SpdySession>,
// Closes all streams. Used as part of shutdown.
void CloseAllStreams(net::Error status);
+ // Fills SSL info in |ssl_info| and returns true when SSL is in use.
+ bool GetSSLInfo(SSLInfo* ssl_info, bool* was_npn_negotiated);
+
// Enable or disable SSL.
static void SetSSLMode(bool enable) { use_ssl_ = enable; }
static bool SSLMode() { return use_ssl_; }
private:
friend class base::RefCounted<SpdySession>;
- FRIEND_TEST(SpdySessionTest, GetPushStream);
+ FRIEND_TEST(SpdySessionTest, GetActivePushStream);
enum State {
IDLE,
@@ -108,9 +120,8 @@ class SpdySession : public base::RefCounted<SpdySession>,
typedef std::map<int, scoped_refptr<SpdyStream> > ActiveStreamMap;
// Only HTTP push a stream.
- typedef std::list<scoped_refptr<SpdyHttpStream> > ActivePushedStreamList;
- typedef std::map<std::string, scoped_refptr<SpdyHttpStream> >
- PendingStreamMap;
+ typedef std::list<scoped_refptr<SpdyStream> > ActivePushedStreamList;
+ typedef std::map<std::string, scoped_refptr<SpdyStream> > PendingStreamMap;
typedef std::priority_queue<SpdyIOBuffer> OutputQueue;
virtual ~SpdySession();
@@ -173,15 +184,13 @@ class SpdySession : public base::RefCounted<SpdySession>,
// Check if we have a pending pushed-stream for this url
// Returns the stream if found (and returns it from the pending
// list), returns NULL otherwise.
- scoped_refptr<SpdyHttpStream> GetPushStream(const std::string& url);
+ scoped_refptr<SpdyStream> GetActivePushStream(const std::string& url);
- // Creates an HttpResponseInfo instance, and calls OnResponseReceived().
+ // Calls OnResponseReceived().
// Returns true if successful.
bool Respond(const spdy::SpdyHeaderBlock& headers,
const scoped_refptr<SpdyStream> stream);
- void GetSSLInfo(SSLInfo* ssl_info);
-
void RecordHistograms();
// Callbacks for the Spdy session.