OLD | NEW |
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 // when data can be sent and received. | 42 // when data can be sent and received. |
43 SPDY_BIDIRECTIONAL_STREAM, | 43 SPDY_BIDIRECTIONAL_STREAM, |
44 // A stream where the client sends a request with possibly a body, | 44 // A stream where the client sends a request with possibly a body, |
45 // and the server then sends a response with a body. | 45 // and the server then sends a response with a body. |
46 SPDY_REQUEST_RESPONSE_STREAM, | 46 SPDY_REQUEST_RESPONSE_STREAM, |
47 // A server-initiated stream where the server just sends a response | 47 // A server-initiated stream where the server just sends a response |
48 // with a body and the client does not send anything. | 48 // with a body and the client does not send anything. |
49 SPDY_PUSH_STREAM | 49 SPDY_PUSH_STREAM |
50 }; | 50 }; |
51 | 51 |
52 // Returned by some SpdyStream::Delegate functions to indicate whether | 52 // Passed to some SpdyStream functions to indicate whether there's |
53 // there's more data to send. | 53 // more data to send. |
54 enum SpdySendStatus { | 54 enum SpdySendStatus { |
55 MORE_DATA_TO_SEND, | 55 MORE_DATA_TO_SEND, |
56 NO_MORE_DATA_TO_SEND | 56 NO_MORE_DATA_TO_SEND |
57 }; | 57 }; |
58 | 58 |
| 59 // Returned by SpdyStream::OnResponseHeadersUpdated() to indicate |
| 60 // whether the current response headers are complete or not. |
| 61 enum SpdyResponseHeadersStatus { |
| 62 RESPONSE_HEADERS_ARE_INCOMPLETE, |
| 63 RESPONSE_HEADERS_ARE_COMPLETE |
| 64 }; |
| 65 |
59 // The SpdyStream is used by the SpdySession to represent each stream known | 66 // The SpdyStream is used by the SpdySession to represent each stream known |
60 // on the SpdySession. This class provides interfaces for SpdySession to use. | 67 // on the SpdySession. This class provides interfaces for SpdySession to use. |
61 // Streams can be created either by the client or by the server. When they | 68 // Streams can be created either by the client or by the server. When they |
62 // are initiated by the client, both the SpdySession and client object (such as | 69 // are initiated by the client, both the SpdySession and client object (such as |
63 // a SpdyNetworkTransaction) will maintain a reference to the stream. When | 70 // a SpdyNetworkTransaction) will maintain a reference to the stream. When |
64 // initiated by the server, only the SpdySession will maintain any reference, | 71 // initiated by the server, only the SpdySession will maintain any reference, |
65 // until such a time as a client object requests a stream for the path. | 72 // until such a time as a client object requests a stream for the path. |
66 class NET_EXPORT_PRIVATE SpdyStream { | 73 class NET_EXPORT_PRIVATE SpdyStream { |
67 public: | 74 public: |
68 // Delegate handles protocol specific behavior of spdy stream. | 75 // Delegate handles protocol specific behavior of spdy stream. |
69 class NET_EXPORT_PRIVATE Delegate { | 76 class NET_EXPORT_PRIVATE Delegate { |
70 public: | 77 public: |
71 Delegate() {} | 78 Delegate() {} |
72 | 79 |
73 // Called when the request headers have been sent. Never called | 80 // Called when the request headers have been sent. Never called |
74 // for push streams. | 81 // for push streams. Must not cause the stream to be closed. |
75 virtual void OnRequestHeadersSent() = 0; | 82 virtual void OnRequestHeadersSent() = 0; |
76 | 83 |
77 // Called when the SYN_STREAM, SYN_REPLY, or HEADERS frames are received. | 84 // WARNING: This function is complicated! Be sure to read the |
78 // Normal streams will receive a SYN_REPLY and optional HEADERS frames. | 85 // whole comment below if you're working with code that implements |
79 // Pushed streams will receive a SYN_STREAM and optional HEADERS frames. | 86 // or calls this function. |
80 // Because a stream may have a SYN_* frame and multiple HEADERS frames, | 87 // |
81 // this callback may be called multiple times. | 88 // Called when the response headers are updated from the |
82 // |status| indicates network error. Returns network error code. | 89 // server. |response_headers| contains the set of all headers |
83 virtual int OnResponseHeadersReceived(const SpdyHeaderBlock& response, | 90 // received up to this point; delegates can assume that any |
84 base::Time response_time, | 91 // headers previously received remain unchanged. |
85 int status) = 0; | 92 // |
| 93 // This is called at least once before any data is received. If |
| 94 // RESPONSE_HEADERS_ARE_INCOMPLETE is returned, this will be |
| 95 // called again when more headers are received until |
| 96 // RESPONSE_HEADERS_ARE_COMPLETE is returned, and any data |
| 97 // received before then will be treated as a protocol error. |
| 98 // |
| 99 // If RESPONSE_HEADERS_ARE_INCOMPLETE is returned, the delegate |
| 100 // must not have closed the stream. Otherwise, if |
| 101 // RESPONSE_HEADERS_ARE_COMPLETE is returned, the delegate has |
| 102 // processed the headers successfully. However, it still may have |
| 103 // closed the stream, e.g. if the headers indicated an error |
| 104 // condition. |
| 105 // |
| 106 // Some type-specific behavior: |
| 107 // |
| 108 // - For bidirectional streams, this may be called even after |
| 109 // data is received, but it is expected that |
| 110 // RESPONSE_HEADERS_ARE_COMPLETE is always returned. If |
| 111 // RESPONSE_HEADERS_ARE_INCOMPLETE is returned, this is |
| 112 // treated as a protocol error. |
| 113 // |
| 114 // - For request/response streams, this function is called |
| 115 // exactly once before data is received, and it is expected |
| 116 // that RESPONSE_HEADERS_ARE_COMPLETE is returned. If |
| 117 // RESPONSE_HEADERS_ARE_INCOMPLETE is returned, this is |
| 118 // treated as a protocol error. |
| 119 // |
| 120 // - For push streams, it is expected that this function will be |
| 121 // called until RESPONSE_HEADERS_ARE_COMPLETE is returned |
| 122 // before any data is received; any deviation from this is |
| 123 // treated as a protocol error. |
| 124 // |
| 125 // TODO(akalin): Treat headers received after data has been |
| 126 // received as a protocol error for non-bidirectional streams. |
| 127 virtual SpdyResponseHeadersStatus OnResponseHeadersUpdated( |
| 128 const SpdyHeaderBlock& response_headers) = 0; |
86 | 129 |
87 // Called when data is received. |buffer| may be NULL, which | 130 // Called when data is received after all required response |
88 // signals EOF. Must return OK if the data was received | 131 // headers have been received. |buffer| may be NULL, which signals |
89 // successfully, or a network error code otherwise. | 132 // EOF. Must return OK if the data was received successfully, or |
90 virtual int OnDataReceived(scoped_ptr<SpdyBuffer> buffer) = 0; | 133 // a network error code otherwise. |
| 134 // |
| 135 // May cause the stream to be closed. |
| 136 virtual void OnDataReceived(scoped_ptr<SpdyBuffer> buffer) = 0; |
91 | 137 |
92 // Called when data is sent. | 138 // Called when data is sent. Must not cause the stream to be |
| 139 // closed. |
93 virtual void OnDataSent() = 0; | 140 virtual void OnDataSent() = 0; |
94 | 141 |
95 // Called when SpdyStream is closed. No other delegate functions | 142 // Called when SpdyStream is closed. No other delegate functions |
96 // will be called after this is called, and the delegate must not | 143 // will be called after this is called, and the delegate must not |
97 // access the stream after this is called. | 144 // access the stream after this is called. Must not cause the |
| 145 // stream to be be (re-)closed. |
| 146 // |
| 147 // TODO(akalin): Allow this function to re-close the stream and |
| 148 // handle it gracefully. |
98 virtual void OnClose(int status) = 0; | 149 virtual void OnClose(int status) = 0; |
99 | 150 |
100 protected: | 151 protected: |
101 virtual ~Delegate() {} | 152 virtual ~Delegate() {} |
102 | 153 |
103 private: | 154 private: |
104 DISALLOW_COPY_AND_ASSIGN(Delegate); | 155 DISALLOW_COPY_AND_ASSIGN(Delegate); |
105 }; | 156 }; |
106 | 157 |
107 // SpdyStream constructor | 158 // SpdyStream constructor |
108 SpdyStream(SpdyStreamType type, | 159 SpdyStream(SpdyStreamType type, |
109 SpdySession* session, | 160 SpdySession* session, |
110 const std::string& path, | 161 const std::string& path, |
111 RequestPriority priority, | 162 RequestPriority priority, |
112 int32 initial_send_window_size, | 163 int32 initial_send_window_size, |
113 int32 initial_recv_window_size, | 164 int32 initial_recv_window_size, |
114 const BoundNetLog& net_log); | 165 const BoundNetLog& net_log); |
115 | 166 |
116 ~SpdyStream(); | 167 ~SpdyStream(); |
117 | 168 |
118 // Set new |delegate|. |delegate| must not be NULL. If it already | 169 // Set the delegate, which must not be NULL. Must not be called more |
119 // received SYN_REPLY or data, OnResponseHeadersReceived() or | 170 // than once. For push streams, calling this may cause buffered data |
120 // OnDataReceived() will be called. | 171 // to be sent to the delegate (from a posted task). |
121 void SetDelegate(Delegate* delegate); | 172 void SetDelegate(Delegate* delegate); |
122 Delegate* GetDelegate() { return delegate_; } | 173 Delegate* GetDelegate(); |
123 | 174 |
124 // Detach the delegate from the stream, which must not yet be | 175 // Detach the delegate from the stream, which must not yet be |
125 // closed, and cancel it. | 176 // closed, and cancel it. |
126 void DetachDelegate(); | 177 void DetachDelegate(); |
127 | 178 |
| 179 // The time at which the first bytes of the response were received |
| 180 // from the server, or null if the response hasn't been received |
| 181 // yet. |
| 182 base::Time response_time() const { return response_time_; } |
| 183 |
128 SpdyStreamType type() const { return type_; } | 184 SpdyStreamType type() const { return type_; } |
129 | 185 |
130 SpdyStreamId stream_id() const { return stream_id_; } | 186 SpdyStreamId stream_id() const { return stream_id_; } |
131 void set_stream_id(SpdyStreamId stream_id) { stream_id_ = stream_id; } | 187 void set_stream_id(SpdyStreamId stream_id) { stream_id_ = stream_id; } |
132 | 188 |
133 // TODO(akalin): Remove these two functions. | |
134 bool response_received() const { return response_received_; } | |
135 void set_response_received() { response_received_ = true; } | |
136 | |
137 const std::string& path() const { return path_; } | 189 const std::string& path() const { return path_; } |
138 | 190 |
139 RequestPriority priority() const { return priority_; } | 191 RequestPriority priority() const { return priority_; } |
140 | 192 |
141 int32 send_window_size() const { return send_window_size_; } | 193 int32 send_window_size() const { return send_window_size_; } |
142 | 194 |
143 int32 recv_window_size() const { return recv_window_size_; } | 195 int32 recv_window_size() const { return recv_window_size_; } |
144 | 196 |
145 bool send_stalled_by_flow_control() const { | 197 bool send_stalled_by_flow_control() const { |
146 return send_stalled_by_flow_control_; | 198 return send_stalled_by_flow_control_; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 | 275 |
224 // Returns true if the underlying transport socket ever had any reads or | 276 // Returns true if the underlying transport socket ever had any reads or |
225 // writes. | 277 // writes. |
226 bool WasEverUsed() const; | 278 bool WasEverUsed() const; |
227 | 279 |
228 const BoundNetLog& net_log() const { return net_log_; } | 280 const BoundNetLog& net_log() const { return net_log_; } |
229 | 281 |
230 base::Time GetRequestTime() const; | 282 base::Time GetRequestTime() const; |
231 void SetRequestTime(base::Time t); | 283 void SetRequestTime(base::Time t); |
232 | 284 |
233 // Called by the SpdySession when a response (e.g. a SYN_STREAM or | 285 // Called at most once by the SpdySession when the initial response |
234 // SYN_REPLY) has been received for this stream. This is the entry | 286 // headers have been received for this stream, i.e., a SYN_REPLY (or |
235 // point for a push stream. Returns a status code. | 287 // SYN_STREAM for push streams) frame has been received. This is the |
236 int OnResponseHeadersReceived(const SpdyHeaderBlock& response); | 288 // entry point for a push stream. Returns a status code; if it is an |
| 289 // error, the stream may have already been closed. |
| 290 // |
| 291 // TODO(akalin): Guarantee that the stream is already closed if an |
| 292 // error is returned. |
| 293 int OnInitialResponseHeadersReceived(const SpdyHeaderBlock& response_headers, |
| 294 base::Time response_time, |
| 295 base::TimeTicks recv_first_byte_time); |
237 | 296 |
238 // Called by the SpdySession when late-bound headers are received for a | 297 // Called by the SpdySession (only after |
239 // stream. Returns a status code. | 298 // OnInitialResponseHeadersReceived() has been called) when |
240 int OnHeaders(const SpdyHeaderBlock& headers); | 299 // late-bound headers are received for a stream. Returns a status |
| 300 // code; if it is an error, ths stream may have already been closed. |
| 301 // |
| 302 // TODO(akalin): Guarantee that the stream is already closed if an |
| 303 // error is returned. |
| 304 int OnAdditionalResponseHeadersReceived( |
| 305 const SpdyHeaderBlock& additional_response_headers); |
241 | 306 |
242 // Called by the SpdySession when response data has been received | 307 // Called by the SpdySession when response data has been received |
243 // for this stream. This callback may be called multiple times as | 308 // for this stream. This callback may be called multiple times as |
244 // data arrives from the network, and will never be called prior to | 309 // data arrives from the network, and will never be called prior to |
245 // OnResponseHeadersReceived. | 310 // OnResponseHeadersReceived. |
246 // | 311 // |
247 // |buffer| contains the data received, or NULL if the stream is | 312 // |buffer| contains the data received, or NULL if the stream is |
248 // being closed. The stream must copy any data from this | 313 // being closed. The stream must copy any data from this |
249 // buffer before returning from this callback. | 314 // buffer before returning from this callback. |
250 // | 315 // |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 | 349 |
285 // Only one send can be in flight at a time, except for push | 350 // Only one send can be in flight at a time, except for push |
286 // streams, which must not send anything. | 351 // streams, which must not send anything. |
287 | 352 |
288 // Sends the request headers. The delegate is called back via | 353 // Sends the request headers. The delegate is called back via |
289 // OnRequestHeadersSent() when the request headers have completed | 354 // OnRequestHeadersSent() when the request headers have completed |
290 // sending. |send_status| must be MORE_DATA_TO_SEND for | 355 // sending. |send_status| must be MORE_DATA_TO_SEND for |
291 // bidirectional streams; for request/response streams, it must be | 356 // bidirectional streams; for request/response streams, it must be |
292 // MORE_DATA_TO_SEND if the request has data to upload, or | 357 // MORE_DATA_TO_SEND if the request has data to upload, or |
293 // NO_MORE_DATA_TO_SEND if not. | 358 // NO_MORE_DATA_TO_SEND if not. |
294 int SendRequestHeaders(scoped_ptr<SpdyHeaderBlock> headers, | 359 int SendRequestHeaders(scoped_ptr<SpdyHeaderBlock> request_headers, |
295 SpdySendStatus send_status); | 360 SpdySendStatus send_status); |
296 | 361 |
297 // Sends a DATA frame. The delegate will be notified via | 362 // Sends a DATA frame. The delegate will be notified via |
298 // OnDataSent() when the send is complete. |send_status| must be | 363 // OnDataSent() when the send is complete. |send_status| must be |
299 // MORE_DATA_TO_SEND for bidirectional streams; for request/response | 364 // MORE_DATA_TO_SEND for bidirectional streams; for request/response |
300 // streams, it must be MORE_DATA_TO_SEND if there is more data to | 365 // streams, it must be MORE_DATA_TO_SEND if there is more data to |
301 // upload, or NO_MORE_DATA_TO_SEND if not. | 366 // upload, or NO_MORE_DATA_TO_SEND if not. |
302 void SendData(IOBuffer* data, int length, SpdySendStatus send_status); | 367 void SendData(IOBuffer* data, int length, SpdySendStatus send_status); |
303 | 368 |
304 // Fills SSL info in |ssl_info| and returns true when SSL is in use. | 369 // Fills SSL info in |ssl_info| and returns true when SSL is in use. |
(...skipping 16 matching lines...) Expand all Loading... |
321 base::WeakPtr<SpdyStream> GetWeakPtr(); | 386 base::WeakPtr<SpdyStream> GetWeakPtr(); |
322 | 387 |
323 bool is_idle() const { | 388 bool is_idle() const { |
324 return io_state_ == STATE_OPEN || io_state_ == STATE_DONE; | 389 return io_state_ == STATE_OPEN || io_state_ == STATE_DONE; |
325 } | 390 } |
326 | 391 |
327 int response_status() const { return response_status_; } | 392 int response_status() const { return response_status_; } |
328 | 393 |
329 bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const; | 394 bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const; |
330 | 395 |
331 // Returns true if the URL for this stream is known. | 396 // Get the URL associated with this stream, or the empty GURL() if |
| 397 // it is unknown. |
| 398 GURL GetUrl() const; |
| 399 |
| 400 // Returns whether the URL for this stream is known. |
| 401 // |
| 402 // TODO(akalin): Remove this, as it's only used in tests. |
332 bool HasUrl() const; | 403 bool HasUrl() const; |
333 | 404 |
334 // Get the URL associated with this stream. Only valid when has_url() is | |
335 // true. | |
336 GURL GetUrl() const; | |
337 | |
338 int GetProtocolVersion() const; | 405 int GetProtocolVersion() const; |
339 | 406 |
340 private: | 407 private: |
341 class SynStreamBufferProducer; | 408 class SynStreamBufferProducer; |
342 class HeaderBufferProducer; | 409 class HeaderBufferProducer; |
343 | 410 |
344 enum State { | 411 enum State { |
345 STATE_NONE, | 412 STATE_NONE, |
346 STATE_GET_DOMAIN_BOUND_CERT, | 413 STATE_GET_DOMAIN_BOUND_CERT, |
347 STATE_GET_DOMAIN_BOUND_CERT_COMPLETE, | 414 STATE_GET_DOMAIN_BOUND_CERT_COMPLETE, |
(...skipping 18 matching lines...) Expand all Loading... |
366 int DoSendRequestHeaders(); | 433 int DoSendRequestHeaders(); |
367 int DoSendRequestHeadersComplete(); | 434 int DoSendRequestHeadersComplete(); |
368 int DoReadHeaders(); | 435 int DoReadHeaders(); |
369 int DoReadHeadersComplete(int result); | 436 int DoReadHeadersComplete(int result); |
370 int DoOpen(); | 437 int DoOpen(); |
371 | 438 |
372 // Update the histograms. Can safely be called repeatedly, but should only | 439 // Update the histograms. Can safely be called repeatedly, but should only |
373 // be called after the stream has completed. | 440 // be called after the stream has completed. |
374 void UpdateHistograms(); | 441 void UpdateHistograms(); |
375 | 442 |
376 // When a server pushed stream is first created, this function is posted on | 443 // When a server-pushed stream is first created, this function is |
377 // the MessageLoop to replay all the data that the server has already sent. | 444 // posted on the current MessageLoop to replay the data that the |
| 445 // server has already sent. |
378 void PushedStreamReplayData(); | 446 void PushedStreamReplayData(); |
379 | 447 |
380 // Produces the SYN_STREAM frame for the stream. The stream must | 448 // Produces the SYN_STREAM frame for the stream. The stream must |
381 // already be activated. | 449 // already be activated. |
382 scoped_ptr<SpdyFrame> ProduceSynStreamFrame(); | 450 scoped_ptr<SpdyFrame> ProduceSynStreamFrame(); |
383 | 451 |
384 // Produce the initial HEADER frame for the stream with the given | 452 // Produce the initial HEADER frame for the stream with the given |
385 // block. The stream must already be activated. | 453 // block. The stream must already be activated. |
386 scoped_ptr<SpdyFrame> ProduceHeaderFrame( | 454 scoped_ptr<SpdyFrame> ProduceHeaderFrame( |
387 scoped_ptr<SpdyHeaderBlock> header_block); | 455 scoped_ptr<SpdyHeaderBlock> header_block); |
388 | 456 |
389 // Queues the send for next frame of the remaining data in | 457 // Queues the send for next frame of the remaining data in |
390 // |pending_send_data_|. Must be called only when | 458 // |pending_send_data_|. Must be called only when |
391 // |pending_send_data_| is set. | 459 // |pending_send_data_| is set. |
392 void QueueNextDataFrame(); | 460 void QueueNextDataFrame(); |
393 | 461 |
| 462 // Merge the given headers into |response_headers_| and calls |
| 463 // OnResponseHeadersUpdated() on the delegate (if attached). |
| 464 // Returns a status code; if it is an error, the stream may have |
| 465 // already been closed. |
| 466 // |
| 467 // TODO(akalin): Guarantee that the stream is already closed if an |
| 468 // error is returned. |
| 469 int MergeWithResponseHeaders(const SpdyHeaderBlock& new_response_headers); |
| 470 |
394 const SpdyStreamType type_; | 471 const SpdyStreamType type_; |
395 | 472 |
396 base::WeakPtrFactory<SpdyStream> weak_ptr_factory_; | 473 base::WeakPtrFactory<SpdyStream> weak_ptr_factory_; |
397 | 474 |
398 // Sentinel variable used to make sure we don't get destroyed by a | 475 // Sentinel variable used to make sure we don't get destroyed by a |
399 // function called from DoLoop(). | 476 // function called from DoLoop(). |
400 bool in_do_loop_; | 477 bool in_do_loop_; |
401 | 478 |
402 // There is a small period of time between when a server pushed stream is | 479 // There is a small period of time between when a server pushed stream is |
403 // first created, and the pushed data is replayed. Any data received during | 480 // first created, and the pushed data is replayed. Any data received during |
404 // this time should continue to be buffered. | 481 // this time should continue to be buffered. |
405 bool continue_buffering_data_; | 482 bool continue_buffering_data_; |
406 | 483 |
407 SpdyStreamId stream_id_; | 484 SpdyStreamId stream_id_; |
408 const std::string path_; | 485 const std::string path_; |
409 const RequestPriority priority_; | 486 const RequestPriority priority_; |
410 size_t slot_; | 487 size_t slot_; |
411 | 488 |
412 // Flow control variables. | 489 // Flow control variables. |
413 bool send_stalled_by_flow_control_; | 490 bool send_stalled_by_flow_control_; |
414 int32 send_window_size_; | 491 int32 send_window_size_; |
415 int32 recv_window_size_; | 492 int32 recv_window_size_; |
416 int32 unacked_recv_window_bytes_; | 493 int32 unacked_recv_window_bytes_; |
417 | 494 |
418 ScopedBandwidthMetrics metrics_; | 495 ScopedBandwidthMetrics metrics_; |
419 bool response_received_; | |
420 | 496 |
421 scoped_refptr<SpdySession> session_; | 497 scoped_refptr<SpdySession> session_; |
422 | 498 |
423 // The transaction should own the delegate. | 499 // The transaction should own the delegate. |
424 SpdyStream::Delegate* delegate_; | 500 SpdyStream::Delegate* delegate_; |
425 | 501 |
426 // Whether or not we have more data to send on this stream. | 502 // Whether or not we have more data to send on this stream. |
427 SpdySendStatus send_status_; | 503 SpdySendStatus send_status_; |
428 | 504 |
429 // The headers for the request to send. | 505 // The headers for the request to send. |
430 // | 506 // |
431 // TODO(akalin): Hang onto this only until we send it. This | 507 // TODO(akalin): Hang onto this only until we send it. This |
432 // necessitates stashing the URL separately. | 508 // necessitates stashing the URL separately. |
433 scoped_ptr<SpdyHeaderBlock> request_; | 509 scoped_ptr<SpdyHeaderBlock> request_headers_; |
434 | 510 |
435 // The data waiting to be sent. | 511 // The data waiting to be sent. |
436 scoped_refptr<DrainableIOBuffer> pending_send_data_; | 512 scoped_refptr<DrainableIOBuffer> pending_send_data_; |
437 | 513 |
438 // The time at which the request was made that resulted in this response. | 514 // The time at which the request was made that resulted in this response. |
439 // For cached responses, this time could be "far" in the past. | 515 // For cached responses, this time could be "far" in the past. |
440 base::Time request_time_; | 516 base::Time request_time_; |
441 | 517 |
442 scoped_ptr<SpdyHeaderBlock> response_; | 518 SpdyHeaderBlock response_headers_; |
| 519 SpdyResponseHeadersStatus response_headers_status_; |
443 base::Time response_time_; | 520 base::Time response_time_; |
444 | 521 |
445 State io_state_; | 522 State io_state_; |
446 | 523 |
447 // Since we buffer the response, we also buffer the response status. | 524 // Since we buffer the response, we also buffer the response status. |
448 // Not valid until the stream is closed. | 525 // Not valid until the stream is closed. |
449 int response_status_; | 526 int response_status_; |
450 | 527 |
451 BoundNetLog net_log_; | 528 BoundNetLog net_log_; |
452 | 529 |
(...skipping 17 matching lines...) Expand all Loading... |
470 // When OnFrameWriteComplete() is called, these variables are set. | 547 // When OnFrameWriteComplete() is called, these variables are set. |
471 SpdyFrameType just_completed_frame_type_; | 548 SpdyFrameType just_completed_frame_type_; |
472 size_t just_completed_frame_size_; | 549 size_t just_completed_frame_size_; |
473 | 550 |
474 DISALLOW_COPY_AND_ASSIGN(SpdyStream); | 551 DISALLOW_COPY_AND_ASSIGN(SpdyStream); |
475 }; | 552 }; |
476 | 553 |
477 } // namespace net | 554 } // namespace net |
478 | 555 |
479 #endif // NET_SPDY_SPDY_STREAM_H_ | 556 #endif // NET_SPDY_SPDY_STREAM_H_ |
OLD | NEW |