diff options
author | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-24 09:55:41 +0000 |
---|---|---|
committer | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-24 09:55:41 +0000 |
commit | b771bb73802cde6261bdbbdf850715b9c77b64ca (patch) | |
tree | 2a60ecea6c6d682160b2f45617beead76175c72f /net/spdy/spdy_session.h | |
parent | 708c7e760b4f01b20552150d2edbc71836871300 (diff) | |
download | chromium_src-b771bb73802cde6261bdbbdf850715b9c77b64ca.zip chromium_src-b771bb73802cde6261bdbbdf850715b9c77b64ca.tar.gz chromium_src-b771bb73802cde6261bdbbdf850715b9c77b64ca.tar.bz2 |
[SPDY] Add tests for speculative crash fix in r206851
Also refactor SpdyStream and SpdySession.
Specifically:
Rename some states and functions in SpdyStream. Also
consistently reset the stream on error. Define
IsIdle() to mean idle but not closed.
Restrict inputs to Close{Active,Created}Stream and
ResetStream in SpdySession. Add helper functions for
internal uses of those functions.
Fix erroneous test revealed by the changes above.
BUG=250841
Review URL: https://chromiumcodereview.appspot.com/17134004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@208184 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/spdy/spdy_session.h')
-rw-r--r-- | net/spdy/spdy_session.h | 51 |
1 files changed, 34 insertions, 17 deletions
diff --git a/net/spdy/spdy_session.h b/net/spdy/spdy_session.h index a0642548..af9f6ec 100644 --- a/net/spdy/spdy_session.h +++ b/net/spdy/spdy_session.h @@ -288,24 +288,20 @@ class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>, int len, SpdyDataFlags flags); - // Close the active stream with the given ID (if it's not already - // deleted). Note that that stream may hold the last reference to - // the session. + // Close the stream with the given ID, which must exist and be + // active. Note that that stream may hold the last reference to the + // session. void CloseActiveStream(SpdyStreamId stream_id, int status); - // Close the given created stream, which must not yet be + // Close the given created stream, which must exist but not yet be // active. Note that |stream| may hold the last reference to the // session. void CloseCreatedStream(const base::WeakPtr<SpdyStream>& stream, int status); - // If there is an active stream with the given ID, reset it by by - // sending a RST_STREAM frame with the given status code at the - // given priority, which should be the stream's priority, and - // deleting it. There must be no external references to that active - // stream. Was not piggybacked to CloseStream since not all of the - // calls to CloseStream necessitate sending a RST_STREAM. + // Send a RST_STREAM frame with the given status code and close the + // stream with the given ID, which must exist and be active. Note + // that that stream may hold the last reference to the session. void ResetStream(SpdyStreamId stream_id, - RequestPriority priority, SpdyRstStreamStatus status, const std::string& description); @@ -538,6 +534,26 @@ class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>, // possible. void ProcessPendingStreamRequests(); + // Close the stream pointed to by the given iterator. Note that that + // stream may hold the last reference to the session. + void CloseActiveStreamIterator(ActiveStreamMap::iterator it, int status); + + // Close the stream pointed to by the given iterator. Note that that + // stream may hold the last reference to the session. + void CloseCreatedStreamIterator(CreatedStreamSet::iterator it, int status); + + // Calls CloseActiveStreamIterator() and then SendResetStreamFrame(). + void ResetStreamIterator(ActiveStreamMap::iterator it, + SpdyRstStreamStatus status, + const std::string& description); + + // Send a RST_STREAM frame with the given parameters. There must be + // no active stream with the given ID. + void SendResetStreamFrame(SpdyStreamId stream_id, + RequestPriority priority, + SpdyRstStreamStatus status, + const std::string& description); + // Start the DoLoop to read data from socket. void StartRead(); @@ -634,12 +650,13 @@ class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>, // list), returns NULL otherwise. base::WeakPtr<SpdyStream> GetActivePushStream(const std::string& url); - // Calls OnResponseReceived(). - // Returns true if successful. - bool Respond(const SpdyHeaderBlock& response_headers, - base::Time response_time, - base::TimeTicks recv_first_byte_time, - SpdyStream* stream); + // Delegates to |stream->OnInitialResponseHeadersReceived()|. If an + // error is returned, the last reference to |this| may have been + // released. + int OnInitialResponseHeadersReceived(const SpdyHeaderBlock& response_headers, + base::Time response_time, + base::TimeTicks recv_first_byte_time, + SpdyStream* stream); void RecordPingRTTHistogram(base::TimeDelta duration); void RecordHistograms(); |