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

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

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

Powered by Google App Engine
This is Rietveld 408576698