Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1224)

Unified Diff: net/spdy/spdy_stream.h

Issue 13009012: [SPDY] Refactor SpdySession's write queue (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix gyp error Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/spdy/spdy_stream.h
diff --git a/net/spdy/spdy_stream.h b/net/spdy/spdy_stream.h
index 3ad34f93c3f589e46fefaa999b4bc191609e4f26..293bc20043daea3aa57e7930971e14c6e39891fc 100644
--- a/net/spdy/spdy_stream.h
+++ b/net/spdy/spdy_stream.h
@@ -5,7 +5,7 @@
#ifndef NET_SPDY_SPDY_STREAM_H_
#define NET_SPDY_SPDY_STREAM_H_
-#include <list>
+#include <deque>
#include <string>
#include <vector>
@@ -102,15 +102,6 @@ class NET_EXPORT_PRIVATE SpdyStream
TYPE_DATA
};
- // Structure to contains pending frame information.
- typedef struct {
- FrameType type;
- union {
- SpdyHeaderBlock* header_block;
- SpdyFrame* data_frame;
- };
- } PendingFrame;
-
// SpdyStream constructor
SpdyStream(SpdySession* session,
const std::string& path,
@@ -299,7 +290,8 @@ class NET_EXPORT_PRIVATE SpdyStream
int GetProtocolVersion() const;
private:
- class SpdyStreamIOBufferProducer;
+ class SynStreamFrameProducer;
+ class HeaderFrameProducer;
enum State {
STATE_NONE,
@@ -346,13 +338,14 @@ class NET_EXPORT_PRIVATE SpdyStream
// the MessageLoop to replay all the data that the server has already sent.
void PushedStreamReplayData();
- // Informs the SpdySession that this stream has a write available.
- void SetHasWriteAvailable();
+ // Produces the SYN_STREAM frame for the stream. The stream must
+ // already be activated.
+ scoped_ptr<SpdyFrame> ProduceSynStreamFrame();
- // Returns a newly created SPDY frame owned by the called that contains
- // the next frame to be sent by this frame. May return NULL if this
- // stream has become stalled on flow control.
- scoped_ptr<SpdyFrame> ProduceNextFrame();
+ // Produce the initial HEADER frame for the stream with the given
+ // block. The stream must already be activated.
+ scoped_ptr<SpdyFrame> ProduceHeaderFrame(
+ scoped_ptr<SpdyHeaderBlock> header_block);
// If the stream is active and stream flow control is turned on,
// called by OnDataReceived (which is in turn called by the session)
@@ -398,14 +391,13 @@ class NET_EXPORT_PRIVATE SpdyStream
scoped_ptr<SpdyHeaderBlock> response_;
base::Time response_time_;
- // An in order list of pending frame data that are going to be sent. HEADERS
- // frames are queued as SpdyHeaderBlock structures because these must be
- // compressed just before sending. Data frames are queued as SpdyDataFrame.
- std::list<PendingFrame> pending_frames_;
-
- // An in order list of sending frame types. It will be used to know which type
- // of frame is sent and which callback should be invoked in OnOpen().
- std::list<FrameType> waiting_completions_;
+ // An in order list of sending frame types. Used communicate to the
+ // delegate which type of frame was sent in DoOpen().
+ //
+ // TODO(akalin): We can remove the need for this queue if we add an
+ // OnFrameSent() callback to SpdyFrameProducer and have the session
+ // call that instead of SpdyStream::OnWriteComplete().
+ std::deque<FrameType> waiting_completions_;
State io_state_;

Powered by Google App Engine
This is Rietveld 408576698