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

Side by Side Diff: components/cronet/ios/cronet_bidirectional_stream.h

Issue 1856073002: Coalesce small buffers in net::BidirectionalStream (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: self review Created 4 years, 8 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 COMPONENTS_CRONET_IOS_CRONET_BIDIRECTIONAL_STREAM_H_ 5 #ifndef COMPONENTS_CRONET_IOS_CRONET_BIDIRECTIONAL_STREAM_H_
6 #define COMPONENTS_CRONET_IOS_CRONET_BIDIRECTIONAL_STREAM_H_ 6 #define COMPONENTS_CRONET_IOS_CRONET_BIDIRECTIONAL_STREAM_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 14 matching lines...) Expand all
25 // Destroy can be called on any thread (including network thread), and post 25 // Destroy can be called on any thread (including network thread), and post
26 // calls to corresponding {Start|ReadData|WriteData|Destroy}OnNetworkThread to 26 // calls to corresponding {Start|ReadData|WriteData|Destroy}OnNetworkThread to
27 // the network thread. The object is always deleted on network thread. All 27 // the network thread. The object is always deleted on network thread. All
28 // callbacks into the Delegate are done on the network thread. 28 // callbacks into the Delegate are done on the network thread.
29 // The app is expected to initiate the next step like ReadData or Destroy. 29 // The app is expected to initiate the next step like ReadData or Destroy.
30 // Public methods can be called on any thread. 30 // Public methods can be called on any thread.
31 class CronetBidirectionalStream : public net::BidirectionalStream::Delegate { 31 class CronetBidirectionalStream : public net::BidirectionalStream::Delegate {
32 public: 32 public:
33 class Delegate { 33 class Delegate {
34 public: 34 public:
35 virtual void OnHeadersSent() = 0; 35 virtual void OnStreamReady() = 0;
36 36
37 virtual void OnHeadersReceived(const net::SpdyHeaderBlock& response_headers, 37 virtual void OnHeadersReceived(const net::SpdyHeaderBlock& response_headers,
38 const char* negotiated_protocol) = 0; 38 const char* negotiated_protocol) = 0;
39 39
40 virtual void OnDataRead(char* data, int size) = 0; 40 virtual void OnDataRead(char* data, int size) = 0;
41 41
42 virtual void OnDataSent(const char* data) = 0; 42 virtual void OnDataSent(const char* data) = 0;
43 43
44 virtual void OnTrailersReceived(const net::SpdyHeaderBlock& trailers) = 0; 44 virtual void OnTrailersReceived(const net::SpdyHeaderBlock& trailers) = 0;
45 45
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 // Waiting for WriteData() to be called. 109 // Waiting for WriteData() to be called.
110 WAITING_FOR_WRITE, 110 WAITING_FOR_WRITE,
111 // Writing to the remote, callback will be invoked when done. 111 // Writing to the remote, callback will be invoked when done.
112 WRITING, 112 WRITING,
113 // There is no more data to write and stream is half-closed by the local 113 // There is no more data to write and stream is half-closed by the local
114 // side. 114 // side.
115 WRITING_DONE, 115 WRITING_DONE,
116 }; 116 };
117 117
118 // net::BidirectionalStream::Delegate implementations: 118 // net::BidirectionalStream::Delegate implementations:
119 void OnHeadersSent() override; 119 void OnStreamReady() override;
120 void OnHeadersReceived(const net::SpdyHeaderBlock& response_headers) override; 120 void OnHeadersReceived(const net::SpdyHeaderBlock& response_headers) override;
121 void OnDataRead(int bytes_read) override; 121 void OnDataRead(int bytes_read) override;
122 void OnDataSent() override; 122 void OnDataSent() override;
123 void OnTrailersReceived(const net::SpdyHeaderBlock& trailers) override; 123 void OnTrailersReceived(const net::SpdyHeaderBlock& trailers) override;
124 void OnFailed(int error) override; 124 void OnFailed(int error) override;
125 // Helper method to derive OnSucceeded. 125 // Helper method to derive OnSucceeded.
126 void MaybeOnSucceded(); 126 void MaybeOnSucceded();
127 127
128 void StartOnNetworkThread( 128 void StartOnNetworkThread(
129 scoped_ptr<net::BidirectionalStreamRequestInfo> request_info); 129 scoped_ptr<net::BidirectionalStreamRequestInfo> request_info);
(...skipping 27 matching lines...) Expand all
157 scoped_refptr<net::WrappedIOBuffer> write_buffer_; 157 scoped_refptr<net::WrappedIOBuffer> write_buffer_;
158 scoped_ptr<net::BidirectionalStream> bidi_stream_; 158 scoped_ptr<net::BidirectionalStream> bidi_stream_;
159 Delegate* delegate_; 159 Delegate* delegate_;
160 160
161 DISALLOW_COPY_AND_ASSIGN(CronetBidirectionalStream); 161 DISALLOW_COPY_AND_ASSIGN(CronetBidirectionalStream);
162 }; 162 };
163 163
164 } // namespace cronet 164 } // namespace cronet
165 165
166 #endif // COMPONENTS_CRONET_IOS_CRONET_BIDIRECTIONAL_STREAM_H_ 166 #endif // COMPONENTS_CRONET_IOS_CRONET_BIDIRECTIONAL_STREAM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698