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

Side by Side Diff: components/cronet/android/cronet_bidirectional_stream_adapter.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: self review Created 4 years, 7 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 COMPONENTS_CRONET_ANDROID_CRONET_BIDIRECTIONAL_STREAM_ADAPTER_H_ 5 #ifndef COMPONENTS_CRONET_ANDROID_CRONET_BIDIRECTIONAL_STREAM_ADAPTER_H_
6 #define COMPONENTS_CRONET_ANDROID_CRONET_BIDIRECTIONAL_STREAM_ADAPTER_H_ 6 #define COMPONENTS_CRONET_ANDROID_CRONET_BIDIRECTIONAL_STREAM_ADAPTER_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 // or Destroy. Public methods can be called on any thread. 64 // or Destroy. Public methods can be called on any thread.
65 class CronetBidirectionalStreamAdapter 65 class CronetBidirectionalStreamAdapter
66 : public net::BidirectionalStream::Delegate { 66 : public net::BidirectionalStream::Delegate {
67 public: 67 public:
68 static bool RegisterJni(JNIEnv* env); 68 static bool RegisterJni(JNIEnv* env);
69 69
70 CronetBidirectionalStreamAdapter( 70 CronetBidirectionalStreamAdapter(
71 CronetURLRequestContextAdapter* context, 71 CronetURLRequestContextAdapter* context,
72 JNIEnv* env, 72 JNIEnv* env,
73 const base::android::JavaParamRef<jobject>& jbidi_stream, 73 const base::android::JavaParamRef<jobject>& jbidi_stream,
74 bool jdisable_auto_flush); 74 bool jdelay_headers_until_next_send_data);
75 ~CronetBidirectionalStreamAdapter() override; 75 ~CronetBidirectionalStreamAdapter() override;
76 76
77 // Validates method and headers, initializes and starts the request. If 77 // Validates method and headers, initializes and starts the request. If
78 // |jend_of_stream| is true, then stream is half-closed after sending header 78 // |jend_of_stream| is true, then stream is half-closed after sending header
79 // frame and no data is expected to be written. 79 // frame and no data is expected to be written.
80 // Returns 0 if request is valid and started successfully, 80 // Returns 0 if request is valid and started successfully,
81 // Returns -1 if |jmethod| is not valid HTTP method name. 81 // Returns -1 if |jmethod| is not valid HTTP method name.
82 // Returns position of invalid header value in |jheaders| if header name is 82 // Returns position of invalid header value in |jheaders| if header name is
83 // not valid. 83 // not valid.
84 jint Start(JNIEnv* env, 84 jint Start(JNIEnv* env,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 void DestroyOnNetworkThread(bool send_on_canceled); 138 void DestroyOnNetworkThread(bool send_on_canceled);
139 // Gets headers as a Java array. 139 // Gets headers as a Java array.
140 base::android::ScopedJavaLocalRef<jobjectArray> GetHeadersArray( 140 base::android::ScopedJavaLocalRef<jobjectArray> GetHeadersArray(
141 JNIEnv* env, 141 JNIEnv* env,
142 const net::SpdyHeaderBlock& header_block); 142 const net::SpdyHeaderBlock& header_block);
143 143
144 CronetURLRequestContextAdapter* const context_; 144 CronetURLRequestContextAdapter* const context_;
145 145
146 // Java object that owns this CronetBidirectionalStreamAdapter. 146 // Java object that owns this CronetBidirectionalStreamAdapter.
147 base::android::ScopedJavaGlobalRef<jobject> owner_; 147 base::android::ScopedJavaGlobalRef<jobject> owner_;
148 const bool disable_auto_flush_; 148 const bool delay_headers_until_next_send_data_;
149 149
150 scoped_refptr<IOBufferWithByteBuffer> read_buffer_; 150 scoped_refptr<IOBufferWithByteBuffer> read_buffer_;
151 std::unique_ptr<PendingWriteData> pending_write_data_; 151 std::unique_ptr<PendingWriteData> pending_write_data_;
152 std::unique_ptr<net::BidirectionalStream> bidi_stream_; 152 std::unique_ptr<net::BidirectionalStream> bidi_stream_;
153 153
154 // Whether BidirectionalStream::Delegate::OnFailed callback is invoked. 154 // Whether BidirectionalStream::Delegate::OnFailed callback is invoked.
155 bool stream_failed_; 155 bool stream_failed_;
156 156
157 DISALLOW_COPY_AND_ASSIGN(CronetBidirectionalStreamAdapter); 157 DISALLOW_COPY_AND_ASSIGN(CronetBidirectionalStreamAdapter);
158 }; 158 };
159 159
160 } // namespace cronet 160 } // namespace cronet
161 161
162 #endif // COMPONENTS_CRONET_ANDROID_CRONET_BIDIRECTIONAL_STREAM_ADAPTER_H_ 162 #endif // COMPONENTS_CRONET_ANDROID_CRONET_BIDIRECTIONAL_STREAM_ADAPTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698