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

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

Issue 2948143002: Add an async method to QuicChromiumClientSession::Handle for (Closed)
Patch Set: cleanup 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 17 matching lines...) Expand all
28 28
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 : public MultiplexedHttpStream {
39 : public QuicClientPushPromiseIndex::Delegate,
40 public MultiplexedHttpStream {
41 public: 39 public:
42 explicit QuicHttpStream( 40 explicit QuicHttpStream(
43 std::unique_ptr<QuicChromiumClientSession::Handle> session); 41 std::unique_ptr<QuicChromiumClientSession::Handle> session);
44 42
45 ~QuicHttpStream() override; 43 ~QuicHttpStream() override;
46 44
47 // HttpStream implementation. 45 // HttpStream implementation.
48 int InitializeStream(const HttpRequestInfo* request_info, 46 int InitializeStream(const HttpRequestInfo* request_info,
49 RequestPriority priority, 47 RequestPriority priority,
50 const NetLogWithSource& net_log, 48 const NetLogWithSource& net_log,
51 const CompletionCallback& callback) override; 49 const CompletionCallback& callback) override;
52 int SendRequest(const HttpRequestHeaders& request_headers, 50 int SendRequest(const HttpRequestHeaders& request_headers,
53 HttpResponseInfo* response, 51 HttpResponseInfo* response,
54 const CompletionCallback& callback) override; 52 const CompletionCallback& callback) override;
55 int ReadResponseHeaders(const CompletionCallback& callback) override; 53 int ReadResponseHeaders(const CompletionCallback& callback) override;
56 int ReadResponseBody(IOBuffer* buf, 54 int ReadResponseBody(IOBuffer* buf,
57 int buf_len, 55 int buf_len,
58 const CompletionCallback& callback) override; 56 const CompletionCallback& callback) override;
59 void Close(bool not_reusable) override; 57 void Close(bool not_reusable) override;
60 bool IsResponseBodyComplete() const override; 58 bool IsResponseBodyComplete() const override;
61 bool IsConnectionReused() const override; 59 bool IsConnectionReused() const override;
62 int64_t GetTotalReceivedBytes() const override; 60 int64_t GetTotalReceivedBytes() const override;
63 int64_t GetTotalSentBytes() const override; 61 int64_t GetTotalSentBytes() const override;
64 bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const override; 62 bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const override;
65 bool GetAlternativeService( 63 bool GetAlternativeService(
66 AlternativeService* alternative_service) const override; 64 AlternativeService* alternative_service) const override;
67 void PopulateNetErrorDetails(NetErrorDetails* details) override; 65 void PopulateNetErrorDetails(NetErrorDetails* details) override;
68 void SetPriority(RequestPriority priority) override; 66 void SetPriority(RequestPriority priority) override;
69 67
70 // QuicClientPushPromiseIndex::Delegate implementation
71 bool CheckVary(const SpdyHeaderBlock& client_request,
72 const SpdyHeaderBlock& promise_request,
73 const SpdyHeaderBlock& promise_response) override;
74 // TODO(rch): QuicClientPushPromiseIndex::Delegate is part of shared code.
75 // Figure out how to make the QuicHttpStream receive a Handle in this
76 // case instead of a QuicSpdyStream.
77 void OnRendezvousResult(QuicSpdyStream* stream) override;
78
79 static HttpResponseInfo::ConnectionInfo ConnectionInfoFromQuicVersion( 68 static HttpResponseInfo::ConnectionInfo ConnectionInfoFromQuicVersion(
80 QuicVersion quic_version); 69 QuicVersion quic_version);
81 70
82 private: 71 private:
83 friend class test::QuicHttpStreamPeer; 72 friend class test::QuicHttpStreamPeer;
84 73
85 enum State { 74 enum State {
86 STATE_NONE, 75 STATE_NONE,
87 STATE_HANDLE_PROMISE, 76 STATE_HANDLE_PROMISE,
88 STATE_HANDLE_PROMISE_COMPLETE, 77 STATE_HANDLE_PROMISE_COMPLETE,
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 // Temporary buffer used to read the request body from UploadDataStream. 199 // Temporary buffer used to read the request body from UploadDataStream.
211 scoped_refptr<IOBufferWithSize> raw_request_body_buf_; 200 scoped_refptr<IOBufferWithSize> raw_request_body_buf_;
212 // Wraps raw_request_body_buf_ to read the remaining data progressively. 201 // Wraps raw_request_body_buf_ to read the remaining data progressively.
213 scoped_refptr<DrainableIOBuffer> request_body_buf_; 202 scoped_refptr<DrainableIOBuffer> request_body_buf_;
214 203
215 NetLogWithSource stream_net_log_; 204 NetLogWithSource stream_net_log_;
216 205
217 int session_error_; // Error code from the connection shutdown. 206 int session_error_; // Error code from the connection shutdown.
218 207
219 bool found_promise_; 208 bool found_promise_;
220 // |QuicClientPromisedInfo| owns this. It will be set when |Try()|
221 // is asynchronous, i.e. it returned QUIC_PENDING, and remains valid
222 // until |OnRendezvouResult()| fires or |push_handle_->Cancel()| is
223 // invoked.
224 QuicClientPushPromiseIndex::TryHandle* push_handle_;
225 209
226 // Set to true when DoLoop() is being executed, false otherwise. 210 // Set to true when DoLoop() is being executed, false otherwise.
227 bool in_loop_; 211 bool in_loop_;
228 212
229 // Session connect timing info. 213 // Session connect timing info.
230 LoadTimingInfo::ConnectTiming connect_timing_; 214 LoadTimingInfo::ConnectTiming connect_timing_;
231 215
232 base::WeakPtrFactory<QuicHttpStream> weak_factory_; 216 base::WeakPtrFactory<QuicHttpStream> weak_factory_;
233 217
234 DISALLOW_COPY_AND_ASSIGN(QuicHttpStream); 218 DISALLOW_COPY_AND_ASSIGN(QuicHttpStream);
235 }; 219 };
236 220
237 } // namespace net 221 } // namespace net
238 222
239 #endif // NET_QUIC_CHROMIUM_QUIC_HTTP_STREAM_H_ 223 #endif // NET_QUIC_CHROMIUM_QUIC_HTTP_STREAM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698