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

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

Issue 2031923006: [Cronet]Make delaying sending request headers explicit in bidirectional stream (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_BIDIRECTIONAL_STREAM_QUIC_IMPL_H_ 5 #ifndef NET_QUIC_BIDIRECTIONAL_STREAM_QUIC_IMPL_H_
6 #define NET_QUIC_BIDIRECTIONAL_STREAM_QUIC_IMPL_H_ 6 #define NET_QUIC_BIDIRECTIONAL_STREAM_QUIC_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 21 matching lines...) Expand all
32 public QuicChromiumClientSession::Observer { 32 public QuicChromiumClientSession::Observer {
33 public: 33 public:
34 explicit BidirectionalStreamQuicImpl( 34 explicit BidirectionalStreamQuicImpl(
35 const base::WeakPtr<QuicChromiumClientSession>& session); 35 const base::WeakPtr<QuicChromiumClientSession>& session);
36 36
37 ~BidirectionalStreamQuicImpl() override; 37 ~BidirectionalStreamQuicImpl() override;
38 38
39 // BidirectionalStreamImpl implementation: 39 // BidirectionalStreamImpl implementation:
40 void Start(const BidirectionalStreamRequestInfo* request_info, 40 void Start(const BidirectionalStreamRequestInfo* request_info,
41 const BoundNetLog& net_log, 41 const BoundNetLog& net_log,
42 bool disable_auto_flush, 42 bool send_request_headers_automatically,
43 BidirectionalStreamImpl::Delegate* delegate, 43 BidirectionalStreamImpl::Delegate* delegate,
44 std::unique_ptr<base::Timer> timer) override; 44 std::unique_ptr<base::Timer> timer) override;
45 void SendRequestHeaders() override;
45 int ReadData(IOBuffer* buffer, int buffer_len) override; 46 int ReadData(IOBuffer* buffer, int buffer_len) override;
46 void SendData(const scoped_refptr<IOBuffer>& data, 47 void SendData(const scoped_refptr<IOBuffer>& data,
47 int length, 48 int length,
48 bool end_stream) override; 49 bool end_stream) override;
49 void SendvData(const std::vector<scoped_refptr<IOBuffer>>& buffers, 50 void SendvData(const std::vector<scoped_refptr<IOBuffer>>& buffers,
50 const std::vector<int>& lengths, 51 const std::vector<int>& lengths,
51 bool end_stream) override; 52 bool end_stream) override;
52 void Cancel() override; 53 void Cancel() override;
53 NextProto GetProtocol() const override; 54 NextProto GetProtocol() const override;
54 int64_t GetTotalReceivedBytes() const override; 55 int64_t GetTotalReceivedBytes() const override;
55 int64_t GetTotalSentBytes() const override; 56 int64_t GetTotalSentBytes() const override;
56 57
57 private: 58 private:
58 // QuicChromiumClientStream::Delegate implementation: 59 // QuicChromiumClientStream::Delegate implementation:
59 void OnHeadersAvailable(const SpdyHeaderBlock& headers, 60 void OnHeadersAvailable(const SpdyHeaderBlock& headers,
60 size_t frame_len) override; 61 size_t frame_len) override;
61 void OnDataAvailable() override; 62 void OnDataAvailable() override;
62 void OnClose(QuicErrorCode error) override; 63 void OnClose(QuicErrorCode error) override;
63 void OnError(int error) override; 64 void OnError(int error) override;
64 bool HasSendHeadersComplete() override; 65 bool HasSendHeadersComplete() override;
65 66
66 // QuicChromiumClientSession::Observer implementation: 67 // QuicChromiumClientSession::Observer implementation:
67 void OnCryptoHandshakeConfirmed() override; 68 void OnCryptoHandshakeConfirmed() override;
68 void OnSessionClosed(int error, bool port_migration_detected) override; 69 void OnSessionClosed(int error, bool port_migration_detected) override;
69 70
70 void OnStreamReady(int rv); 71 void OnStreamReady(int rv);
71 void OnSendDataComplete(int rv); 72 void OnSendDataComplete(int rv);
72 void OnReadDataComplete(int rv); 73 void OnReadDataComplete(int rv);
73 74
74 // Helper method to send request headers.
75 void SendRequestHeaders();
76 // Notifies the delegate of an error. 75 // Notifies the delegate of an error.
77 void NotifyError(int error); 76 void NotifyError(int error);
78 // Resets the stream and ensures that |delegate_| won't be called back. 77 // Resets the stream and ensures that |delegate_| won't be called back.
79 void ResetStream(); 78 void ResetStream();
80 79
81 base::WeakPtr<QuicChromiumClientSession> session_; 80 base::WeakPtr<QuicChromiumClientSession> session_;
82 bool was_handshake_confirmed_; // True if the crypto handshake succeeded. 81 bool was_handshake_confirmed_; // True if the crypto handshake succeeded.
83 QuicChromiumClientSession::StreamRequest stream_request_; 82 QuicChromiumClientSession::StreamRequest stream_request_;
84 QuicChromiumClientStream* stream_; // Non-owning. 83 QuicChromiumClientStream* stream_; // Non-owning.
85 84
(...skipping 18 matching lines...) Expand all
104 // bytes received over the network for |stream_| while it was open. 103 // bytes received over the network for |stream_| while it was open.
105 int64_t closed_stream_received_bytes_; 104 int64_t closed_stream_received_bytes_;
106 // After |stream_| has been closed, this keeps track of the total number of 105 // After |stream_| has been closed, this keeps track of the total number of
107 // bytes sent over the network for |stream_| while it was open. 106 // bytes sent over the network for |stream_| while it was open.
108 int64_t closed_stream_sent_bytes_; 107 int64_t closed_stream_sent_bytes_;
109 // Indicates whether initial headers have been sent. 108 // Indicates whether initial headers have been sent.
110 bool has_sent_headers_; 109 bool has_sent_headers_;
111 // Indicates whether initial headers have been received. 110 // Indicates whether initial headers have been received.
112 bool has_received_headers_; 111 bool has_received_headers_;
113 112
114 bool disable_auto_flush_; 113 // Whether to automatically send request headers when stream is negotiated.
114 // If false, headers will not be sent until SendRequestHeaders() is called or
115 // until next SendData/SendvData, during which QUIC will try to combine header
116 // frame with data frame in the same packet if possible.
117 bool send_request_headers_automatically_;
115 118
116 base::WeakPtrFactory<BidirectionalStreamQuicImpl> weak_factory_; 119 base::WeakPtrFactory<BidirectionalStreamQuicImpl> weak_factory_;
117 120
118 DISALLOW_COPY_AND_ASSIGN(BidirectionalStreamQuicImpl); 121 DISALLOW_COPY_AND_ASSIGN(BidirectionalStreamQuicImpl);
119 }; 122 };
120 123
121 } // namespace net 124 } // namespace net
122 125
123 #endif // NET_QUIC_BIDIRECTIONAL_STREAM_QUIC_IMPL_H_ 126 #endif // NET_QUIC_BIDIRECTIONAL_STREAM_QUIC_IMPL_H_
OLDNEW
« no previous file with comments | « net/http/http_stream_factory_impl_unittest.cc ('k') | net/quic/bidirectional_stream_quic_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698