Chromium Code Reviews| Index: net/quic/chromium/quic_chromium_client_stream.h |
| diff --git a/net/quic/chromium/quic_chromium_client_stream.h b/net/quic/chromium/quic_chromium_client_stream.h |
| index e8d05e96ba88735e189821e65d50ed7db657cef2..2fb5df310e99f3fdd5ffe04b11de385746bb174f 100644 |
| --- a/net/quic/chromium/quic_chromium_client_stream.h |
| +++ b/net/quic/chromium/quic_chromium_client_stream.h |
| @@ -39,10 +39,6 @@ class NET_EXPORT_PRIVATE QuicChromiumClientStream : public QuicSpdyStream { |
| public: |
| Delegate() {} |
| - // Called when initial headers are available. |
| - virtual void OnInitialHeadersAvailable(const SpdyHeaderBlock& headers, |
| - size_t frame_len) = 0; |
| - |
| // Called when trailing headers are available. |
| virtual void OnTrailingHeadersAvailable(const SpdyHeaderBlock& headers, |
| size_t frame_len) = 0; |
| @@ -71,6 +67,15 @@ class NET_EXPORT_PRIVATE QuicChromiumClientStream : public QuicSpdyStream { |
| // Returns true if the stream is still connected. |
| bool IsOpen() { return stream_ != nullptr; } |
| + // Reads initial headers into |header_block| and returns the lenght of |
|
xunjieli
2017/05/10 17:54:27
nit: typo in length
Ryan Hamilton
2017/05/10 18:26:40
Done.
|
| + // the HEADERS frame which contained them. If headers are not available, |
| + // returns ERR_IO_PENDING and will invokes |callback| asynchronously when |
|
xunjieli
2017/05/10 17:54:27
nit: s/invokes/invoke
Ryan Hamilton
2017/05/10 18:26:40
Done.
|
| + // the headers arrive. |
| + // TODO(rch): Invoke |callback| when there is a stream or connection error |
| + // instead of calling OnClose() or OnError(). |
| + int ReadInitialHeaders(SpdyHeaderBlock* header_block, |
| + const CompletionCallback& callback); |
| + |
| // Writes |header_block| to the peer. Closes the write side if |fin| is |
| // true. If non-null, |ack_notifier_delegate| will be notified when the |
| // headers are ACK'd by the peer. |
| @@ -142,8 +147,7 @@ class NET_EXPORT_PRIVATE QuicChromiumClientStream : public QuicSpdyStream { |
| Handle(QuicChromiumClientStream* stream, Delegate* delegate); |
| // Methods invoked by the stream. |
| - void OnInitialHeadersAvailable(const SpdyHeaderBlock& headers, |
| - size_t frame_len); |
| + void OnInitialHeadersAvailable(); |
| void OnTrailingHeadersAvailable(const SpdyHeaderBlock& headers, |
| size_t frame_len); |
| void OnDataAvailable(); |
| @@ -153,9 +157,18 @@ class NET_EXPORT_PRIVATE QuicChromiumClientStream : public QuicSpdyStream { |
| // Saves various fields from the stream before the stream goes away. |
| void SaveState(); |
| + void SetCallback(CompletionCallback new_callback, |
| + CompletionCallback* callback); |
| + |
| QuicChromiumClientStream* stream_; // Unowned. |
| Delegate* delegate_; // Owns this. |
| + // True when callbacks can be invoked, which means no synchronous |
| + // method is in progress. |
| + bool can_invoke_callbacks_; |
| + CompletionCallback read_headers_callback_; |
| + SpdyHeaderBlock* read_headers_buffer_; |
| + |
| QuicStreamId id_; |
| QuicErrorCode connection_error_; |
| QuicRstStreamErrorCode stream_error_; |
| @@ -234,14 +247,14 @@ class NET_EXPORT_PRIVATE QuicChromiumClientStream : public QuicSpdyStream { |
| // True if this stream is the first data stream created on this session. |
| bool IsFirstStream(); |
| + bool DeliverInitialHeaders(SpdyHeaderBlock* header_block, int* frame_len); |
| + |
| using QuicSpdyStream::HasBufferedData; |
| using QuicStream::sequencer; |
| private: |
| - void NotifyHandleOfInitialHeadersAvailableLater(SpdyHeaderBlock headers, |
| - size_t frame_len); |
| - void NotifyHandleOfInitialHeadersAvailable(SpdyHeaderBlock headers, |
| - size_t frame_len); |
| + void NotifyHandleOfInitialHeadersAvailableLater(); |
| + void NotifyHandleOfInitialHeadersAvailable(); |
| void NotifyHandleOfTrailingHeadersAvailableLater(SpdyHeaderBlock headers, |
| size_t frame_len); |
| void NotifyHandleOfTrailingHeadersAvailable(SpdyHeaderBlock headers, |