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_QUIC_QUIC_HTTP_STREAM_H_ | 5 #ifndef NET_QUIC_QUIC_HTTP_STREAM_H_ |
6 #define NET_QUIC_QUIC_HTTP_STREAM_H_ | 6 #define NET_QUIC_QUIC_HTTP_STREAM_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <list> | 11 #include <list> |
12 | 12 |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "net/base/io_buffer.h" | 15 #include "net/base/io_buffer.h" |
16 #include "net/http/http_stream.h" | 16 #include "net/http/http_stream.h" |
17 #include "net/quic/quic_chromium_client_session.h" | 17 #include "net/quic/quic_chromium_client_session.h" |
18 #include "net/quic/quic_reliable_client_stream.h" | 18 #include "net/quic/quic_chromium_client_stream.h" |
19 | 19 |
20 namespace net { | 20 namespace net { |
21 | 21 |
22 namespace test { | 22 namespace test { |
23 class QuicHttpStreamPeer; | 23 class QuicHttpStreamPeer; |
24 } // namespace test | 24 } // namespace test |
25 | 25 |
26 // The QuicHttpStream is a QUIC-specific HttpStream subclass. It holds a | 26 // The QuicHttpStream is a QUIC-specific HttpStream subclass. It holds a |
27 // non-owning pointer to a QuicReliableClientStream which it uses to | 27 // non-owning pointer to a QuicChromiumClientStream which it uses to |
28 // send and receive data. | 28 // send and receive data. |
29 class NET_EXPORT_PRIVATE QuicHttpStream | 29 class NET_EXPORT_PRIVATE QuicHttpStream |
30 : public QuicChromiumClientSession::Observer, | 30 : public QuicChromiumClientSession::Observer, |
31 public QuicReliableClientStream::Delegate, | 31 public QuicChromiumClientStream::Delegate, |
32 public HttpStream { | 32 public HttpStream { |
33 public: | 33 public: |
34 explicit QuicHttpStream( | 34 explicit QuicHttpStream( |
35 const base::WeakPtr<QuicChromiumClientSession>& session); | 35 const base::WeakPtr<QuicChromiumClientSession>& session); |
36 | 36 |
37 ~QuicHttpStream() override; | 37 ~QuicHttpStream() override; |
38 | 38 |
39 // HttpStream implementation. | 39 // HttpStream implementation. |
40 int InitializeStream(const HttpRequestInfo* request_info, | 40 int InitializeStream(const HttpRequestInfo* request_info, |
41 RequestPriority priority, | 41 RequestPriority priority, |
(...skipping 16 matching lines...) Expand all Loading... |
58 int64_t GetTotalReceivedBytes() const override; | 58 int64_t GetTotalReceivedBytes() const override; |
59 int64_t GetTotalSentBytes() const override; | 59 int64_t GetTotalSentBytes() const override; |
60 bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const override; | 60 bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const override; |
61 void GetSSLInfo(SSLInfo* ssl_info) override; | 61 void GetSSLInfo(SSLInfo* ssl_info) override; |
62 void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) override; | 62 void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) override; |
63 bool GetRemoteEndpoint(IPEndPoint* endpoint) override; | 63 bool GetRemoteEndpoint(IPEndPoint* endpoint) override; |
64 void Drain(HttpNetworkSession* session) override; | 64 void Drain(HttpNetworkSession* session) override; |
65 void PopulateNetErrorDetails(NetErrorDetails* details) override; | 65 void PopulateNetErrorDetails(NetErrorDetails* details) override; |
66 void SetPriority(RequestPriority priority) override; | 66 void SetPriority(RequestPriority priority) override; |
67 | 67 |
68 // QuicReliableClientStream::Delegate implementation | 68 // QuicChromiumClientStream::Delegate implementation |
69 void OnHeadersAvailable(const SpdyHeaderBlock& headers, | 69 void OnHeadersAvailable(const SpdyHeaderBlock& headers, |
70 size_t frame_len) override; | 70 size_t frame_len) override; |
71 void OnDataAvailable() override; | 71 void OnDataAvailable() override; |
72 void OnClose(QuicErrorCode error) override; | 72 void OnClose(QuicErrorCode error) override; |
73 void OnError(int error) override; | 73 void OnError(int error) override; |
74 bool HasSendHeadersComplete() override; | 74 bool HasSendHeadersComplete() override; |
75 | 75 |
76 // QuicChromiumClientSession::Observer implementation | 76 // QuicChromiumClientSession::Observer implementation |
77 void OnCryptoHandshakeConfirmed() override; | 77 void OnCryptoHandshakeConfirmed() override; |
78 void OnSessionClosed(int error) override; | 78 void OnSessionClosed(int error) override; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 int ReadAvailableData(IOBuffer* buf, int buf_len); | 110 int ReadAvailableData(IOBuffer* buf, int buf_len); |
111 | 111 |
112 void ResetStream(); | 112 void ResetStream(); |
113 | 113 |
114 State next_state_; | 114 State next_state_; |
115 | 115 |
116 base::WeakPtr<QuicChromiumClientSession> session_; | 116 base::WeakPtr<QuicChromiumClientSession> session_; |
117 int session_error_; // Error code from the connection shutdown. | 117 int session_error_; // Error code from the connection shutdown. |
118 bool was_handshake_confirmed_; // True if the crypto handshake succeeded. | 118 bool was_handshake_confirmed_; // True if the crypto handshake succeeded. |
119 QuicChromiumClientSession::StreamRequest stream_request_; | 119 QuicChromiumClientSession::StreamRequest stream_request_; |
120 QuicReliableClientStream* stream_; // Non-owning. | 120 QuicChromiumClientStream* stream_; // Non-owning. |
121 | 121 |
122 // The following three fields are all owned by the caller and must | 122 // The following three fields are all owned by the caller and must |
123 // outlive this object, according to the HttpStream contract. | 123 // outlive this object, according to the HttpStream contract. |
124 | 124 |
125 // The request to send. | 125 // The request to send. |
126 const HttpRequestInfo* request_info_; | 126 const HttpRequestInfo* request_info_; |
127 // The request body to send, if any, owned by the caller. | 127 // The request body to send, if any, owned by the caller. |
128 UploadDataStream* request_body_stream_; | 128 UploadDataStream* request_body_stream_; |
129 // Time the request was issued. | 129 // Time the request was issued. |
130 base::Time request_time_; | 130 base::Time request_time_; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 QuicErrorCode quic_connection_error_; | 174 QuicErrorCode quic_connection_error_; |
175 | 175 |
176 base::WeakPtrFactory<QuicHttpStream> weak_factory_; | 176 base::WeakPtrFactory<QuicHttpStream> weak_factory_; |
177 | 177 |
178 DISALLOW_COPY_AND_ASSIGN(QuicHttpStream); | 178 DISALLOW_COPY_AND_ASSIGN(QuicHttpStream); |
179 }; | 179 }; |
180 | 180 |
181 } // namespace net | 181 } // namespace net |
182 | 182 |
183 #endif // NET_QUIC_QUIC_HTTP_STREAM_H_ | 183 #endif // NET_QUIC_QUIC_HTTP_STREAM_H_ |
OLD | NEW |