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

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

Issue 2908243002: Remove QuicChromiumClientStream::Delegate in favor of async methods. (Closed)
Patch Set: No expect_trailers_ Created 3 years, 6 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 QuicChromiumClientStream::Delegate, 39 : public QuicClientPushPromiseIndex::Delegate,
40 public QuicClientPushPromiseIndex::Delegate,
41 public MultiplexedHttpStream { 40 public MultiplexedHttpStream {
42 public: 41 public:
43 explicit QuicHttpStream( 42 explicit QuicHttpStream(
44 std::unique_ptr<QuicChromiumClientSession::Handle> session); 43 std::unique_ptr<QuicChromiumClientSession::Handle> session);
45 44
46 ~QuicHttpStream() override; 45 ~QuicHttpStream() override;
47 46
48 // HttpStream implementation. 47 // HttpStream implementation.
49 int InitializeStream(const HttpRequestInfo* request_info, 48 int InitializeStream(const HttpRequestInfo* request_info,
50 RequestPriority priority, 49 RequestPriority priority,
(...skipping 10 matching lines...) Expand all
61 bool IsResponseBodyComplete() const override; 60 bool IsResponseBodyComplete() const override;
62 bool IsConnectionReused() const override; 61 bool IsConnectionReused() const override;
63 int64_t GetTotalReceivedBytes() const override; 62 int64_t GetTotalReceivedBytes() const override;
64 int64_t GetTotalSentBytes() const override; 63 int64_t GetTotalSentBytes() const override;
65 bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const override; 64 bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const override;
66 bool GetAlternativeService( 65 bool GetAlternativeService(
67 AlternativeService* alternative_service) const override; 66 AlternativeService* alternative_service) const override;
68 void PopulateNetErrorDetails(NetErrorDetails* details) override; 67 void PopulateNetErrorDetails(NetErrorDetails* details) override;
69 void SetPriority(RequestPriority priority) override; 68 void SetPriority(RequestPriority priority) override;
70 69
71 // QuicChromiumClientStream::Delegate implementation
72 void OnClose() override;
73 void OnError(int error) override;
74
75 // QuicClientPushPromiseIndex::Delegate implementation 70 // QuicClientPushPromiseIndex::Delegate implementation
76 bool CheckVary(const SpdyHeaderBlock& client_request, 71 bool CheckVary(const SpdyHeaderBlock& client_request,
77 const SpdyHeaderBlock& promise_request, 72 const SpdyHeaderBlock& promise_request,
78 const SpdyHeaderBlock& promise_response) override; 73 const SpdyHeaderBlock& promise_response) override;
79 // TODO(rch): QuicClientPushPromiseIndex::Delegate is part of shared code. 74 // TODO(rch): QuicClientPushPromiseIndex::Delegate is part of shared code.
80 // Figure out how to make the QuicHttpStream receive a Handle in this 75 // Figure out how to make the QuicHttpStream receive a Handle in this
81 // case instead of a QuicSpdyStream. 76 // case instead of a QuicSpdyStream.
82 void OnRendezvousResult(QuicSpdyStream* stream) override; 77 void OnRendezvousResult(QuicSpdyStream* stream) override;
83 78
84 static HttpResponseInfo::ConnectionInfo ConnectionInfoFromQuicVersion( 79 static HttpResponseInfo::ConnectionInfo ConnectionInfoFromQuicVersion(
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 void ReadTrailingHeaders(); 119 void ReadTrailingHeaders();
125 void OnReadTrailingHeadersComplete(int rv); 120 void OnReadTrailingHeadersComplete(int rv);
126 121
127 void OnReadBodyComplete(int rv); 122 void OnReadBodyComplete(int rv);
128 int HandleReadComplete(int rv); 123 int HandleReadComplete(int rv);
129 124
130 void EnterStateSendHeaders(); 125 void EnterStateSendHeaders();
131 126
132 void ResetStream(); 127 void ResetStream();
133 128
129 // Returns ERR_QUIC_HANDSHAKE_FAILED, if |rv| is ERR_QUIC_PROTOCOL_ERROR and
130 // the handshake was never confirmed. Otherwise, returns |rv|.
131 int MapStreamError(int rv);
132
134 // If |has_response_status_| is false, sets |response_status| to the result 133 // If |has_response_status_| is false, sets |response_status| to the result
135 // of ComputeResponseStatus(). Returns |response_status_|. 134 // of ComputeResponseStatus(). Returns |response_status_|.
136 int GetResponseStatus(); 135 int GetResponseStatus();
137 // Sets the result of |ComputeResponseStatus()| as the |response_status_|. 136 // Sets the result of |ComputeResponseStatus()| as the |response_status_|.
138 void SaveResponseStatus(); 137 void SaveResponseStatus();
139 // Sets |response_status_| to |response_status| and sets 138 // Sets |response_status_| to |response_status| and sets
140 // |has_response_status_| to true. 139 // |has_response_status_| to true.
141 void SetResponseStatus(int response_status); 140 void SetResponseStatus(int response_status);
142 // Computes the correct response status based on the status of the handshake, 141 // Computes the correct response status based on the status of the handshake,
143 // |session_error|, |connection_error| and |stream_error|. 142 // |session_error|, |connection_error| and |stream_error|.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 int user_buffer_len_; 208 int user_buffer_len_;
210 209
211 // Temporary buffer used to read the request body from UploadDataStream. 210 // Temporary buffer used to read the request body from UploadDataStream.
212 scoped_refptr<IOBufferWithSize> raw_request_body_buf_; 211 scoped_refptr<IOBufferWithSize> raw_request_body_buf_;
213 // Wraps raw_request_body_buf_ to read the remaining data progressively. 212 // Wraps raw_request_body_buf_ to read the remaining data progressively.
214 scoped_refptr<DrainableIOBuffer> request_body_buf_; 213 scoped_refptr<DrainableIOBuffer> request_body_buf_;
215 214
216 NetLogWithSource stream_net_log_; 215 NetLogWithSource stream_net_log_;
217 216
218 int session_error_; // Error code from the connection shutdown. 217 int session_error_; // Error code from the connection shutdown.
219 QuicErrorCode quic_connection_error_; // Cached connection error code.
220 QuicRstStreamErrorCode quic_stream_error_; // Cached stream error code.
221 218
222 bool found_promise_; 219 bool found_promise_;
223 // |QuicClientPromisedInfo| owns this. It will be set when |Try()| 220 // |QuicClientPromisedInfo| owns this. It will be set when |Try()|
224 // is asynchronous, i.e. it returned QUIC_PENDING, and remains valid 221 // is asynchronous, i.e. it returned QUIC_PENDING, and remains valid
225 // until |OnRendezvouResult()| fires or |push_handle_->Cancel()| is 222 // until |OnRendezvouResult()| fires or |push_handle_->Cancel()| is
226 // invoked. 223 // invoked.
227 QuicClientPushPromiseIndex::TryHandle* push_handle_; 224 QuicClientPushPromiseIndex::TryHandle* push_handle_;
228 225
229 // Set to true when DoLoop() is being executed, false otherwise. 226 // Set to true when DoLoop() is being executed, false otherwise.
230 bool in_loop_; 227 bool in_loop_;
231 228
232 // Session connect timing info. 229 // Session connect timing info.
233 LoadTimingInfo::ConnectTiming connect_timing_; 230 LoadTimingInfo::ConnectTiming connect_timing_;
234 231
235 base::WeakPtrFactory<QuicHttpStream> weak_factory_; 232 base::WeakPtrFactory<QuicHttpStream> weak_factory_;
236 233
237 DISALLOW_COPY_AND_ASSIGN(QuicHttpStream); 234 DISALLOW_COPY_AND_ASSIGN(QuicHttpStream);
238 }; 235 };
239 236
240 } // namespace net 237 } // namespace net
241 238
242 #endif // NET_QUIC_CHROMIUM_QUIC_HTTP_STREAM_H_ 239 #endif // NET_QUIC_CHROMIUM_QUIC_HTTP_STREAM_H_
OLDNEW
« no previous file with comments | « net/quic/chromium/quic_chromium_client_stream_test.cc ('k') | net/quic/chromium/quic_http_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698