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 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "net/base/io_buffer.h" | 17 #include "net/base/io_buffer.h" |
18 #include "net/base/load_timing_info.h" | 18 #include "net/base/load_timing_info.h" |
19 #include "net/base/net_export.h" | 19 #include "net/base/net_export.h" |
| 20 #include "net/http/http_response_info.h" |
20 #include "net/http/http_stream.h" | 21 #include "net/http/http_stream.h" |
21 #include "net/log/net_log_with_source.h" | 22 #include "net/log/net_log_with_source.h" |
22 #include "net/quic/chromium/quic_chromium_client_session.h" | 23 #include "net/quic/chromium/quic_chromium_client_session.h" |
23 #include "net/quic/chromium/quic_chromium_client_stream.h" | 24 #include "net/quic/chromium/quic_chromium_client_stream.h" |
24 #include "net/quic/core/quic_client_push_promise_index.h" | 25 #include "net/quic/core/quic_client_push_promise_index.h" |
| 26 #include "net/quic/core/quic_protocol.h" |
25 | 27 |
26 namespace net { | 28 namespace net { |
27 | 29 |
28 namespace test { | 30 namespace test { |
29 class QuicHttpStreamPeer; | 31 class QuicHttpStreamPeer; |
30 } // namespace test | 32 } // namespace test |
31 | 33 |
32 // The QuicHttpStream is a QUIC-specific HttpStream subclass. It holds a | 34 // The QuicHttpStream is a QUIC-specific HttpStream subclass. It holds a |
33 // non-owning pointer to a QuicChromiumClientStream which it uses to | 35 // non-owning pointer to a QuicChromiumClientStream which it uses to |
34 // send and receive data. | 36 // send and receive data. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // QuicChromiumClientStream::Delegate implementation | 79 // QuicChromiumClientStream::Delegate implementation |
78 void OnHeadersAvailable(const SpdyHeaderBlock& headers, | 80 void OnHeadersAvailable(const SpdyHeaderBlock& headers, |
79 size_t frame_len) override; | 81 size_t frame_len) override; |
80 void OnDataAvailable() override; | 82 void OnDataAvailable() override; |
81 void OnClose() override; | 83 void OnClose() override; |
82 void OnError(int error) override; | 84 void OnError(int error) override; |
83 bool HasSendHeadersComplete() override; | 85 bool HasSendHeadersComplete() override; |
84 | 86 |
85 // QuicChromiumClientSession::Observer implementation | 87 // QuicChromiumClientSession::Observer implementation |
86 void OnCryptoHandshakeConfirmed() override; | 88 void OnCryptoHandshakeConfirmed() override; |
| 89 void OnSuccessfulVersionNegotiation(const QuicVersion& version) override; |
87 void OnSessionClosed(int error, bool port_migration_detected) override; | 90 void OnSessionClosed(int error, bool port_migration_detected) override; |
88 | 91 |
89 // QuicClientPushPromiseIndex::Delegate implementation | 92 // QuicClientPushPromiseIndex::Delegate implementation |
90 bool CheckVary(const SpdyHeaderBlock& client_request, | 93 bool CheckVary(const SpdyHeaderBlock& client_request, |
91 const SpdyHeaderBlock& promise_request, | 94 const SpdyHeaderBlock& promise_request, |
92 const SpdyHeaderBlock& promise_response) override; | 95 const SpdyHeaderBlock& promise_response) override; |
93 void OnRendezvousResult(QuicSpdyStream* stream) override; | 96 void OnRendezvousResult(QuicSpdyStream* stream) override; |
94 | 97 |
| 98 static HttpResponseInfo::ConnectionInfo ConnectionInfoFromQuicVersion( |
| 99 QuicVersion quic_version); |
| 100 |
95 private: | 101 private: |
96 friend class test::QuicHttpStreamPeer; | 102 friend class test::QuicHttpStreamPeer; |
97 | 103 |
98 enum State { | 104 enum State { |
99 STATE_NONE, | 105 STATE_NONE, |
100 STATE_HANDLE_PROMISE, | 106 STATE_HANDLE_PROMISE, |
101 STATE_HANDLE_PROMISE_COMPLETE, | 107 STATE_HANDLE_PROMISE_COMPLETE, |
102 STATE_REQUEST_STREAM, | 108 STATE_REQUEST_STREAM, |
103 STATE_REQUEST_STREAM_COMPLETE, | 109 STATE_REQUEST_STREAM_COMPLETE, |
104 STATE_SET_REQUEST_PRIORITY, | 110 STATE_SET_REQUEST_PRIORITY, |
(...skipping 29 matching lines...) Expand all Loading... |
134 int ProcessResponseHeaders(const SpdyHeaderBlock& headers); | 140 int ProcessResponseHeaders(const SpdyHeaderBlock& headers); |
135 | 141 |
136 int ReadAvailableData(IOBuffer* buf, int buf_len); | 142 int ReadAvailableData(IOBuffer* buf, int buf_len); |
137 void EnterStateSendHeaders(); | 143 void EnterStateSendHeaders(); |
138 | 144 |
139 void ResetStream(); | 145 void ResetStream(); |
140 | 146 |
141 State next_state_; | 147 State next_state_; |
142 | 148 |
143 base::WeakPtr<QuicChromiumClientSession> session_; | 149 base::WeakPtr<QuicChromiumClientSession> session_; |
| 150 QuicVersion quic_version_; |
144 int session_error_; // Error code from the connection shutdown. | 151 int session_error_; // Error code from the connection shutdown. |
145 bool was_handshake_confirmed_; // True if the crypto handshake succeeded. | 152 bool was_handshake_confirmed_; // True if the crypto handshake succeeded. |
146 QuicChromiumClientSession::StreamRequest stream_request_; | 153 QuicChromiumClientSession::StreamRequest stream_request_; |
147 QuicChromiumClientStream* stream_; // Non-owning. | 154 QuicChromiumClientStream* stream_; // Non-owning. |
148 | 155 |
149 // The following three fields are all owned by the caller and must | 156 // The following three fields are all owned by the caller and must |
150 // outlive this object, according to the HttpStream contract. | 157 // outlive this object, according to the HttpStream contract. |
151 | 158 |
152 // The request to send. | 159 // The request to send. |
153 // Only valid before the response body is read. | 160 // Only valid before the response body is read. |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 LoadTimingInfo::ConnectTiming connect_timing_; | 233 LoadTimingInfo::ConnectTiming connect_timing_; |
227 | 234 |
228 base::WeakPtrFactory<QuicHttpStream> weak_factory_; | 235 base::WeakPtrFactory<QuicHttpStream> weak_factory_; |
229 | 236 |
230 DISALLOW_COPY_AND_ASSIGN(QuicHttpStream); | 237 DISALLOW_COPY_AND_ASSIGN(QuicHttpStream); |
231 }; | 238 }; |
232 | 239 |
233 } // namespace net | 240 } // namespace net |
234 | 241 |
235 #endif // NET_QUIC_QUIC_HTTP_STREAM_H_ | 242 #endif // NET_QUIC_QUIC_HTTP_STREAM_H_ |
OLD | NEW |