Index: net/spdy/spdy_session.h |
diff --git a/net/spdy/spdy_session.h b/net/spdy/spdy_session.h |
index 2b55528d6fd3cd37850b8197fea9a9330c3c50ab..586a3e3d86aaab5da948f38fb7a20532bd4fb20b 100644 |
--- a/net/spdy/spdy_session.h |
+++ b/net/spdy/spdy_session.h |
@@ -158,9 +158,12 @@ class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>, |
// authentication now. |
bool VerifyDomainAuthentication(const std::string& domain); |
+ // Records that |stream| has a write available. |
+ void SetStreamHasWriteAvailable(SpdyStream* stream); |
+ |
// Send the SYN frame for |stream_id|. This also sends PING message to check |
// the status of the connection. |
- int WriteSynStream( |
+ SpdySynStreamControlFrame* CreateSynStream( |
SpdyStreamId stream_id, |
RequestPriority priority, |
uint8 credential_slot, |
@@ -168,21 +171,24 @@ class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>, |
const linked_ptr<SpdyHeaderBlock>& headers); |
// Write a CREDENTIAL frame to the session. |
- int WriteCredentialFrame(const std::string& origin, |
- SSLClientCertType type, |
- const std::string& key, |
- const std::string& cert, |
- RequestPriority priority); |
+ SpdyCredentialControlFrame* CreateCredentialFrame(const std::string& origin, |
+ SSLClientCertType type, |
+ const std::string& key, |
+ const std::string& cert, |
+ RequestPriority priority); |
// Write a data frame to the stream. |
// Used to create and queue a data frame for the given stream. |
- int WriteStreamData(SpdyStreamId stream_id, net::IOBuffer* data, |
- int len, |
- SpdyDataFlags flags); |
+ SpdyDataFrame* CreateDataFrame(SpdyStreamId stream_id, |
+ net::IOBuffer* data, int len, |
+ SpdyDataFlags flags); |
// Close a stream. |
void CloseStream(SpdyStreamId stream_id, int status); |
+ // Close a stream that has been created but is not yet active. |
+ void CloseCreatedStream(SpdyStream* stream, int status); |
+ |
// Reset a stream by sending a RST_STREAM frame with given status code. |
// Also closes the stream. Was not piggybacked to CloseStream since not |
// all of the calls to CloseStream necessitate sending a RST_STREAM. |
@@ -270,7 +276,7 @@ class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>, |
// Returns true if session is not currently active |
bool is_active() const { |
- return !active_streams_.empty(); |
+ return !active_streams_.empty() || !created_streams_.empty(); |
} |
// Access to the number of active and pending streams. These are primarily |
@@ -279,6 +285,7 @@ class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>, |
size_t num_unclaimed_pushed_streams() const { |
return unclaimed_pushed_streams_.size(); |
} |
+ size_t num_created_streams() const { return created_streams_.size(); } |
// Returns true if flow control is enabled for the session. |
bool is_flow_control_enabled() const { |
@@ -355,6 +362,17 @@ class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>, |
// Only HTTP push a stream. |
typedef std::map<std::string, scoped_refptr<SpdyStream> > PushedStreamMap; |
typedef std::priority_queue<SpdyIOBuffer> OutputQueue; |
+ typedef std::set<scoped_refptr<SpdyStream> > CreatedStreamSet; |
+ class SpdyFrameProducerCompare { |
+ public: |
+ bool operator() (const SpdyFrameProducer* lhs, |
+ const SpdyFrameProducer* rhs) const { |
+ return lhs->GetPriority() < rhs->GetPriority(); |
+ } |
+ }; |
+ typedef std::priority_queue<SpdyFrameProducer*, |
+ std::vector<SpdyFrameProducer*>, |
+ SpdyFrameProducerCompare> WriteQueue; |
struct CallbackResultPair { |
CallbackResultPair(const CompletionCallback& callback_in, int result_in) |
@@ -429,9 +447,7 @@ class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>, |
// Queue a frame for sending. |
// |frame| is the frame to send. |
// |priority| is the priority for insertion into the queue. |
- // |stream| is the stream which this IO is associated with (or NULL). |
- void QueueFrame(SpdyFrame* frame, RequestPriority priority, |
- SpdyStream* stream); |
+ void QueueFrame(SpdyFrame* frame, RequestPriority priority); |
// Track active streams in the active stream list. |
void ActivateStream(SpdyStream* stream); |
@@ -558,9 +574,15 @@ class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>, |
// server, but do not have consumers yet. |
PushedStreamMap unclaimed_pushed_streams_; |
+ // Set of all created streams that have not yet been activated. |
willchan no longer on Chromium
2012/06/07 23:02:06
This comment makes no sense without context of wha
Ryan Hamilton
2012/06/08 00:02:26
Done.
|
+ CreatedStreamSet created_streams_; |
+ |
// As we gather data to be sent, we put it into the output queue. |
OutputQueue queue_; |
willchan no longer on Chromium
2012/06/07 23:02:06
Can this die?
Ryan Hamilton
2012/06/08 00:02:26
Indeed! Done.
|
+ // As streams have data to be sent, we put them into the write queue. |
+ WriteQueue write_queue_; |
+ |
// The packet we are currently sending. |
bool write_pending_; // Will be true when a write is in progress. |
SpdyIOBuffer in_flight_write_; // This is the write buffer in progress. |