| 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 // NOTE: This code is not shared between Google and Chrome. | 5 // NOTE: This code is not shared between Google and Chrome. |
| 6 | 6 |
| 7 #ifndef NET_QUIC_QUIC_RELIABLE_CLIENT_STREAM_H_ | 7 #ifndef NET_QUIC_QUIC_RELIABLE_CLIENT_STREAM_H_ |
| 8 #define NET_QUIC_QUIC_RELIABLE_CLIENT_STREAM_H_ | 8 #define NET_QUIC_QUIC_RELIABLE_CLIENT_STREAM_H_ |
| 9 | 9 |
| 10 #include <stddef.h> | 10 #include <stddef.h> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "net/base/ip_endpoint.h" | 13 #include "net/base/ip_endpoint.h" |
| 14 #include "net/base/upload_data_stream.h" | 14 #include "net/base/upload_data_stream.h" |
| 15 #include "net/http/http_request_info.h" | 15 #include "net/http/http_request_info.h" |
| 16 #include "net/http/http_response_info.h" | 16 #include "net/http/http_response_info.h" |
| 17 #include "net/http/http_stream.h" | 17 #include "net/http/http_stream.h" |
| 18 #include "net/quic/quic_spdy_stream.h" | 18 #include "net/quic/quic_spdy_stream.h" |
| 19 | 19 |
| 20 namespace net { | 20 namespace net { |
| 21 | 21 |
| 22 class QuicSpdySession; | 22 class QuicSpdySession; |
| 23 | 23 |
| 24 // A client-initiated ReliableQuicStream. Instances of this class | 24 // A client-initiated ReliableQuicStream. Instances of this class |
| 25 // are owned by the QuicClientSession which created them. | 25 // are owned by the QuicClientSession which created them. |
| 26 class NET_EXPORT_PRIVATE QuicReliableClientStream : public QuicSpdyStream { | 26 class NET_EXPORT_PRIVATE QuicChromiumClientStream : public QuicSpdyStream { |
| 27 public: | 27 public: |
| 28 // Delegate handles protocol specific behavior of a quic stream. | 28 // Delegate handles protocol specific behavior of a quic stream. |
| 29 class NET_EXPORT_PRIVATE Delegate { | 29 class NET_EXPORT_PRIVATE Delegate { |
| 30 public: | 30 public: |
| 31 Delegate() {} | 31 Delegate() {} |
| 32 | 32 |
| 33 // Called when headers are available. | 33 // Called when headers are available. |
| 34 virtual void OnHeadersAvailable(const SpdyHeaderBlock& headers, | 34 virtual void OnHeadersAvailable(const SpdyHeaderBlock& headers, |
| 35 size_t frame_len) = 0; | 35 size_t frame_len) = 0; |
| 36 | 36 |
| 37 // Called when data is available to be read. | 37 // Called when data is available to be read. |
| 38 virtual void OnDataAvailable() = 0; | 38 virtual void OnDataAvailable() = 0; |
| 39 | 39 |
| 40 // Called when the stream is closed by the peer. | 40 // Called when the stream is closed by the peer. |
| 41 virtual void OnClose(QuicErrorCode error) = 0; | 41 virtual void OnClose(QuicErrorCode error) = 0; |
| 42 | 42 |
| 43 // Called when the stream is closed because of an error. | 43 // Called when the stream is closed because of an error. |
| 44 virtual void OnError(int error) = 0; | 44 virtual void OnError(int error) = 0; |
| 45 | 45 |
| 46 // Returns true if sending of headers has completed. | 46 // Returns true if sending of headers has completed. |
| 47 virtual bool HasSendHeadersComplete() = 0; | 47 virtual bool HasSendHeadersComplete() = 0; |
| 48 | 48 |
| 49 protected: | 49 protected: |
| 50 virtual ~Delegate() {} | 50 virtual ~Delegate() {} |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 DISALLOW_COPY_AND_ASSIGN(Delegate); | 53 DISALLOW_COPY_AND_ASSIGN(Delegate); |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 QuicReliableClientStream(QuicStreamId id, | 56 QuicChromiumClientStream(QuicStreamId id, |
| 57 QuicSpdySession* session, | 57 QuicSpdySession* session, |
| 58 const BoundNetLog& net_log); | 58 const BoundNetLog& net_log); |
| 59 | 59 |
| 60 ~QuicReliableClientStream() override; | 60 ~QuicChromiumClientStream() override; |
| 61 | 61 |
| 62 // QuicSpdyStream | 62 // QuicSpdyStream |
| 63 void OnStreamHeadersComplete(bool fin, size_t frame_len) override; | 63 void OnStreamHeadersComplete(bool fin, size_t frame_len) override; |
| 64 void OnDataAvailable() override; | 64 void OnDataAvailable() override; |
| 65 void OnClose() override; | 65 void OnClose() override; |
| 66 void OnCanWrite() override; | 66 void OnCanWrite() override; |
| 67 SpdyPriority Priority() const override; | 67 SpdyPriority Priority() const override; |
| 68 | 68 |
| 69 // While the server's set_priority shouldn't be called externally, the creator | 69 // While the server's set_priority shouldn't be called externally, the creator |
| 70 // of client-side streams should be able to set the priority. | 70 // of client-side streams should be able to set the priority. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 99 void NotifyDelegateOfDataAvailableLater(); | 99 void NotifyDelegateOfDataAvailableLater(); |
| 100 void NotifyDelegateOfDataAvailable(); | 100 void NotifyDelegateOfDataAvailable(); |
| 101 | 101 |
| 102 BoundNetLog net_log_; | 102 BoundNetLog net_log_; |
| 103 Delegate* delegate_; | 103 Delegate* delegate_; |
| 104 | 104 |
| 105 bool headers_delivered_; | 105 bool headers_delivered_; |
| 106 | 106 |
| 107 CompletionCallback callback_; | 107 CompletionCallback callback_; |
| 108 | 108 |
| 109 base::WeakPtrFactory<QuicReliableClientStream> weak_factory_; | 109 base::WeakPtrFactory<QuicChromiumClientStream> weak_factory_; |
| 110 | 110 |
| 111 DISALLOW_COPY_AND_ASSIGN(QuicReliableClientStream); | 111 DISALLOW_COPY_AND_ASSIGN(QuicChromiumClientStream); |
| 112 }; | 112 }; |
| 113 | 113 |
| 114 } // namespace net | 114 } // namespace net |
| 115 | 115 |
| 116 #endif // NET_QUIC_QUIC_RELIABLE_CLIENT_STREAM_H_ | 116 #endif // NET_QUIC_QUIC_RELIABLE_CLIENT_STREAM_H_ |
| OLD | NEW |