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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
279 // writes. | 279 // writes. |
280 bool WasEverUsed() const; | 280 bool WasEverUsed() const; |
281 | 281 |
282 const BoundNetLog& net_log() const { return net_log_; } | 282 const BoundNetLog& net_log() const { return net_log_; } |
283 | 283 |
284 base::Time GetRequestTime() const; | 284 base::Time GetRequestTime() const; |
285 void SetRequestTime(base::Time t); | 285 void SetRequestTime(base::Time t); |
286 | 286 |
287 // Called at most once by the SpdySession when the initial response | 287 // Called at most once by the SpdySession when the initial response |
288 // headers have been received for this stream, i.e., a SYN_REPLY (or | 288 // headers have been received for this stream, i.e., a SYN_REPLY (or |
289 // SYN_STREAM for push streams) frame has been received. This is the | 289 // SYN_STREAM for push streams) frame has been received. Returns a status |
290 // entry point for a push stream. Returns a status code; if it is | 290 // code; if it is an error, the stream was closed by this function. |
291 // an error, the stream was closed by this function. | |
292 int OnInitialResponseHeadersReceived(const SpdyHeaderBlock& response_headers, | 291 int OnInitialResponseHeadersReceived(const SpdyHeaderBlock& response_headers, |
293 base::Time response_time, | 292 base::Time response_time, |
294 base::TimeTicks recv_first_byte_time); | 293 base::TimeTicks recv_first_byte_time); |
295 | 294 |
296 // Called by the SpdySession (only after | 295 // Called by the SpdySession (only after |
297 // OnInitialResponseHeadersReceived() has been called) when | 296 // OnInitialResponseHeadersReceived() has been called) when |
298 // late-bound headers are received for a stream. Returns a status | 297 // late-bound headers are received for a stream. Returns a status |
299 // code; if it is an error, the stream was closed by this function. | 298 // code; if it is an error, the stream was closed by this function. |
300 int OnAdditionalResponseHeadersReceived( | 299 int OnAdditionalResponseHeadersReceived( |
301 const SpdyHeaderBlock& additional_response_headers); | 300 const SpdyHeaderBlock& additional_response_headers); |
302 | 301 |
302 // Called by the SpdySession when PUSH_PROMISE is received. This is the | |
Johnny
2014/06/05 02:56:04
I'm worried about the use of exact frame names in
baranovich
2014/06/05 19:16:58
Done.
| |
303 // entry point for a push stream.. Stream transits to STATE_RESERVED_REMOTE | |
304 // state. Returns a status code; if it is an error, the stream was closed by | |
305 // this function. | |
306 int OnPushPromiseHeadersReceived(const SpdyHeaderBlock& headers); | |
307 | |
303 // Called by the SpdySession when response data has been received | 308 // Called by the SpdySession when response data has been received |
304 // for this stream. This callback may be called multiple times as | 309 // for this stream. This callback may be called multiple times as |
305 // data arrives from the network, and will never be called prior to | 310 // data arrives from the network, and will never be called prior to |
306 // OnResponseHeadersReceived. | 311 // OnResponseHeadersReceived. |
307 // | 312 // |
308 // |buffer| contains the data received, or NULL if the stream is | 313 // |buffer| contains the data received, or NULL if the stream is |
309 // being closed. The stream must copy any data from this | 314 // being closed. The stream must copy any data from this |
310 // buffer before returning from this callback. | 315 // buffer before returning from this callback. |
311 // | 316 // |
312 // |length| is the number of bytes received (at most 2^24 - 1) or 0 if | 317 // |length| is the number of bytes received (at most 2^24 - 1) or 0 if |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
433 | 438 |
434 private: | 439 private: |
435 class SynStreamBufferProducer; | 440 class SynStreamBufferProducer; |
436 class HeaderBufferProducer; | 441 class HeaderBufferProducer; |
437 | 442 |
438 // SpdyStream states and transitions are modeled | 443 // SpdyStream states and transitions are modeled |
439 // on the HTTP/2 stream state machine. All states and transitions | 444 // on the HTTP/2 stream state machine. All states and transitions |
440 // are modeled, with the exceptions of RESERVED_LOCAL (the client | 445 // are modeled, with the exceptions of RESERVED_LOCAL (the client |
441 // cannot initate push streams), and the transition to OPEN due to | 446 // cannot initate push streams), and the transition to OPEN due to |
442 // a remote SYN_STREAM (the client can only initate streams). | 447 // a remote SYN_STREAM (the client can only initate streams). |
443 // TODO(jgraettinger): RESERVED_REMOTE must be added to the state | |
444 // machine when PUSH_PROMISE is implemented. | |
445 enum State { | 448 enum State { |
446 STATE_IDLE, | 449 STATE_IDLE, |
447 STATE_OPEN, | 450 STATE_OPEN, |
448 STATE_HALF_CLOSED_LOCAL_UNCLAIMED, | 451 STATE_HALF_CLOSED_LOCAL_UNCLAIMED, |
449 STATE_HALF_CLOSED_LOCAL, | 452 STATE_HALF_CLOSED_LOCAL, |
450 STATE_HALF_CLOSED_REMOTE, | 453 STATE_HALF_CLOSED_REMOTE, |
454 STATE_RESERVED_REMOTE, | |
451 STATE_CLOSED, | 455 STATE_CLOSED, |
452 }; | 456 }; |
453 | 457 |
454 // Update the histograms. Can safely be called repeatedly, but should only | 458 // Update the histograms. Can safely be called repeatedly, but should only |
455 // be called after the stream has completed. | 459 // be called after the stream has completed. |
456 void UpdateHistograms(); | 460 void UpdateHistograms(); |
457 | 461 |
458 // When a server-push stream is claimed by SetDelegate(), this function is | 462 // When a server-push stream is claimed by SetDelegate(), this function is |
459 // posted on the current MessageLoop to replay everything the server has sent. | 463 // posted on the current MessageLoop to replay everything the server has sent. |
460 // From the perspective of SpdyStream's state machine, headers, data, and | 464 // From the perspective of SpdyStream's state machine, headers, data, and |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
561 bool write_handler_guard_; | 565 bool write_handler_guard_; |
562 | 566 |
563 base::WeakPtrFactory<SpdyStream> weak_ptr_factory_; | 567 base::WeakPtrFactory<SpdyStream> weak_ptr_factory_; |
564 | 568 |
565 DISALLOW_COPY_AND_ASSIGN(SpdyStream); | 569 DISALLOW_COPY_AND_ASSIGN(SpdyStream); |
566 }; | 570 }; |
567 | 571 |
568 } // namespace net | 572 } // namespace net |
569 | 573 |
570 #endif // NET_SPDY_SPDY_STREAM_H_ | 574 #endif // NET_SPDY_SPDY_STREAM_H_ |
OLD | NEW |