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

Side by Side Diff: net/spdy/spdy_stream.h

Issue 1272283003: Add a new SpdyStream::Delegate method to handle trailers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed tests Created 5 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_SPDY_SPDY_STREAM_H_ 5 #ifndef NET_SPDY_SPDY_STREAM_H_
6 #define NET_SPDY_SPDY_STREAM_H_ 6 #define NET_SPDY_SPDY_STREAM_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 }; 47 };
48 48
49 // Passed to some SpdyStream functions to indicate whether there's 49 // Passed to some SpdyStream functions to indicate whether there's
50 // more data to send. 50 // more data to send.
51 enum SpdySendStatus { 51 enum SpdySendStatus {
52 MORE_DATA_TO_SEND, 52 MORE_DATA_TO_SEND,
53 NO_MORE_DATA_TO_SEND 53 NO_MORE_DATA_TO_SEND
54 }; 54 };
55 55
56 // Returned by SpdyStream::OnResponseHeadersUpdated() to indicate 56 // Returned by SpdyStream::OnResponseHeadersUpdated() to indicate
57 // whether the current response headers are complete or not. 57 // whether the current response headers are complete or not.
Ryan Hamilton 2015/08/10 17:23:25 Please update this comment to reflect the meaning
xunjieli 2015/08/10 20:31:07 Done. Good catch! I also updated comments below.
58 enum SpdyResponseHeadersStatus { 58 enum SpdyResponseHeadersStatus {
59 RESPONSE_HEADERS_ARE_INCOMPLETE, 59 RESPONSE_HEADERS_ARE_INCOMPLETE,
60 RESPONSE_HEADERS_ARE_COMPLETE 60 RESPONSE_HEADERS_ARE_COMPLETE,
61 TRAILERS_RECEIVED,
61 }; 62 };
62 63
63 // The SpdyStream is used by the SpdySession to represent each stream known 64 // The SpdyStream is used by the SpdySession to represent each stream known
64 // on the SpdySession. This class provides interfaces for SpdySession to use. 65 // on the SpdySession. This class provides interfaces for SpdySession to use.
65 // Streams can be created either by the client or by the server. When they 66 // Streams can be created either by the client or by the server. When they
66 // are initiated by the client, both the SpdySession and client object (such as 67 // are initiated by the client, both the SpdySession and client object (such as
67 // a SpdyNetworkTransaction) will maintain a reference to the stream. When 68 // a SpdyNetworkTransaction) will maintain a reference to the stream. When
68 // initiated by the server, only the SpdySession will maintain any reference, 69 // initiated by the server, only the SpdySession will maintain any reference,
69 // until such a time as a client object requests a stream for the path. 70 // until such a time as a client object requests a stream for the path.
70 class NET_EXPORT_PRIVATE SpdyStream { 71 class NET_EXPORT_PRIVATE SpdyStream {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 // EOF. Must return OK if the data was received successfully, or 133 // EOF. Must return OK if the data was received successfully, or
133 // a network error code otherwise. 134 // a network error code otherwise.
134 // 135 //
135 // May cause the stream to be closed. 136 // May cause the stream to be closed.
136 virtual void OnDataReceived(scoped_ptr<SpdyBuffer> buffer) = 0; 137 virtual void OnDataReceived(scoped_ptr<SpdyBuffer> buffer) = 0;
137 138
138 // Called when data is sent. Must not cause the stream to be 139 // Called when data is sent. Must not cause the stream to be
139 // closed. 140 // closed.
140 virtual void OnDataSent() = 0; 141 virtual void OnDataSent() = 0;
141 142
143 // Called when trailers are received. Note that trailers HEADER frame will
144 // have END_STREAM flag set, so this will be followed by OnClose.
145 virtual void OnTrailers(const SpdyHeaderBlock& trailers);
Ryan Hamilton 2015/08/10 17:23:25 Is it required by the spec that trailers have the
Ryan Hamilton 2015/08/10 17:23:25 I think this should be = 0 (pure virtual), shouldn
xunjieli 2015/08/10 20:31:07 Done. I was not sure if all implementations should
xunjieli 2015/08/10 20:31:07 The RFC says "The HEADERS frame starting the trail
146
142 // Called when SpdyStream is closed. No other delegate functions 147 // Called when SpdyStream is closed. No other delegate functions
143 // will be called after this is called, and the delegate must not 148 // will be called after this is called, and the delegate must not
144 // access the stream after this is called. Must not cause the 149 // access the stream after this is called. Must not cause the
145 // stream to be be (re-)closed. 150 // stream to be be (re-)closed.
146 // 151 //
147 // TODO(akalin): Allow this function to re-close the stream and 152 // TODO(akalin): Allow this function to re-close the stream and
148 // handle it gracefully. 153 // handle it gracefully.
149 virtual void OnClose(int status) = 0; 154 virtual void OnClose(int status) = 0;
150 155
151 protected: 156 protected:
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 bool write_handler_guard_; 579 bool write_handler_guard_;
575 580
576 base::WeakPtrFactory<SpdyStream> weak_ptr_factory_; 581 base::WeakPtrFactory<SpdyStream> weak_ptr_factory_;
577 582
578 DISALLOW_COPY_AND_ASSIGN(SpdyStream); 583 DISALLOW_COPY_AND_ASSIGN(SpdyStream);
579 }; 584 };
580 585
581 } // namespace net 586 } // namespace net
582 587
583 #endif // NET_SPDY_SPDY_STREAM_H_ 588 #endif // NET_SPDY_SPDY_STREAM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698