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

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: review feedback round 2. Created 4 years, 9 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
« no previous file with comments | « net/quic/quic_client_session_base.h ('k') | net/quic/quic_http_stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_REQUEST_STREAM,
96 STATE_SET_REQUEST_PRIORITY,
87 STATE_SEND_HEADERS, 97 STATE_SEND_HEADERS,
88 STATE_SEND_HEADERS_COMPLETE, 98 STATE_SEND_HEADERS_COMPLETE,
89 STATE_READ_REQUEST_BODY, 99 STATE_READ_REQUEST_BODY,
90 STATE_READ_REQUEST_BODY_COMPLETE, 100 STATE_READ_REQUEST_BODY_COMPLETE,
91 STATE_SEND_BODY, 101 STATE_SEND_BODY,
92 STATE_SEND_BODY_COMPLETE, 102 STATE_SEND_BODY_COMPLETE,
93 STATE_OPEN, 103 STATE_OPEN,
94 }; 104 };
95 105
96 void OnStreamReady(int rv); 106 void OnStreamReady(int rv);
97 void OnIOComplete(int rv); 107 void OnIOComplete(int rv);
98 void DoCallback(int rv); 108 void DoCallback(int rv);
99 109
100 int DoLoop(int); 110 int DoLoop(int);
111 int DoStreamRequest();
112 int DoSetRequestPriority();
101 int DoSendHeaders(); 113 int DoSendHeaders();
102 int DoSendHeadersComplete(int rv); 114 int DoSendHeadersComplete(int rv);
103 int DoReadRequestBody(); 115 int DoReadRequestBody();
104 int DoReadRequestBodyComplete(int rv); 116 int DoReadRequestBodyComplete(int rv);
105 int DoSendBody(); 117 int DoSendBody();
106 int DoSendBodyComplete(int rv); 118 int DoSendBodyComplete(int rv);
107 int DoReadResponseHeaders(); 119 int DoReadResponseHeaders();
108 int DoReadResponseHeadersComplete(int rv); 120 int DoReadResponseHeadersComplete(int rv);
109 121
110 int ProcessResponseHeaders(const SpdyHeaderBlock& headers); 122 int ProcessResponseHeaders(const SpdyHeaderBlock& headers);
111 123
112 int ReadAvailableData(IOBuffer* buf, int buf_len); 124 int ReadAvailableData(IOBuffer* buf, int buf_len);
125 void EnterStateSendHeaders();
126 int HandlePromise();
113 127
114 void ResetStream(); 128 void ResetStream();
129 bool CancelPromiseIfHasBody();
115 130
116 State next_state_; 131 State next_state_;
117 132
118 base::WeakPtr<QuicChromiumClientSession> session_; 133 base::WeakPtr<QuicChromiumClientSession> session_;
119 int session_error_; // Error code from the connection shutdown. 134 int session_error_; // Error code from the connection shutdown.
120 bool was_handshake_confirmed_; // True if the crypto handshake succeeded. 135 bool was_handshake_confirmed_; // True if the crypto handshake succeeded.
121 QuicChromiumClientSession::StreamRequest stream_request_; 136 QuicChromiumClientSession::StreamRequest stream_request_;
122 QuicChromiumClientStream* stream_; // Non-owning. 137 QuicChromiumClientStream* stream_; // Non-owning.
123 138
124 // The following three fields are all owned by the caller and must 139 // The following three fields are all owned by the caller and must
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 BoundNetLog stream_net_log_; 189 BoundNetLog stream_net_log_;
175 190
176 QuicErrorCode quic_connection_error_; 191 QuicErrorCode quic_connection_error_;
177 192
178 // SSLInfo from the underlying QuicSession. 193 // SSLInfo from the underlying QuicSession.
179 SSLInfo ssl_info_; 194 SSLInfo ssl_info_;
180 195
181 // TODO(rtenneti): Temporary until crbug.com/585591 is solved. 196 // TODO(rtenneti): Temporary until crbug.com/585591 is solved.
182 bool read_in_progress_ = false; 197 bool read_in_progress_ = false;
183 198
199 bool found_promise_;
200 // |QuicClientPromisedInfo| owns this. It will be set when |Try()|
201 // is asynchronous, i.e. it returned QUIC_PENDING, and remains valid
202 // until |OnRendezvouResult()| fires or |push_handle_->Cancel()| is
203 // invoked.
204 QuicClientPushPromiseIndex::TryHandle* push_handle_;
205
184 base::WeakPtrFactory<QuicHttpStream> weak_factory_; 206 base::WeakPtrFactory<QuicHttpStream> weak_factory_;
185 207
186 DISALLOW_COPY_AND_ASSIGN(QuicHttpStream); 208 DISALLOW_COPY_AND_ASSIGN(QuicHttpStream);
187 }; 209 };
188 210
189 } // namespace net 211 } // namespace net
190 212
191 #endif // NET_QUIC_QUIC_HTTP_STREAM_H_ 213 #endif // NET_QUIC_QUIC_HTTP_STREAM_H_
OLDNEW
« no previous file with comments | « net/quic/quic_client_session_base.h ('k') | net/quic/quic_http_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698