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 <list> | 8 #include <list> |
9 | 9 |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "net/base/io_buffer.h" | 11 #include "net/base/io_buffer.h" |
12 #include "net/http/http_stream.h" | 12 #include "net/http/http_stream.h" |
13 #include "net/quic/quic_client_session.h" | 13 #include "net/quic/quic_client_session.h" |
14 #include "net/quic/quic_reliable_client_stream.h" | 14 #include "net/quic/quic_reliable_client_stream.h" |
15 | 15 |
16 namespace net { | 16 namespace net { |
17 | 17 |
18 namespace test { | 18 namespace test { |
19 class QuicHttpStreamPeer; | 19 class QuicHttpStreamPeer; |
20 } // namespace test | 20 } // namespace test |
21 | 21 |
22 // The QuicHttpStream is a QUIC-specific HttpStream subclass. It holds a | 22 // The QuicHttpStream is a QUIC-specific HttpStream subclass. It holds a |
23 // non-owning pointer to a QuicReliableClientStream which it uses to | 23 // non-owning pointer to a QuicReliableClientStream which it uses to |
24 // send and receive data. | 24 // send and receive data. |
25 class NET_EXPORT_PRIVATE QuicHttpStream : | 25 class NET_EXPORT_PRIVATE QuicHttpStream |
26 public QuicClientSession::Observer, | 26 : public QuicClientSession::Observer, |
27 public QuicReliableClientStream::Delegate, | 27 public QuicReliableClientStream::Delegate, |
28 public HttpStream { | 28 public HttpStream { |
29 public: | 29 public: |
30 explicit QuicHttpStream(const base::WeakPtr<QuicClientSession>& session); | 30 explicit QuicHttpStream(const base::WeakPtr<QuicClientSession>& session); |
31 | 31 |
32 virtual ~QuicHttpStream(); | 32 virtual ~QuicHttpStream(); |
33 | 33 |
34 // HttpStream implementation. | 34 // HttpStream implementation. |
35 virtual int InitializeStream(const HttpRequestInfo* request_info, | 35 virtual int InitializeStream(const HttpRequestInfo* request_info, |
36 RequestPriority priority, | 36 RequestPriority priority, |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 int DoReadResponseHeaders(); | 100 int DoReadResponseHeaders(); |
101 int DoReadResponseHeadersComplete(int rv); | 101 int DoReadResponseHeadersComplete(int rv); |
102 | 102 |
103 int ParseResponseHeaders(); | 103 int ParseResponseHeaders(); |
104 | 104 |
105 void BufferResponseBody(const char* data, int length); | 105 void BufferResponseBody(const char* data, int length); |
106 | 106 |
107 State next_state_; | 107 State next_state_; |
108 | 108 |
109 base::WeakPtr<QuicClientSession> session_; | 109 base::WeakPtr<QuicClientSession> session_; |
110 int session_error_; // Error code from the connection shutdown. | 110 int session_error_; // Error code from the connection shutdown. |
111 bool was_handshake_confirmed_; // True if the crypto handshake succeeded. | 111 bool was_handshake_confirmed_; // True if the crypto handshake succeeded. |
112 QuicClientSession::StreamRequest stream_request_; | 112 QuicClientSession::StreamRequest stream_request_; |
113 QuicReliableClientStream* stream_; // Non-owning. | 113 QuicReliableClientStream* stream_; // Non-owning. |
114 | 114 |
115 // The following three fields are all owned by the caller and must | 115 // The following three fields are all owned by the caller and must |
116 // outlive this object, according to the HttpStream contract. | 116 // outlive this object, according to the HttpStream contract. |
117 | 117 |
118 // The request to send. | 118 // The request to send. |
119 const HttpRequestInfo* request_info_; | 119 const HttpRequestInfo* request_info_; |
120 // The request body to send, if any, owned by the caller. | 120 // The request body to send, if any, owned by the caller. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 BoundNetLog stream_net_log_; | 163 BoundNetLog stream_net_log_; |
164 | 164 |
165 base::WeakPtrFactory<QuicHttpStream> weak_factory_; | 165 base::WeakPtrFactory<QuicHttpStream> weak_factory_; |
166 | 166 |
167 DISALLOW_COPY_AND_ASSIGN(QuicHttpStream); | 167 DISALLOW_COPY_AND_ASSIGN(QuicHttpStream); |
168 }; | 168 }; |
169 | 169 |
170 } // namespace net | 170 } // namespace net |
171 | 171 |
172 #endif // NET_QUIC_QUIC_HTTP_STREAM_H_ | 172 #endif // NET_QUIC_QUIC_HTTP_STREAM_H_ |
OLD | NEW |