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

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

Issue 2334943002: Add a new QuicChromiumClientSession::Handle class (Closed)
Patch Set: cleanup Created 3 years, 7 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_CHROMIUM_QUIC_HTTP_STREAM_H_ 5 #ifndef NET_QUIC_CHROMIUM_QUIC_HTTP_STREAM_H_
6 #define NET_QUIC_CHROMIUM_QUIC_HTTP_STREAM_H_ 6 #define NET_QUIC_CHROMIUM_QUIC_HTTP_STREAM_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 18 matching lines...) Expand all
29 namespace net { 29 namespace net {
30 30
31 namespace test { 31 namespace test {
32 class QuicHttpStreamPeer; 32 class QuicHttpStreamPeer;
33 } // namespace test 33 } // namespace test
34 34
35 // The QuicHttpStream is a QUIC-specific HttpStream subclass. It holds a 35 // The QuicHttpStream is a QUIC-specific HttpStream subclass. It holds a
36 // non-owning pointer to a QuicChromiumClientStream which it uses to 36 // non-owning pointer to a QuicChromiumClientStream which it uses to
37 // send and receive data. 37 // send and receive data.
38 class NET_EXPORT_PRIVATE QuicHttpStream 38 class NET_EXPORT_PRIVATE QuicHttpStream
39 : public QuicChromiumClientSession::Observer, 39 : public QuicChromiumClientStream::Delegate,
40 public QuicChromiumClientStream::Delegate,
41 public QuicClientPushPromiseIndex::Delegate, 40 public QuicClientPushPromiseIndex::Delegate,
42 public MultiplexedHttpStream { 41 public MultiplexedHttpStream {
43 public: 42 public:
44 QuicHttpStream(const base::WeakPtr<QuicChromiumClientSession>& session, 43 QuicHttpStream(QuicChromiumClientSession::Handle session,
45 HttpServerProperties* http_server_properties); 44 HttpServerProperties* http_server_properties);
46 45
47 ~QuicHttpStream() override; 46 ~QuicHttpStream() override;
48 47
49 // HttpStream implementation. 48 // HttpStream implementation.
50 int InitializeStream(const HttpRequestInfo* request_info, 49 int InitializeStream(const HttpRequestInfo* request_info,
51 RequestPriority priority, 50 RequestPriority priority,
52 const NetLogWithSource& net_log, 51 const NetLogWithSource& net_log,
53 const CompletionCallback& callback) override; 52 const CompletionCallback& callback) override;
54 int SendRequest(const HttpRequestHeaders& request_headers, 53 int SendRequest(const HttpRequestHeaders& request_headers,
(...skipping 15 matching lines...) Expand all
70 void SetPriority(RequestPriority priority) override; 69 void SetPriority(RequestPriority priority) override;
71 70
72 // QuicChromiumClientStream::Delegate implementation 71 // QuicChromiumClientStream::Delegate implementation
73 void OnHeadersAvailable(const SpdyHeaderBlock& headers, 72 void OnHeadersAvailable(const SpdyHeaderBlock& headers,
74 size_t frame_len) override; 73 size_t frame_len) override;
75 void OnDataAvailable() override; 74 void OnDataAvailable() override;
76 void OnClose() override; 75 void OnClose() override;
77 void OnError(int error) override; 76 void OnError(int error) override;
78 bool HasSendHeadersComplete() override; 77 bool HasSendHeadersComplete() override;
79 78
80 // QuicChromiumClientSession::Observer implementation
81 void OnCryptoHandshakeConfirmed() override;
82 void OnSuccessfulVersionNegotiation(const QuicVersion& version) override;
83 void OnSessionClosed(int error, bool port_migration_detected) override;
84
85 // QuicClientPushPromiseIndex::Delegate implementation 79 // QuicClientPushPromiseIndex::Delegate implementation
86 bool CheckVary(const SpdyHeaderBlock& client_request, 80 bool CheckVary(const SpdyHeaderBlock& client_request,
87 const SpdyHeaderBlock& promise_request, 81 const SpdyHeaderBlock& promise_request,
88 const SpdyHeaderBlock& promise_response) override; 82 const SpdyHeaderBlock& promise_response) override;
89 void OnRendezvousResult(QuicSpdyStream* stream) override; 83 void OnRendezvousResult(QuicSpdyStream* stream) override;
90 84
91 static HttpResponseInfo::ConnectionInfo ConnectionInfoFromQuicVersion( 85 static HttpResponseInfo::ConnectionInfo ConnectionInfoFromQuicVersion(
92 QuicVersion quic_version); 86 QuicVersion quic_version);
93 87
94 private: 88 private:
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 void SaveResponseStatus(); 134 void SaveResponseStatus();
141 // Sets |response_status_| to |response_status| and sets 135 // Sets |response_status_| to |response_status| and sets
142 // |has_response_status_| to true. 136 // |has_response_status_| to true.
143 void SetResponseStatus(int response_status); 137 void SetResponseStatus(int response_status);
144 // Computes the correct response status based on the status of the handshake, 138 // Computes the correct response status based on the status of the handshake,
145 // |session_error|, |connection_error| and |stream_error|. 139 // |session_error|, |connection_error| and |stream_error|.
146 int ComputeResponseStatus() const; 140 int ComputeResponseStatus() const;
147 141
148 State next_state_; 142 State next_state_;
149 143
150 base::WeakPtr<QuicChromiumClientSession> session_; 144 QuicChromiumClientSession::Handle session_;
151 const QuicServerId server_id_; // The ID of the QUIC server for this stream.
152 145
153 HttpServerProperties* http_server_properties_; // Unowned. 146 HttpServerProperties* http_server_properties_; // Unowned.
154 147
155 QuicVersion quic_version_;
156 int session_error_; // Error code from the connection shutdown.
157 bool was_handshake_confirmed_; // True if the crypto handshake succeeded.
158 std::unique_ptr<QuicChromiumClientSession::StreamRequest> stream_request_; 148 std::unique_ptr<QuicChromiumClientSession::StreamRequest> stream_request_;
159 QuicChromiumClientStream* stream_; // Non-owning. 149 QuicChromiumClientStream* stream_; // Non-owning.
160 150
161 // The following three fields are all owned by the caller and must 151 // The following three fields are all owned by the caller and must
162 // outlive this object, according to the HttpStream contract. 152 // outlive this object, according to the HttpStream contract.
163 153
164 // The request to send. 154 // The request to send.
165 // Only valid before the response body is read. 155 // Only valid before the response body is read.
166 const HttpRequestInfo* request_info_; 156 const HttpRequestInfo* request_info_;
167 157
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 scoped_refptr<IOBuffer> user_buffer_; 197 scoped_refptr<IOBuffer> user_buffer_;
208 int user_buffer_len_; 198 int user_buffer_len_;
209 199
210 // Temporary buffer used to read the request body from UploadDataStream. 200 // Temporary buffer used to read the request body from UploadDataStream.
211 scoped_refptr<IOBufferWithSize> raw_request_body_buf_; 201 scoped_refptr<IOBufferWithSize> raw_request_body_buf_;
212 // Wraps raw_request_body_buf_ to read the remaining data progressively. 202 // Wraps raw_request_body_buf_ to read the remaining data progressively.
213 scoped_refptr<DrainableIOBuffer> request_body_buf_; 203 scoped_refptr<DrainableIOBuffer> request_body_buf_;
214 204
215 NetLogWithSource stream_net_log_; 205 NetLogWithSource stream_net_log_;
216 206
207 int session_error_; // Error code from the connection shutdown.
217 QuicErrorCode quic_connection_error_; // Cached connection error code. 208 QuicErrorCode quic_connection_error_; // Cached connection error code.
218 QuicRstStreamErrorCode quic_stream_error_; // Cached stream error code. 209 QuicRstStreamErrorCode quic_stream_error_; // Cached stream error code.
219 210
220 // True when this stream receives a go away from server due to port migration.
221 bool port_migration_detected_;
222
223 bool found_promise_; 211 bool found_promise_;
224 // |QuicClientPromisedInfo| owns this. It will be set when |Try()| 212 // |QuicClientPromisedInfo| owns this. It will be set when |Try()|
225 // is asynchronous, i.e. it returned QUIC_PENDING, and remains valid 213 // is asynchronous, i.e. it returned QUIC_PENDING, and remains valid
226 // until |OnRendezvouResult()| fires or |push_handle_->Cancel()| is 214 // until |OnRendezvouResult()| fires or |push_handle_->Cancel()| is
227 // invoked. 215 // invoked.
228 QuicClientPushPromiseIndex::TryHandle* push_handle_; 216 QuicClientPushPromiseIndex::TryHandle* push_handle_;
229 217
230 // Set to true when DoLoop() is being executed, false otherwise. 218 // Set to true when DoLoop() is being executed, false otherwise.
231 bool in_loop_; 219 bool in_loop_;
232 220
233 // Session connect timing info. 221 // Session connect timing info.
234 LoadTimingInfo::ConnectTiming connect_timing_; 222 LoadTimingInfo::ConnectTiming connect_timing_;
235 223
236 base::WeakPtrFactory<QuicHttpStream> weak_factory_; 224 base::WeakPtrFactory<QuicHttpStream> weak_factory_;
237 225
238 DISALLOW_COPY_AND_ASSIGN(QuicHttpStream); 226 DISALLOW_COPY_AND_ASSIGN(QuicHttpStream);
239 }; 227 };
240 228
241 } // namespace net 229 } // namespace net
242 230
243 #endif // NET_QUIC_CHROMIUM_QUIC_HTTP_STREAM_H_ 231 #endif // NET_QUIC_CHROMIUM_QUIC_HTTP_STREAM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698