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

Side by Side Diff: net/spdy/bidirectional_stream_spdy_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: correct a typo 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_SPDY_BIDIRECTIONAL_STREAM_SPDY_IMPL_H_ 5 #ifndef NET_SPDY_BIDIRECTIONAL_STREAM_SPDY_IMPL_H_
6 #define NET_SPDY_BIDIRECTIONAL_STREAM_SPDY_IMPL_H_ 6 #define NET_SPDY_BIDIRECTIONAL_STREAM_SPDY_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 24 matching lines...) Expand all
35 public SpdyStream::Delegate { 35 public SpdyStream::Delegate {
36 public: 36 public:
37 explicit BidirectionalStreamSpdyImpl( 37 explicit BidirectionalStreamSpdyImpl(
38 const base::WeakPtr<SpdySession>& spdy_session); 38 const base::WeakPtr<SpdySession>& spdy_session);
39 39
40 ~BidirectionalStreamSpdyImpl() override; 40 ~BidirectionalStreamSpdyImpl() override;
41 41
42 // BidirectionalStreamImpl implementation: 42 // BidirectionalStreamImpl implementation:
43 void Start(const BidirectionalStreamRequestInfo* request_info, 43 void Start(const BidirectionalStreamRequestInfo* request_info,
44 const BoundNetLog& net_log, 44 const BoundNetLog& net_log,
45 bool disable_auto_flush, 45 bool send_request_headers_automatically,
46 BidirectionalStreamImpl::Delegate* delegate, 46 BidirectionalStreamImpl::Delegate* delegate,
47 std::unique_ptr<base::Timer> timer) override; 47 std::unique_ptr<base::Timer> timer) override;
48 void SendRequestHeaders() override;
48 int ReadData(IOBuffer* buf, int buf_len) override; 49 int ReadData(IOBuffer* buf, int buf_len) override;
49 void SendData(const scoped_refptr<IOBuffer>& data, 50 void SendData(const scoped_refptr<IOBuffer>& data,
50 int length, 51 int length,
51 bool end_stream) override; 52 bool end_stream) override;
52 void SendvData(const std::vector<scoped_refptr<IOBuffer>>& buffers, 53 void SendvData(const std::vector<scoped_refptr<IOBuffer>>& buffers,
53 const std::vector<int>& lengths, 54 const std::vector<int>& lengths,
54 bool end_stream) override; 55 bool end_stream) override;
55 void Cancel() override; 56 void Cancel() override;
56 NextProto GetProtocol() const override; 57 NextProto GetProtocol() const override;
57 int64_t GetTotalReceivedBytes() const override; 58 int64_t GetTotalReceivedBytes() const override;
58 int64_t GetTotalSentBytes() const override; 59 int64_t GetTotalSentBytes() const override;
59 60
60 // SpdyStream::Delegate implementation: 61 // SpdyStream::Delegate implementation:
61 void OnRequestHeadersSent() override; 62 void OnRequestHeadersSent() override;
62 SpdyResponseHeadersStatus OnResponseHeadersUpdated( 63 SpdyResponseHeadersStatus OnResponseHeadersUpdated(
63 const SpdyHeaderBlock& response_headers) override; 64 const SpdyHeaderBlock& response_headers) override;
64 void OnDataReceived(std::unique_ptr<SpdyBuffer> buffer) override; 65 void OnDataReceived(std::unique_ptr<SpdyBuffer> buffer) override;
65 void OnDataSent() override; 66 void OnDataSent() override;
66 void OnTrailers(const SpdyHeaderBlock& trailers) override; 67 void OnTrailers(const SpdyHeaderBlock& trailers) override;
67 void OnClose(int status) override; 68 void OnClose(int status) override;
68 69
69 private: 70 private:
70 void SendRequestHeaders(); 71 int SendRequestHeadersHelper();
71 void OnStreamInitialized(int rv); 72 void OnStreamInitialized(int rv);
72 void ScheduleBufferedRead(); 73 void ScheduleBufferedRead();
73 void DoBufferedRead(); 74 void DoBufferedRead();
74 bool ShouldWaitForMoreBufferedData() const; 75 bool ShouldWaitForMoreBufferedData() const;
75 76
76 const base::WeakPtr<SpdySession> spdy_session_; 77 const base::WeakPtr<SpdySession> spdy_session_;
77 const BidirectionalStreamRequestInfo* request_info_; 78 const BidirectionalStreamRequestInfo* request_info_;
78 BidirectionalStreamImpl::Delegate* delegate_; 79 BidirectionalStreamImpl::Delegate* delegate_;
79 std::unique_ptr<base::Timer> timer_; 80 std::unique_ptr<base::Timer> timer_;
80 SpdyStreamRequest stream_request_; 81 SpdyStreamRequest stream_request_;
(...skipping 12 matching lines...) Expand all
93 // Whether OnClose has been invoked. 94 // Whether OnClose has been invoked.
94 bool stream_closed_; 95 bool stream_closed_;
95 // Status reported in OnClose. 96 // Status reported in OnClose.
96 int closed_stream_status_; 97 int closed_stream_status_;
97 // After |stream_| has been closed, this keeps track of the total number of 98 // After |stream_| has been closed, this keeps track of the total number of
98 // bytes received over the network for |stream_| while it was open. 99 // bytes received over the network for |stream_| while it was open.
99 int64_t closed_stream_received_bytes_; 100 int64_t closed_stream_received_bytes_;
100 // After |stream_| has been closed, this keeps track of the total number of 101 // After |stream_| has been closed, this keeps track of the total number of
101 // bytes sent over the network for |stream_| while it was open. 102 // bytes sent over the network for |stream_| while it was open.
102 int64_t closed_stream_sent_bytes_; 103 int64_t closed_stream_sent_bytes_;
103 // Whether auto flush is disabled.
104 bool disable_auto_flush_;
105 // Only relevant when |disable_auto_flush_| is true;
106 // This is the combined buffer of buffers passed in through SendvData. 104 // This is the combined buffer of buffers passed in through SendvData.
105 // Keep a reference here so it is alive until OnDataSent is invoked.
107 scoped_refptr<IOBuffer> pending_combined_buffer_; 106 scoped_refptr<IOBuffer> pending_combined_buffer_;
108 107
109 base::WeakPtrFactory<BidirectionalStreamSpdyImpl> weak_factory_; 108 base::WeakPtrFactory<BidirectionalStreamSpdyImpl> weak_factory_;
110 109
111 DISALLOW_COPY_AND_ASSIGN(BidirectionalStreamSpdyImpl); 110 DISALLOW_COPY_AND_ASSIGN(BidirectionalStreamSpdyImpl);
112 }; 111 };
113 112
114 } // namespace net 113 } // namespace net
115 114
116 #endif // NET_SPDY_BIDIRECTIONAL_STREAM_SPDY_IMPL_H_ 115 #endif // NET_SPDY_BIDIRECTIONAL_STREAM_SPDY_IMPL_H_
OLDNEW
« no previous file with comments | « net/quic/bidirectional_stream_quic_impl_unittest.cc ('k') | net/spdy/bidirectional_stream_spdy_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698