Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(989)

Side by Side Diff: net/quic/quic_http_stream.h

Issue 1692253004: QUIC - chromium server push support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Initial for-review version Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_chromium_client_stream.h" 18 #include "net/quic/quic_chromium_client_stream.h"
19 #include "net/quic/quic_client_push_promise_index.h"
19 20
20 namespace net { 21 namespace net {
21 22
22 namespace test { 23 namespace test {
23 class QuicHttpStreamPeer; 24 class QuicHttpStreamPeer;
24 } // namespace test 25 } // namespace test
25 26
26 // The QuicHttpStream is a QUIC-specific HttpStream subclass. It holds a 27 // The QuicHttpStream is a QUIC-specific HttpStream subclass. It holds a
27 // non-owning pointer to a QuicChromiumClientStream which it uses to 28 // non-owning pointer to a QuicChromiumClientStream which it uses to
28 // send and receive data. 29 // send and receive data.
29 class NET_EXPORT_PRIVATE QuicHttpStream 30 class NET_EXPORT_PRIVATE QuicHttpStream
30 : public QuicChromiumClientSession::Observer, 31 : public QuicChromiumClientSession::Observer,
31 public QuicChromiumClientStream::Delegate, 32 public QuicChromiumClientStream::Delegate,
33 public QuicClientPushPromiseIndex::Delegate,
32 public HttpStream { 34 public HttpStream {
33 public: 35 public:
34 explicit QuicHttpStream( 36 explicit QuicHttpStream(
35 const base::WeakPtr<QuicChromiumClientSession>& session); 37 const base::WeakPtr<QuicChromiumClientSession>& session);
36 38
37 ~QuicHttpStream() override; 39 ~QuicHttpStream() override;
38 40
39 // HttpStream implementation. 41 // HttpStream implementation.
40 int InitializeStream(const HttpRequestInfo* request_info, 42 int InitializeStream(const HttpRequestInfo* request_info,
41 RequestPriority priority, 43 RequestPriority priority,
(...skipping 30 matching lines...) Expand all
72 size_t frame_len) override; 74 size_t frame_len) override;
73 void OnDataAvailable() override; 75 void OnDataAvailable() override;
74 void OnClose(QuicErrorCode error) override; 76 void OnClose(QuicErrorCode error) override;
75 void OnError(int error) override; 77 void OnError(int error) override;
76 bool HasSendHeadersComplete() override; 78 bool HasSendHeadersComplete() override;
77 79
78 // QuicChromiumClientSession::Observer implementation 80 // QuicChromiumClientSession::Observer implementation
79 void OnCryptoHandshakeConfirmed() override; 81 void OnCryptoHandshakeConfirmed() override;
80 void OnSessionClosed(int error) override; 82 void OnSessionClosed(int error) override;
81 83
84 // QuicClientPushPromiseIndex::Delegate implementation
85 bool CheckVary(const SpdyHeaderBlock& client_request,
86 const SpdyHeaderBlock& promise_request,
87 const SpdyHeaderBlock& promise_response) override;
88 void OnRendezvousResult(QuicSpdyStream* stream) override;
89
82 private: 90 private:
83 friend class test::QuicHttpStreamPeer; 91 friend class test::QuicHttpStreamPeer;
84 92
85 enum State { 93 enum State {
86 STATE_NONE, 94 STATE_NONE,
95 STATE_STREAM_REQUEST,
Ryan Hamilton 2016/02/24 00:34:00 Perhaps this should be STATE_REQUEST_STREAM to be
Buck 2016/02/26 23:54:16 Done.
87 STATE_SEND_HEADERS, 96 STATE_SEND_HEADERS,
88 STATE_SEND_HEADERS_COMPLETE, 97 STATE_SEND_HEADERS_COMPLETE,
89 STATE_READ_REQUEST_BODY, 98 STATE_READ_REQUEST_BODY,
90 STATE_READ_REQUEST_BODY_COMPLETE, 99 STATE_READ_REQUEST_BODY_COMPLETE,
91 STATE_SEND_BODY, 100 STATE_SEND_BODY,
92 STATE_SEND_BODY_COMPLETE, 101 STATE_SEND_BODY_COMPLETE,
93 STATE_OPEN, 102 STATE_OPEN,
94 }; 103 };
95 104
96 void OnStreamReady(int rv); 105 void OnStreamReady(int rv);
97 void OnIOComplete(int rv); 106 void OnIOComplete(int rv);
98 void DoCallback(int rv); 107 void DoCallback(int rv);
99 108
100 int DoLoop(int); 109 int DoLoop(int);
110 int DoStreamRequest();
101 int DoSendHeaders(); 111 int DoSendHeaders();
102 int DoSendHeadersComplete(int rv); 112 int DoSendHeadersComplete(int rv);
103 int DoReadRequestBody(); 113 int DoReadRequestBody();
104 int DoReadRequestBodyComplete(int rv); 114 int DoReadRequestBodyComplete(int rv);
105 int DoSendBody(); 115 int DoSendBody();
106 int DoSendBodyComplete(int rv); 116 int DoSendBodyComplete(int rv);
107 int DoReadResponseHeaders(); 117 int DoReadResponseHeaders();
108 int DoReadResponseHeadersComplete(int rv); 118 int DoReadResponseHeadersComplete(int rv);
109 119
110 int ProcessResponseHeaders(const SpdyHeaderBlock& headers); 120 int ProcessResponseHeaders(const SpdyHeaderBlock& headers);
111 121
112 int ReadAvailableData(IOBuffer* buf, int buf_len); 122 int ReadAvailableData(IOBuffer* buf, int buf_len);
123 void EnterStateSendHeaders();
124 int HandlePromise();
113 125
114 void ResetStream(); 126 void ResetStream();
115 127
128 void ConvertHeaderBlockToHttpRequestHeaders(
129 const SpdyHeaderBlock& spdy_headers,
130 HttpRequestHeaders* http_headers);
Ryan Hamilton 2016/02/24 00:34:00 Consider adding this method to: net/spdy/spdy_htt
Buck 2016/02/26 23:54:16 Done.
131
116 State next_state_; 132 State next_state_;
117 133
118 base::WeakPtr<QuicChromiumClientSession> session_; 134 base::WeakPtr<QuicChromiumClientSession> session_;
119 int session_error_; // Error code from the connection shutdown. 135 int session_error_; // Error code from the connection shutdown.
120 bool was_handshake_confirmed_; // True if the crypto handshake succeeded. 136 bool was_handshake_confirmed_; // True if the crypto handshake succeeded.
121 QuicChromiumClientSession::StreamRequest stream_request_; 137 QuicChromiumClientSession::StreamRequest stream_request_;
122 QuicChromiumClientStream* stream_; // Non-owning. 138 QuicChromiumClientStream* stream_; // Non-owning.
123 139
124 // The following three fields are all owned by the caller and must 140 // The following three fields are all owned by the caller and must
125 // outlive this object, according to the HttpStream contract. 141 // outlive this object, according to the HttpStream contract.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 BoundNetLog stream_net_log_; 190 BoundNetLog stream_net_log_;
175 191
176 QuicErrorCode quic_connection_error_; 192 QuicErrorCode quic_connection_error_;
177 193
178 // SSLInfo from the underlying QuicSession. 194 // SSLInfo from the underlying QuicSession.
179 SSLInfo ssl_info_; 195 SSLInfo ssl_info_;
180 196
181 // TODO(rtenneti): Temporary until crbug.com/585591 is solved. 197 // TODO(rtenneti): Temporary until crbug.com/585591 is solved.
182 bool read_in_progress_ = false; 198 bool read_in_progress_ = false;
183 199
200 bool found_promise_;
201 QuicClientPushPromiseIndex::TryHandle* push_handle_;
Ryan Hamilton 2016/02/24 00:34:00 Can you comment on ownership of this object, and u
Buck 2016/02/26 23:54:16 Done.
202
184 base::WeakPtrFactory<QuicHttpStream> weak_factory_; 203 base::WeakPtrFactory<QuicHttpStream> weak_factory_;
185 204
186 DISALLOW_COPY_AND_ASSIGN(QuicHttpStream); 205 DISALLOW_COPY_AND_ASSIGN(QuicHttpStream);
187 }; 206 };
188 207
189 } // namespace net 208 } // namespace net
190 209
191 #endif // NET_QUIC_QUIC_HTTP_STREAM_H_ 210 #endif // NET_QUIC_QUIC_HTTP_STREAM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698