| 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 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 | 410 |
| 411 // Returns whether or not this stream is fully open: that request and | 411 // Returns whether or not this stream is fully open: that request and |
| 412 // response headers are complete, and it is not in a half-closed state. | 412 // response headers are complete, and it is not in a half-closed state. |
| 413 bool IsOpen() const; | 413 bool IsOpen() const; |
| 414 | 414 |
| 415 // Returns whether the stream is reserved by remote endpoint: server has sent | 415 // Returns whether the stream is reserved by remote endpoint: server has sent |
| 416 // intended request headers for a pushed stream, but haven't started response | 416 // intended request headers for a pushed stream, but haven't started response |
| 417 // yet. | 417 // yet. |
| 418 bool IsReservedRemote() const; | 418 bool IsReservedRemote() const; |
| 419 | 419 |
| 420 // Returns the protocol used by this stream. Always between | |
| 421 // kProtoSPDYMinimumVersion and kProtoSPDYMaximumVersion. | |
| 422 NextProto GetProtocol() const; | |
| 423 | |
| 424 int response_status() const { return response_status_; } | 420 int response_status() const { return response_status_; } |
| 425 | 421 |
| 426 void AddRawReceivedBytes(size_t received_bytes); | 422 void AddRawReceivedBytes(size_t received_bytes); |
| 427 void AddRawSentBytes(size_t sent_bytes); | 423 void AddRawSentBytes(size_t sent_bytes); |
| 428 | 424 |
| 429 int64_t raw_received_bytes() const { return raw_received_bytes_; } | 425 int64_t raw_received_bytes() const { return raw_received_bytes_; } |
| 430 int64_t raw_sent_bytes() const { return raw_sent_bytes_; } | 426 int64_t raw_sent_bytes() const { return raw_sent_bytes_; } |
| 431 | 427 |
| 432 bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const; | 428 bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const; |
| 433 | 429 |
| 434 // Get the URL from the appropriate stream headers, or the empty | 430 // Get the URL from the appropriate stream headers, or the empty |
| 435 // GURL() if it is unknown. | 431 // GURL() if it is unknown. |
| 436 // | 432 // |
| 437 // TODO(akalin): Figure out if we really need this function, | 433 // TODO(akalin): Figure out if we really need this function, |
| 438 // i.e. can we just use the URL this stream was created with and/or | 434 // i.e. can we just use the URL this stream was created with and/or |
| 439 // one we receive headers validate that the URL from them is the | 435 // one we receive headers validate that the URL from them is the |
| 440 // same. | 436 // same. |
| 441 GURL GetUrlFromHeaders() const; | 437 GURL GetUrlFromHeaders() const; |
| 442 | 438 |
| 443 // Returns whether the URL for this stream is known. | 439 // Returns whether the URL for this stream is known. |
| 444 // | 440 // |
| 445 // TODO(akalin): Remove this, as it's only used in tests. | 441 // TODO(akalin): Remove this, as it's only used in tests. |
| 446 bool HasUrlFromHeaders() const; | 442 bool HasUrlFromHeaders() const; |
| 447 | 443 |
| 448 SpdyMajorVersion GetProtocolVersion() const; | |
| 449 | |
| 450 private: | 444 private: |
| 451 class SynStreamBufferProducer; | 445 class SynStreamBufferProducer; |
| 452 class HeaderBufferProducer; | 446 class HeaderBufferProducer; |
| 453 | 447 |
| 454 // SpdyStream states and transitions are modeled | 448 // SpdyStream states and transitions are modeled |
| 455 // on the HTTP/2 stream state machine. All states and transitions | 449 // on the HTTP/2 stream state machine. All states and transitions |
| 456 // are modeled, with the exceptions of RESERVED_LOCAL (the client | 450 // are modeled, with the exceptions of RESERVED_LOCAL (the client |
| 457 // cannot initate push streams), and the transition to OPEN due to | 451 // cannot initate push streams), and the transition to OPEN due to |
| 458 // a remote SYN_STREAM (the client can only initate streams). | 452 // a remote SYN_STREAM (the client can only initate streams). |
| 459 enum State { | 453 enum State { |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 bool write_handler_guard_; | 581 bool write_handler_guard_; |
| 588 | 582 |
| 589 base::WeakPtrFactory<SpdyStream> weak_ptr_factory_; | 583 base::WeakPtrFactory<SpdyStream> weak_ptr_factory_; |
| 590 | 584 |
| 591 DISALLOW_COPY_AND_ASSIGN(SpdyStream); | 585 DISALLOW_COPY_AND_ASSIGN(SpdyStream); |
| 592 }; | 586 }; |
| 593 | 587 |
| 594 } // namespace net | 588 } // namespace net |
| 595 | 589 |
| 596 #endif // NET_SPDY_SPDY_STREAM_H_ | 590 #endif // NET_SPDY_SPDY_STREAM_H_ |
| OLD | NEW |