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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 void AddRawReceivedBytes(size_t received_bytes); | 422 void AddRawReceivedBytes(size_t received_bytes); |
423 void AddRawSentBytes(size_t sent_bytes); | 423 void AddRawSentBytes(size_t sent_bytes); |
424 | 424 |
425 int64_t raw_received_bytes() const { return raw_received_bytes_; } | 425 int64_t raw_received_bytes() const { return raw_received_bytes_; } |
426 int64_t raw_sent_bytes() const { return raw_sent_bytes_; } | 426 int64_t raw_sent_bytes() const { return raw_sent_bytes_; } |
427 | 427 |
428 bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const; | 428 bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const; |
429 | 429 |
430 // Get the URL from the appropriate stream headers, or the empty | 430 // Get the URL from the appropriate stream headers, or the empty |
431 // GURL() if it is unknown. | 431 // GURL() if it is unknown. |
432 // | 432 const GURL& GetUrlFromHeaders() const { return url_from_header_block_; } |
433 // TODO(akalin): Figure out if we really need this function, | |
434 // i.e. can we just use the URL this stream was created with and/or | |
435 // one we receive headers validate that the URL from them is the | |
436 // same. | |
437 GURL GetUrlFromHeaders() const; | |
438 | |
439 // Returns whether the URL for this stream is known. | |
440 // | |
441 // TODO(akalin): Remove this, as it's only used in tests. | |
442 bool HasUrlFromHeaders() const; | |
443 | 433 |
444 private: | 434 private: |
445 class SynStreamBufferProducer; | 435 class SynStreamBufferProducer; |
446 class HeaderBufferProducer; | 436 class HeaderBufferProducer; |
447 | 437 |
448 // SpdyStream states and transitions are modeled | 438 // SpdyStream states and transitions are modeled |
449 // on the HTTP/2 stream state machine. All states and transitions | 439 // on the HTTP/2 stream state machine. All states and transitions |
450 // are modeled, with the exceptions of RESERVED_LOCAL (the client | 440 // are modeled, with the exceptions of RESERVED_LOCAL (the client |
451 // cannot initate push streams), and the transition to OPEN due to | 441 // cannot initate push streams), and the transition to OPEN due to |
452 // a remote SYN_STREAM (the client can only initate streams). | 442 // a remote SYN_STREAM (the client can only initate streams). |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 // and this member keeps count of them until the corresponding WINDOW_UPDATEs | 505 // and this member keeps count of them until the corresponding WINDOW_UPDATEs |
516 // are sent. | 506 // are sent. |
517 int32_t unacked_recv_window_bytes_; | 507 int32_t unacked_recv_window_bytes_; |
518 | 508 |
519 const base::WeakPtr<SpdySession> session_; | 509 const base::WeakPtr<SpdySession> session_; |
520 | 510 |
521 // The transaction should own the delegate. | 511 // The transaction should own the delegate. |
522 SpdyStream::Delegate* delegate_; | 512 SpdyStream::Delegate* delegate_; |
523 | 513 |
524 // The headers for the request to send. | 514 // The headers for the request to send. |
525 // | |
526 // TODO(akalin): Hang onto this only until we send it. This | |
527 // necessitates stashing the URL separately. | |
528 bool request_headers_valid_; | 515 bool request_headers_valid_; |
529 SpdyHeaderBlock request_headers_; | 516 SpdyHeaderBlock request_headers_; |
530 | 517 |
| 518 // The URL from the request headers. |
| 519 GURL url_from_header_block_; |
| 520 |
531 // Data waiting to be sent, and the close state of the local endpoint | 521 // Data waiting to be sent, and the close state of the local endpoint |
532 // after the data is fully written. | 522 // after the data is fully written. |
533 scoped_refptr<DrainableIOBuffer> pending_send_data_; | 523 scoped_refptr<DrainableIOBuffer> pending_send_data_; |
534 SpdySendStatus pending_send_status_; | 524 SpdySendStatus pending_send_status_; |
535 | 525 |
536 // Data waiting to be received, and the close state of the remote endpoint | 526 // Data waiting to be received, and the close state of the remote endpoint |
537 // after the data is fully read. Specifically, data received before the | 527 // after the data is fully read. Specifically, data received before the |
538 // delegate is attached must be buffered and later replayed. A remote FIN | 528 // delegate is attached must be buffered and later replayed. A remote FIN |
539 // is represented by a final, zero-length buffer. | 529 // is represented by a final, zero-length buffer. |
540 std::vector<std::unique_ptr<SpdyBuffer>> pending_recv_data_; | 530 std::vector<std::unique_ptr<SpdyBuffer>> pending_recv_data_; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 bool write_handler_guard_; | 567 bool write_handler_guard_; |
578 | 568 |
579 base::WeakPtrFactory<SpdyStream> weak_ptr_factory_; | 569 base::WeakPtrFactory<SpdyStream> weak_ptr_factory_; |
580 | 570 |
581 DISALLOW_COPY_AND_ASSIGN(SpdyStream); | 571 DISALLOW_COPY_AND_ASSIGN(SpdyStream); |
582 }; | 572 }; |
583 | 573 |
584 } // namespace net | 574 } // namespace net |
585 | 575 |
586 #endif // NET_SPDY_SPDY_STREAM_H_ | 576 #endif // NET_SPDY_SPDY_STREAM_H_ |
OLD | NEW |