| OLD | NEW |
| 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 #include "components/cronet/ios/cronet_c_for_grpc.h" | 5 #include "components/cronet/ios/cronet_c_for_grpc.h" |
| 6 | 6 |
| 7 #include <stdbool.h> | 7 #include <stdbool.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 void* annotation, | 211 void* annotation, |
| 212 cronet_bidirectional_stream_callback* callback) { | 212 cronet_bidirectional_stream_callback* callback) { |
| 213 // Allocate C |stream| object. | 213 // Allocate C |stream| object. |
| 214 cronet_bidirectional_stream* stream = new cronet_bidirectional_stream(); | 214 cronet_bidirectional_stream* stream = new cronet_bidirectional_stream(); |
| 215 // Allocate new C++ adapter that will invoke |callback|. | 215 // Allocate new C++ adapter that will invoke |callback|. |
| 216 stream->obj = new CronetBidirectionalStreamAdapter(engine, stream, callback); | 216 stream->obj = new CronetBidirectionalStreamAdapter(engine, stream, callback); |
| 217 stream->annotation = annotation; | 217 stream->annotation = annotation; |
| 218 return stream; | 218 return stream; |
| 219 } | 219 } |
| 220 | 220 |
| 221 int cronet_bidirectional_stream_destroy(cronet_bidirectional_stream* stream) { |
| 222 CronetBidirectionalStreamAdapter::DestroyAdapterForStream(stream); |
| 223 delete stream; |
| 224 return 1; |
| 225 } |
| 226 |
| 227 void cronet_bidirectional_stream_disable_auto_flush( |
| 228 cronet_bidirectional_stream* stream, |
| 229 bool disable_auto_flush) { |
| 230 CronetBidirectionalStreamAdapter::GetCronetStream(stream)->disable_auto_flush( |
| 231 disable_auto_flush); |
| 232 } |
| 233 |
| 234 void cronet_bidirectional_stream_delay_request_headers_until_flush( |
| 235 cronet_bidirectional_stream* stream, |
| 236 bool delay_headers_until_flush) { |
| 237 CronetBidirectionalStreamAdapter::GetCronetStream(stream) |
| 238 ->delay_headers_until_flush(delay_headers_until_flush); |
| 239 } |
| 240 |
| 221 int cronet_bidirectional_stream_start( | 241 int cronet_bidirectional_stream_start( |
| 222 cronet_bidirectional_stream* stream, | 242 cronet_bidirectional_stream* stream, |
| 223 const char* url, | 243 const char* url, |
| 224 int priority, | 244 int priority, |
| 225 const char* method, | 245 const char* method, |
| 226 const cronet_bidirectional_stream_header_array* headers, | 246 const cronet_bidirectional_stream_header_array* headers, |
| 227 bool end_of_stream) { | 247 bool end_of_stream) { |
| 228 cronet::CronetBidirectionalStream* cronet_stream = | 248 cronet::CronetBidirectionalStream* cronet_stream = |
| 229 CronetBidirectionalStreamAdapter::GetCronetStream(stream); | 249 CronetBidirectionalStreamAdapter::GetCronetStream(stream); |
| 230 net::HttpRequestHeaders request_headers; | 250 net::HttpRequestHeaders request_headers; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 252 } | 272 } |
| 253 | 273 |
| 254 int cronet_bidirectional_stream_write(cronet_bidirectional_stream* stream, | 274 int cronet_bidirectional_stream_write(cronet_bidirectional_stream* stream, |
| 255 const char* buffer, | 275 const char* buffer, |
| 256 int count, | 276 int count, |
| 257 bool end_of_stream) { | 277 bool end_of_stream) { |
| 258 return CronetBidirectionalStreamAdapter::GetCronetStream(stream)->WriteData( | 278 return CronetBidirectionalStreamAdapter::GetCronetStream(stream)->WriteData( |
| 259 buffer, count, end_of_stream); | 279 buffer, count, end_of_stream); |
| 260 } | 280 } |
| 261 | 281 |
| 262 int cronet_bidirectional_stream_cancel(cronet_bidirectional_stream* stream) { | 282 void cronet_bidirectional_stream_flush(cronet_bidirectional_stream* stream) { |
| 263 CronetBidirectionalStreamAdapter::GetCronetStream(stream)->Cancel(); | 283 return CronetBidirectionalStreamAdapter::GetCronetStream(stream)->Flush(); |
| 264 return 1; | |
| 265 } | 284 } |
| 266 | 285 |
| 267 int cronet_bidirectional_stream_destroy(cronet_bidirectional_stream* stream) { | 286 void cronet_bidirectional_stream_cancel(cronet_bidirectional_stream* stream) { |
| 268 CronetBidirectionalStreamAdapter::DestroyAdapterForStream(stream); | 287 CronetBidirectionalStreamAdapter::GetCronetStream(stream)->Cancel(); |
| 269 delete stream; | |
| 270 return 1; | |
| 271 } | 288 } |
| OLD | NEW |