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

Unified Diff: net/spdy/spdy_session.h

Issue 13834009: SPDY - Re-land greedy read support for SpdySession (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reverting the Revert of 181390 and disabled the tests in patch 1 Created 7 years, 8 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_session.h
diff --git a/net/spdy/spdy_session.h b/net/spdy/spdy_session.h
index 0e1ca2d9f21201761be09946a9ee11c58e873609..0d52b905bbac1406a05e0f660f82576170cb8cdc 100644
--- a/net/spdy/spdy_session.h
+++ b/net/spdy/spdy_session.h
@@ -46,6 +46,10 @@ const int kMaxSpdyFrameChunkSize = (2 * kMss) - 8;
// Specifies the maxiumum concurrent streams server could send (via push).
const int kMaxConcurrentPushedStreams = 1000;
+// Specifies the number of bytes read synchronously (without yielding) if the
+// data is available.
+const int kMaxReadBytes = 32 * 1024;
+
// The initial receive window size for both streams and sessions.
const int32 kDefaultInitialRecvWindowSize = 10 * 1024 * 1024; // 10MB
@@ -336,7 +340,7 @@ class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>,
void IncreaseRecvWindowSize(int32 delta_window_size);
// If session is closed, no new streams/transactions should be created.
- bool IsClosed() const { return state_ == CLOSED; }
+ bool IsClosed() const { return state_ == STATE_CLOSED; }
// Closes this session. This will close all active streams and mark
// the session as permanently closed.
@@ -486,10 +490,11 @@ class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>,
SpdyIOBufferProducerCompare> WriteQueue;
enum State {
- IDLE,
- CONNECTING,
- CONNECTED,
- CLOSED
+ STATE_IDLE,
+ STATE_CONNECTING,
+ STATE_DO_READ,
+ STATE_DO_READ_COMPLETE,
+ STATE_CLOSED
};
virtual ~SpdySession();
@@ -517,6 +522,21 @@ class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>,
// possible.
void ProcessPendingStreamRequests();
+ // Start the DoLoop to read data from socket.
+ void StartRead();
+
+ // Try to make progress by reading and processing data.
+ int DoLoop(int result);
+ // The implementations of STATE_DO_READ/STATE_DO_READ_COMPLETE state changes
+ // of the state machine.
+ int DoRead();
+ int DoReadComplete(int bytes_read);
+
+ // Check if session is connected or not.
+ bool IsConnected() const {
+ return state_ == STATE_DO_READ || state_ == STATE_DO_READ_COMPLETE;
+ }
+
// IO Callbacks
void OnReadComplete(int result);
void OnWriteComplete(int result);
@@ -555,10 +575,6 @@ class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>,
// haven't received any data in |kHungInterval| time period.
void CheckPingStatus(base::TimeTicks last_check_time);
- // Start reading from the socket.
- // Returns OK on success, or an error on failure.
- net::Error ReadSocket();
-
// Write current data to the socket.
void WriteSocketLater();
void WriteSocket();
@@ -722,7 +738,6 @@ class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>,
// The read buffer used to read data from the socket.
scoped_refptr<IOBuffer> read_buffer_;
- bool read_pending_;
int stream_hi_water_mark_; // The next stream id to use.
@@ -792,7 +807,15 @@ class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>,
int streams_pushed_count_;
int streams_pushed_and_claimed_count_;
int streams_abandoned_count_;
- int bytes_received_;
+
+ // |total_bytes_received_| keeps track of all the bytes read by the
+ // SpdySession. It is used by the |Net.SpdySettingsCwnd...| histograms.
+ int total_bytes_received_;
+
+ // |bytes_read_| keeps track of number of bytes read continously in the
+ // DoLoop() without yielding.
+ int bytes_read_;
+
bool sent_settings_; // Did this session send settings when it started.
bool received_settings_; // Did this session receive at least one settings
// frame.

Powered by Google App Engine
This is Rietveld 408576698