Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 package org.chromium.net; | 5 package org.chromium.net; |
| 6 | 6 |
| 7 import org.chromium.base.Log; | 7 import org.chromium.base.Log; |
| 8 import org.chromium.base.VisibleForTesting; | 8 import org.chromium.base.VisibleForTesting; |
| 9 import org.chromium.base.annotations.CalledByNative; | 9 import org.chromium.base.annotations.CalledByNative; |
| 10 import org.chromium.base.annotations.JNINamespace; | 10 import org.chromium.base.annotations.JNINamespace; |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 34 * States of BidirectionalStream are tracked in mReadState and mWriteState. | 34 * States of BidirectionalStream are tracked in mReadState and mWriteState. |
| 35 * The write state is separated out as it changes independently of the read state. | 35 * The write state is separated out as it changes independently of the read state. |
| 36 * There is one initial state: State.NOT_STARTED. There is one normal final state: | 36 * There is one initial state: State.NOT_STARTED. There is one normal final state: |
| 37 * State.SUCCESS, reached after State.READING_DONE and State.WRITING_DONE. T here are two | 37 * State.SUCCESS, reached after State.READING_DONE and State.WRITING_DONE. T here are two |
| 38 * exceptional final states: State.CANCELED and State.ERROR, which can be re ached from | 38 * exceptional final states: State.CANCELED and State.ERROR, which can be re ached from |
| 39 * any other non-final state. | 39 * any other non-final state. |
| 40 */ | 40 */ |
| 41 private enum State { | 41 private enum State { |
| 42 /* Initial state, stream not started. */ | 42 /* Initial state, stream not started. */ |
| 43 NOT_STARTED, | 43 NOT_STARTED, |
| 44 /* Stream started, request headers are being sent. */ | 44 /* |
| 45 * Stream started, request headers are being sent if mDelayRequestHeader sUntilNextFlush | |
| 46 * is not set to true. | |
| 47 */ | |
| 45 STARTED, | 48 STARTED, |
| 46 /* Waiting for {@code read()} to be called. */ | 49 /* Waiting for {@code read()} to be called. */ |
| 47 WAITING_FOR_READ, | 50 WAITING_FOR_READ, |
| 48 /* Reading from the remote, {@code onReadCompleted()} callback will be c alled when done. */ | 51 /* Reading from the remote, {@code onReadCompleted()} callback will be c alled when done. */ |
| 49 READING, | 52 READING, |
| 50 /* There is no more data to read and stream is half-closed by the remote side. */ | 53 /* There is no more data to read and stream is half-closed by the remote side. */ |
| 51 READING_DONE, | 54 READING_DONE, |
| 52 /* Stream is canceled. */ | 55 /* Stream is canceled. */ |
| 53 CANCELED, | 56 CANCELED, |
| 54 /* Error has occured, stream is closed. */ | 57 /* Error has occured, stream is closed. */ |
| 55 ERROR, | 58 ERROR, |
| 56 /* Reading and writing are done, and the stream is closed successfully. */ | 59 /* Reading and writing are done, and the stream is closed successfully. */ |
| 57 SUCCESS, | 60 SUCCESS, |
| 58 /* Waiting for {@code nativeWritevData()} to be called. */ | 61 /* Waiting for {@code nativeSendRequestHeaders()} or {@code nativeWritev Data()} to be |
| 59 WAITING_FOR_WRITE, | 62 called. */ |
| 63 WAITING_FOR_FLUSH, | |
| 60 /* Writing to the remote, {@code onWritevCompleted()} callback will be c alled when done. */ | 64 /* Writing to the remote, {@code onWritevCompleted()} callback will be c alled when done. */ |
| 61 WRITING, | 65 WRITING, |
| 62 /* There is no more data to write and stream is half-closed by the local side. */ | 66 /* There is no more data to write and stream is half-closed by the local side. */ |
| 63 WRITING_DONE, | 67 WRITING_DONE, |
| 64 } | 68 } |
| 65 | 69 |
| 66 private final CronetUrlRequestContext mRequestContext; | 70 private final CronetUrlRequestContext mRequestContext; |
| 67 private final Executor mExecutor; | 71 private final Executor mExecutor; |
| 68 private final Callback mCallback; | 72 private final Callback mCallback; |
| 69 private final String mInitialUrl; | 73 private final String mInitialUrl; |
| 70 private final int mInitialPriority; | 74 private final int mInitialPriority; |
| 71 private final String mInitialMethod; | 75 private final String mInitialMethod; |
| 72 private final String mRequestHeaders[]; | 76 private final String mRequestHeaders[]; |
| 73 private final boolean mDisableAutoFlush; | 77 private final boolean mDisableAutoFlush; |
| 78 private final boolean mDelayHeadersUntilNextFlush; | |
| 74 | 79 |
| 75 /* | 80 /* |
| 76 * Synchronizes access to mNativeStream, mReadState and mWriteState. | 81 * Synchronizes access to mNativeStream, mReadState and mWriteState. |
| 77 */ | 82 */ |
| 78 private final Object mNativeStreamLock = new Object(); | 83 private final Object mNativeStreamLock = new Object(); |
| 79 | 84 |
| 80 @GuardedBy("mNativeStreamLock") | 85 @GuardedBy("mNativeStreamLock") |
| 81 // Pending write data. | 86 // Pending write data. |
| 82 private LinkedList<ByteBuffer> mPendingData; | 87 private LinkedList<ByteBuffer> mPendingData; |
| 83 | 88 |
| 84 @GuardedBy("mNativeStreamLock") | 89 @GuardedBy("mNativeStreamLock") |
| 85 // Flush data queue that should be pushed to the native stack when the previ ous | 90 // Flush data queue that should be pushed to the native stack when the previ ous |
| 86 // nativeWritevData completes. | 91 // nativeWritevData completes. |
| 87 private LinkedList<ByteBuffer> mFlushData; | 92 private LinkedList<ByteBuffer> mFlushData; |
| 88 | 93 |
| 89 @GuardedBy("mNativeStreamLock") | 94 @GuardedBy("mNativeStreamLock") |
| 90 // Whether an end-of-stream flag is passed in through write(). | 95 // Whether an end-of-stream flag is passed in through write(). |
| 91 private boolean mEndOfStreamWritten; | 96 private boolean mEndOfStreamWritten; |
| 92 | 97 |
| 98 @GuardedBy("mNativeStreamLock") | |
| 99 // Whether request headers have been flushed. | |
| 100 private boolean mRequestHeadersFlushed; | |
| 101 | |
| 93 /* Native BidirectionalStream object, owned by CronetBidirectionalStream. */ | 102 /* Native BidirectionalStream object, owned by CronetBidirectionalStream. */ |
| 94 @GuardedBy("mNativeStreamLock") | 103 @GuardedBy("mNativeStreamLock") |
| 95 private long mNativeStream; | 104 private long mNativeStream; |
| 96 | 105 |
| 97 /** | 106 /** |
| 98 * Read state is tracking reading flow. | 107 * Read state is tracking reading flow. |
| 99 * / <--- READING <--- \ | 108 * / <--- READING <--- \ |
| 100 * | | | 109 * | | |
| 101 * \ / | 110 * \ / |
| 102 * NOT_STARTED -> STARTED --> WAITING_FOR_READ -> READING_DONE -> SUCCESS | 111 * NOT_STARTED -> STARTED --> WAITING_FOR_READ -> READING_DONE -> SUCCESS |
| 103 */ | 112 */ |
| 104 @GuardedBy("mNativeStreamLock") | 113 @GuardedBy("mNativeStreamLock") |
| 105 private State mReadState = State.NOT_STARTED; | 114 private State mReadState = State.NOT_STARTED; |
| 106 | 115 |
| 107 /** | 116 /** |
| 108 * Write state is tracking writing flow. | 117 * Write state is tracking writing flow. |
| 109 * / <--- WRITING <--- \ | 118 * / <--- WRITING <--- \ |
| 110 * | | | 119 * | | |
| 111 * \ / | 120 * \ / |
| 112 * NOT_STARTED -> STARTED --> WAITING_FOR_WRITE -> WRITING_DONE -> SUCCESS | 121 * NOT_STARTED -> STARTED --> WAITING_FOR_FLUSH -> WRITING_DONE -> SUCCESS |
| 113 */ | 122 */ |
| 114 @GuardedBy("mNativeStreamLock") | 123 @GuardedBy("mNativeStreamLock") |
| 115 private State mWriteState = State.NOT_STARTED; | 124 private State mWriteState = State.NOT_STARTED; |
| 116 | 125 |
| 117 // Only modified on the network thread. | 126 // Only modified on the network thread. |
| 118 private UrlResponseInfo mResponseInfo; | 127 private UrlResponseInfo mResponseInfo; |
| 119 | 128 |
| 120 /* | 129 /* |
| 121 * OnReadCompleted callback is repeatedly invoked when each read is complete d, so it | 130 * OnReadCompleted callback is repeatedly invoked when each read is complete d, so it |
| 122 * is cached as a member variable. | 131 * is cached as a member variable. |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 195 } | 204 } |
| 196 } catch (Exception e) { | 205 } catch (Exception e) { |
| 197 onCallbackException(e); | 206 onCallbackException(e); |
| 198 } | 207 } |
| 199 } | 208 } |
| 200 } | 209 } |
| 201 | 210 |
| 202 CronetBidirectionalStream(CronetUrlRequestContext requestContext, String url , | 211 CronetBidirectionalStream(CronetUrlRequestContext requestContext, String url , |
| 203 @BidirectionalStream.Builder.StreamPriority int priority, Callback c allback, | 212 @BidirectionalStream.Builder.StreamPriority int priority, Callback c allback, |
| 204 Executor executor, String httpMethod, List<Map.Entry<String, String> > requestHeaders, | 213 Executor executor, String httpMethod, List<Map.Entry<String, String> > requestHeaders, |
| 205 boolean disableAutoFlush) { | 214 boolean disableAutoFlush, boolean delayRequestHeadersUntilNextFlush) { |
| 206 mRequestContext = requestContext; | 215 mRequestContext = requestContext; |
| 207 mInitialUrl = url; | 216 mInitialUrl = url; |
| 208 mInitialPriority = convertStreamPriority(priority); | 217 mInitialPriority = convertStreamPriority(priority); |
| 209 mCallback = callback; | 218 mCallback = callback; |
| 210 mExecutor = executor; | 219 mExecutor = executor; |
| 211 mInitialMethod = httpMethod; | 220 mInitialMethod = httpMethod; |
| 212 mRequestHeaders = stringsFromHeaderList(requestHeaders); | 221 mRequestHeaders = stringsFromHeaderList(requestHeaders); |
| 213 mDisableAutoFlush = disableAutoFlush; | 222 mDisableAutoFlush = disableAutoFlush; |
| 223 mDelayHeadersUntilNextFlush = delayRequestHeadersUntilNextFlush; | |
| 214 mPendingData = new LinkedList<>(); | 224 mPendingData = new LinkedList<>(); |
| 215 mFlushData = new LinkedList<>(); | 225 mFlushData = new LinkedList<>(); |
| 216 } | 226 } |
| 217 | 227 |
| 218 @Override | 228 @Override |
| 219 public void start() { | 229 public void start() { |
| 220 synchronized (mNativeStreamLock) { | 230 synchronized (mNativeStreamLock) { |
| 221 if (mReadState != State.NOT_STARTED) { | 231 if (mReadState != State.NOT_STARTED) { |
| 222 throw new IllegalStateException("Stream is already started."); | 232 throw new IllegalStateException("Stream is already started."); |
| 223 } | 233 } |
| 224 try { | 234 try { |
| 225 mNativeStream = nativeCreateBidirectionalStream( | 235 mNativeStream = nativeCreateBidirectionalStream( |
| 226 mRequestContext.getUrlRequestContextAdapter(), mDisableA utoFlush); | 236 mRequestContext.getUrlRequestContextAdapter(), |
| 237 !mDelayHeadersUntilNextFlush); | |
| 227 mRequestContext.onRequestStarted(); | 238 mRequestContext.onRequestStarted(); |
| 228 // Non-zero startResult means an argument error. | 239 // Non-zero startResult means an argument error. |
| 229 int startResult = nativeStart(mNativeStream, mInitialUrl, mIniti alPriority, | 240 int startResult = nativeStart(mNativeStream, mInitialUrl, mIniti alPriority, |
| 230 mInitialMethod, mRequestHeaders, !doesMethodAllowWriteDa ta(mInitialMethod)); | 241 mInitialMethod, mRequestHeaders, !doesMethodAllowWriteDa ta(mInitialMethod)); |
| 231 if (startResult == -1) { | 242 if (startResult == -1) { |
| 232 throw new IllegalArgumentException("Invalid http method " + mInitialMethod); | 243 throw new IllegalArgumentException("Invalid http method " + mInitialMethod); |
| 233 } | 244 } |
| 234 if (startResult > 0) { | 245 if (startResult > 0) { |
| 235 int headerPos = startResult - 1; | 246 int headerPos = startResult - 1; |
| 236 throw new IllegalArgumentException("Invalid header " | 247 throw new IllegalArgumentException("Invalid header " |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 295 | 306 |
| 296 @Override | 307 @Override |
| 297 public void flush() { | 308 public void flush() { |
| 298 synchronized (mNativeStreamLock) { | 309 synchronized (mNativeStreamLock) { |
| 299 flushLocked(); | 310 flushLocked(); |
| 300 } | 311 } |
| 301 } | 312 } |
| 302 | 313 |
| 303 @SuppressWarnings("GuardedByChecker") | 314 @SuppressWarnings("GuardedByChecker") |
| 304 private void flushLocked() { | 315 private void flushLocked() { |
| 305 if (isDoneLocked()) { | 316 if (isDoneLocked() |
| 317 || (mWriteState != State.WAITING_FOR_FLUSH && mWriteState != Sta te.WRITING)) { | |
| 306 return; | 318 return; |
| 307 } | 319 } |
| 308 if (mPendingData.isEmpty() && mFlushData.isEmpty()) { | 320 if (mPendingData.isEmpty() && mFlushData.isEmpty()) { |
| 309 // No-op if there is nothing to write. | 321 // If there is no pending write when flush() is called, see if |
| 322 // request headers need to be flushed. | |
| 323 if (!mRequestHeadersFlushed) { | |
| 324 mRequestHeadersFlushed = true; | |
| 325 nativeSendRequestHeaders(mNativeStream); | |
| 326 } | |
|
kapishnikov
2016/05/31 18:42:12
Should we change mWriteState to State.WRITING_DONE
xunjieli
2016/05/31 19:31:53
Done. Good catch!
| |
| 310 return; | 327 return; |
| 311 } | 328 } |
| 312 | 329 |
| 330 assert !(mPendingData.isEmpty() && mFlushData.isEmpty()); | |
|
kapishnikov
2016/05/31 18:42:12
Will it prevent calling flush() two times in a rol
xunjieli
2016/05/31 19:31:53
We have an early return on line 327 to prevent cal
kapishnikov
2016/05/31 19:47:24
Acknowledged.
| |
| 331 | |
| 313 // Move buffers from mPendingData to the flushing queue. | 332 // Move buffers from mPendingData to the flushing queue. |
| 314 if (!mPendingData.isEmpty()) { | 333 if (!mPendingData.isEmpty()) { |
| 315 mFlushData.addAll(mPendingData); | 334 mFlushData.addAll(mPendingData); |
| 316 mPendingData.clear(); | 335 mPendingData.clear(); |
| 317 } | 336 } |
| 318 | 337 |
| 319 if (mWriteState == State.WRITING) { | 338 if (mWriteState == State.WRITING) { |
| 320 // If there is a write already pending, wait until onWritevCompleted is | 339 // If there is a write already pending, wait until onWritevCompleted is |
| 321 // called before pushing data to the native stack. | 340 // called before pushing data to the native stack. |
| 322 return; | 341 return; |
| 323 } | 342 } |
| 343 assert mWriteState == State.WAITING_FOR_FLUSH; | |
| 324 int size = mFlushData.size(); | 344 int size = mFlushData.size(); |
| 325 ByteBuffer[] buffers = new ByteBuffer[size]; | 345 ByteBuffer[] buffers = new ByteBuffer[size]; |
| 326 int[] positions = new int[size]; | 346 int[] positions = new int[size]; |
| 327 int[] limits = new int[size]; | 347 int[] limits = new int[size]; |
| 328 for (int i = 0; i < size; i++) { | 348 for (int i = 0; i < size; i++) { |
| 329 ByteBuffer buffer = mFlushData.poll(); | 349 ByteBuffer buffer = mFlushData.poll(); |
| 330 buffers[i] = buffer; | 350 buffers[i] = buffer; |
| 331 positions[i] = buffer.position(); | 351 positions[i] = buffer.position(); |
| 332 limits[i] = buffer.limit(); | 352 limits[i] = buffer.limit(); |
| 333 } | 353 } |
| 334 assert mFlushData.isEmpty(); | 354 assert mFlushData.isEmpty(); |
| 355 assert buffers.length >= 1; | |
| 335 mWriteState = State.WRITING; | 356 mWriteState = State.WRITING; |
| 336 if (!nativeWritevData(mNativeStream, buffers, positions, limits, mEndOfS treamWritten)) { | 357 if (!nativeWritevData(mNativeStream, buffers, positions, limits, mEndOfS treamWritten)) { |
| 337 // Still waiting on write. This is just to have consistent | 358 // Still waiting on write. This is just to have consistent |
| 338 // behavior with the other error cases. | 359 // behavior with the other error cases. |
| 339 mWriteState = State.WAITING_FOR_WRITE; | 360 mWriteState = State.WAITING_FOR_FLUSH; |
| 340 throw new IllegalArgumentException("Unable to call native writev."); | 361 throw new IllegalArgumentException("Unable to call native writev."); |
| 341 } | 362 } |
| 342 } | 363 } |
| 343 | 364 |
| 344 @Override | 365 @Override |
| 345 public void ping(PingCallback callback, Executor executor) { | 366 public void ping(PingCallback callback, Executor executor) { |
| 346 // TODO(mef): May be last thing to be implemented on Android. | 367 // TODO(mef): May be last thing to be implemented on Android. |
| 347 throw new UnsupportedOperationException("ping is not supported yet."); | 368 throw new UnsupportedOperationException("ping is not supported yet."); |
| 348 } | 369 } |
| 349 | 370 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 394 } | 415 } |
| 395 try { | 416 try { |
| 396 mCallback.onSucceeded(CronetBidirectionalStream.this, mResponseInfo) ; | 417 mCallback.onSucceeded(CronetBidirectionalStream.this, mResponseInfo) ; |
| 397 } catch (Exception e) { | 418 } catch (Exception e) { |
| 398 Log.e(CronetUrlRequestContext.LOG_TAG, "Exception in onSucceeded met hod", e); | 419 Log.e(CronetUrlRequestContext.LOG_TAG, "Exception in onSucceeded met hod", e); |
| 399 } | 420 } |
| 400 } | 421 } |
| 401 | 422 |
| 402 @SuppressWarnings("unused") | 423 @SuppressWarnings("unused") |
| 403 @CalledByNative | 424 @CalledByNative |
| 404 private void onStreamReady() { | 425 private void onStreamReady(final boolean requestHeadersFlushed) { |
| 405 postTaskToExecutor(new Runnable() { | 426 postTaskToExecutor(new Runnable() { |
| 406 public void run() { | 427 public void run() { |
| 407 synchronized (mNativeStreamLock) { | 428 synchronized (mNativeStreamLock) { |
| 408 if (isDoneLocked()) { | 429 if (isDoneLocked()) { |
| 409 return; | 430 return; |
| 410 } | 431 } |
| 411 if (doesMethodAllowWriteData(mInitialMethod)) { | 432 mRequestHeadersFlushed = requestHeadersFlushed; |
| 412 mWriteState = State.WAITING_FOR_WRITE; | 433 mReadState = State.WAITING_FOR_READ; |
| 413 mReadState = State.WAITING_FOR_READ; | 434 if (!doesMethodAllowWriteData(mInitialMethod) && mRequestHea dersFlushed) { |
| 435 mWriteState = State.WRITING_DONE; | |
| 414 } else { | 436 } else { |
| 415 mWriteState = State.WRITING_DONE; | 437 mWriteState = State.WAITING_FOR_FLUSH; |
| 416 } | 438 } |
| 417 } | 439 } |
| 418 | 440 |
| 419 try { | 441 try { |
| 420 mCallback.onStreamReady(CronetBidirectionalStream.this); | 442 mCallback.onStreamReady(CronetBidirectionalStream.this); |
| 421 } catch (Exception e) { | 443 } catch (Exception e) { |
| 422 onCallbackException(e); | 444 onCallbackException(e); |
| 423 } | 445 } |
| 424 } | 446 } |
| 425 }); | 447 }); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 480 postTaskToExecutor(mOnReadCompletedTask); | 502 postTaskToExecutor(mOnReadCompletedTask); |
| 481 } | 503 } |
| 482 | 504 |
| 483 @SuppressWarnings("unused") | 505 @SuppressWarnings("unused") |
| 484 @CalledByNative | 506 @CalledByNative |
| 485 private void onWritevCompleted(final ByteBuffer[] byteBuffers, int[] initial Positions, | 507 private void onWritevCompleted(final ByteBuffer[] byteBuffers, int[] initial Positions, |
| 486 int[] initialLimits, boolean endOfStream) { | 508 int[] initialLimits, boolean endOfStream) { |
| 487 assert byteBuffers.length == initialPositions.length; | 509 assert byteBuffers.length == initialPositions.length; |
| 488 assert byteBuffers.length == initialLimits.length; | 510 assert byteBuffers.length == initialLimits.length; |
| 489 synchronized (mNativeStreamLock) { | 511 synchronized (mNativeStreamLock) { |
| 490 mWriteState = State.WAITING_FOR_WRITE; | 512 mWriteState = State.WAITING_FOR_FLUSH; |
| 491 // Flush if there is anything in the flush queue mFlushData. | 513 // Flush if there is anything in the flush queue mFlushData. |
| 492 if (!mFlushData.isEmpty()) { | 514 if (!mFlushData.isEmpty()) { |
| 493 flushLocked(); | 515 flushLocked(); |
| 494 } | 516 } |
| 495 } | 517 } |
| 496 for (int i = 0; i < byteBuffers.length; i++) { | 518 for (int i = 0; i < byteBuffers.length; i++) { |
| 497 ByteBuffer buffer = byteBuffers[i]; | 519 ByteBuffer buffer = byteBuffers[i]; |
| 498 if (buffer.position() != initialPositions[i] || buffer.limit() != in itialLimits[i]) { | 520 if (buffer.position() != initialPositions[i] || buffer.limit() != in itialLimits[i]) { |
| 499 failWithException( | 521 failWithException( |
| 500 new CronetException("ByteBuffer modified externally duri ng write", null)); | 522 new CronetException("ByteBuffer modified externally duri ng write", null)); |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 681 private void failWithException(final CronetException exception) { | 703 private void failWithException(final CronetException exception) { |
| 682 postTaskToExecutor(new Runnable() { | 704 postTaskToExecutor(new Runnable() { |
| 683 public void run() { | 705 public void run() { |
| 684 failWithExceptionOnExecutor(exception); | 706 failWithExceptionOnExecutor(exception); |
| 685 } | 707 } |
| 686 }); | 708 }); |
| 687 } | 709 } |
| 688 | 710 |
| 689 // Native methods are implemented in cronet_bidirectional_stream_adapter.cc. | 711 // Native methods are implemented in cronet_bidirectional_stream_adapter.cc. |
| 690 private native long nativeCreateBidirectionalStream( | 712 private native long nativeCreateBidirectionalStream( |
| 691 long urlRequestContextAdapter, boolean disableAutoFlush); | 713 long urlRequestContextAdapter, boolean sendRequestHeadersAutomatical ly); |
| 692 | 714 |
| 693 @NativeClassQualifiedName("CronetBidirectionalStreamAdapter") | 715 @NativeClassQualifiedName("CronetBidirectionalStreamAdapter") |
| 694 private native int nativeStart(long nativePtr, String url, int priority, Str ing method, | 716 private native int nativeStart(long nativePtr, String url, int priority, Str ing method, |
| 695 String[] headers, boolean endOfStream); | 717 String[] headers, boolean endOfStream); |
| 696 | 718 |
| 697 @NativeClassQualifiedName("CronetBidirectionalStreamAdapter") | 719 @NativeClassQualifiedName("CronetBidirectionalStreamAdapter") |
| 720 private native void nativeSendRequestHeaders(long nativePtr); | |
| 721 | |
| 722 @NativeClassQualifiedName("CronetBidirectionalStreamAdapter") | |
| 698 private native boolean nativeReadData( | 723 private native boolean nativeReadData( |
| 699 long nativePtr, ByteBuffer byteBuffer, int position, int limit); | 724 long nativePtr, ByteBuffer byteBuffer, int position, int limit); |
| 700 | 725 |
| 701 @NativeClassQualifiedName("CronetBidirectionalStreamAdapter") | 726 @NativeClassQualifiedName("CronetBidirectionalStreamAdapter") |
| 702 private native boolean nativeWritevData(long nativePtr, ByteBuffer[] buffers , int[] positions, | 727 private native boolean nativeWritevData(long nativePtr, ByteBuffer[] buffers , int[] positions, |
| 703 int[] limits, boolean endOfStream); | 728 int[] limits, boolean endOfStream); |
| 704 | 729 |
| 705 @NativeClassQualifiedName("CronetBidirectionalStreamAdapter") | 730 @NativeClassQualifiedName("CronetBidirectionalStreamAdapter") |
| 706 private native void nativeDestroy(long nativePtr, boolean sendOnCanceled); | 731 private native void nativeDestroy(long nativePtr, boolean sendOnCanceled); |
| 707 } | 732 } |
| OLD | NEW |