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

Side by Side Diff: components/grpc_support/cronet_bidirectional_stream.h

Issue 2273403003: Moving gRPC support interfaces out of cronet and into a new component. (Closed)
Patch Set: Add cronet_c_for_graph back to sources. Might fix GN, probably won't compile Created 4 years, 3 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
« no previous file with comments | « components/grpc_support/OWNERS ('k') | components/grpc_support/cronet_bidirectional_stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/synchronization/lock.h" 13 #include "base/synchronization/lock.h"
14 #include "net/http/bidirectional_stream.h" 14 #include "net/http/bidirectional_stream.h"
15 15
16 namespace net { 16 namespace net {
17 class HttpRequestHeaders; 17 class HttpRequestHeaders;
18 class WrappedIOBuffer; 18 class WrappedIOBuffer;
19 } // namespace net 19 } // namespace net
20 20
21 namespace cronet { 21 namespace grpc_support {
22 22
23 class CronetEnvironment; 23 class Environment;
24 24
25 // An adapter to net::BidirectionalStream. 25 // An adapter to net::BidirectionalStream.
26 // Created and configured from any thread. Start, ReadData, WriteData and 26 // Created and configured from any thread. Start, ReadData, WriteData and
27 // Destroy can be called on any thread (including network thread), and post 27 // Destroy can be called on any thread (including network thread), and post
28 // calls to corresponding {Start|ReadData|WriteData|Destroy}OnNetworkThread to 28 // calls to corresponding {Start|ReadData|WriteData|Destroy}OnNetworkThread to
29 // the network thread. The object is always deleted on network thread. All 29 // the network thread. The object is always deleted on network thread. All
30 // callbacks into the Delegate are done on the network thread. 30 // callbacks into the Delegate are done on the network thread.
31 // The app is expected to initiate the next step like ReadData or Destroy. 31 // The app is expected to initiate the next step like ReadData or Destroy.
32 // Public methods can be called on any thread. 32 // Public methods can be called on any thread.
33 class CronetBidirectionalStream : public net::BidirectionalStream::Delegate { 33 class CronetBidirectionalStream : public net::BidirectionalStream::Delegate {
(...skipping 11 matching lines...) Expand all
45 45
46 virtual void OnTrailersReceived(const net::SpdyHeaderBlock& trailers) = 0; 46 virtual void OnTrailersReceived(const net::SpdyHeaderBlock& trailers) = 0;
47 47
48 virtual void OnSucceeded() = 0; 48 virtual void OnSucceeded() = 0;
49 49
50 virtual void OnFailed(int error) = 0; 50 virtual void OnFailed(int error) = 0;
51 51
52 virtual void OnCanceled() = 0; 52 virtual void OnCanceled() = 0;
53 }; 53 };
54 54
55 CronetBidirectionalStream(CronetEnvironment* environment, Delegate* delegate); 55 CronetBidirectionalStream(Environment* environment, Delegate* delegate);
mef 2016/08/26 20:17:35 I think we should change CronetBidirectionalStream
56 ~CronetBidirectionalStream() override; 56 ~CronetBidirectionalStream() override;
57 57
58 // Disables automatic flushing of each buffer passed to WriteData(). 58 // Disables automatic flushing of each buffer passed to WriteData().
59 void disable_auto_flush(bool disable_auto_flush) { 59 void disable_auto_flush(bool disable_auto_flush) {
60 disable_auto_flush_ = disable_auto_flush; 60 disable_auto_flush_ = disable_auto_flush;
61 } 61 }
62 62
63 // Delays sending request headers until first call to Flush(). 63 // Delays sending request headers until first call to Flush().
64 void delay_headers_until_flush(bool delay_headers_until_flush) { 64 void delay_headers_until_flush(bool delay_headers_until_flush) {
65 delay_headers_until_flush_ = delay_headers_until_flush; 65 delay_headers_until_flush_ = delay_headers_until_flush;
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 // \ / 199 // \ /
200 // NOT_STARTED -> STARTED --> WAITING_FOR_FLUSH -> WRITING_DONE -> SUCCESS 200 // NOT_STARTED -> STARTED --> WAITING_FOR_FLUSH -> WRITING_DONE -> SUCCESS
201 State write_state_; 201 State write_state_;
202 202
203 bool write_end_of_stream_; 203 bool write_end_of_stream_;
204 bool request_headers_sent_; 204 bool request_headers_sent_;
205 205
206 bool disable_auto_flush_; 206 bool disable_auto_flush_;
207 bool delay_headers_until_flush_; 207 bool delay_headers_until_flush_;
208 208
209 CronetEnvironment* const environment_; 209 Environment* const environment_;
210 210
211 scoped_refptr<net::WrappedIOBuffer> read_buffer_; 211 scoped_refptr<net::WrappedIOBuffer> read_buffer_;
212 212
213 // Write data that is pending the flush. 213 // Write data that is pending the flush.
214 std::unique_ptr<WriteBuffers> pending_write_data_; 214 std::unique_ptr<WriteBuffers> pending_write_data_;
215 // Write data that is flushed, but not sending yet. 215 // Write data that is flushed, but not sending yet.
216 std::unique_ptr<WriteBuffers> flushing_write_data_; 216 std::unique_ptr<WriteBuffers> flushing_write_data_;
217 // Write data that is sending. 217 // Write data that is sending.
218 std::unique_ptr<WriteBuffers> sending_write_data_; 218 std::unique_ptr<WriteBuffers> sending_write_data_;
219 219
220 std::unique_ptr<net::BidirectionalStream> bidi_stream_; 220 std::unique_ptr<net::BidirectionalStream> bidi_stream_;
221 Delegate* delegate_; 221 Delegate* delegate_;
222 222
223 DISALLOW_COPY_AND_ASSIGN(CronetBidirectionalStream); 223 DISALLOW_COPY_AND_ASSIGN(CronetBidirectionalStream);
224 }; 224 };
225 225
226 } // namespace cronet 226 } // namespace grpc_support
227 227
228 #endif // COMPONENTS_CRONET_IOS_CRONET_BIDIRECTIONAL_STREAM_H_ 228 #endif // COMPONENTS_CRONET_IOS_CRONET_BIDIRECTIONAL_STREAM_H_
OLDNEW
« no previous file with comments | « components/grpc_support/OWNERS ('k') | components/grpc_support/cronet_bidirectional_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698