| 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.impl; | 5 package org.chromium.net.impl; |
| 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 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 postTaskToExecutor(mOnReadCompletedTask); | 539 postTaskToExecutor(mOnReadCompletedTask); |
| 540 } | 540 } |
| 541 | 541 |
| 542 @SuppressWarnings("unused") | 542 @SuppressWarnings("unused") |
| 543 @CalledByNative | 543 @CalledByNative |
| 544 private void onWritevCompleted(final ByteBuffer[] byteBuffers, int[] initial
Positions, | 544 private void onWritevCompleted(final ByteBuffer[] byteBuffers, int[] initial
Positions, |
| 545 int[] initialLimits, boolean endOfStream) { | 545 int[] initialLimits, boolean endOfStream) { |
| 546 assert byteBuffers.length == initialPositions.length; | 546 assert byteBuffers.length == initialPositions.length; |
| 547 assert byteBuffers.length == initialLimits.length; | 547 assert byteBuffers.length == initialLimits.length; |
| 548 synchronized (mNativeStreamLock) { | 548 synchronized (mNativeStreamLock) { |
| 549 if (isDoneLocked()) return; |
| 549 mWriteState = State.WAITING_FOR_FLUSH; | 550 mWriteState = State.WAITING_FOR_FLUSH; |
| 550 // Flush if there is anything in the flush queue mFlushData. | 551 // Flush if there is anything in the flush queue mFlushData. |
| 551 if (!mFlushData.isEmpty()) { | 552 if (!mFlushData.isEmpty()) { |
| 552 sendFlushDataLocked(); | 553 sendFlushDataLocked(); |
| 553 } | 554 } |
| 554 } | 555 } |
| 555 for (int i = 0; i < byteBuffers.length; i++) { | 556 for (int i = 0; i < byteBuffers.length; i++) { |
| 556 ByteBuffer buffer = byteBuffers[i]; | 557 ByteBuffer buffer = byteBuffers[i]; |
| 557 if (buffer.position() != initialPositions[i] || buffer.limit() != in
itialLimits[i]) { | 558 if (buffer.position() != initialPositions[i] || buffer.limit() != in
itialLimits[i]) { |
| 558 failWithException(new CronetExceptionImpl( | 559 failWithException(new CronetExceptionImpl( |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 private native boolean nativeReadData( | 804 private native boolean nativeReadData( |
| 804 long nativePtr, ByteBuffer byteBuffer, int position, int limit); | 805 long nativePtr, ByteBuffer byteBuffer, int position, int limit); |
| 805 | 806 |
| 806 @NativeClassQualifiedName("CronetBidirectionalStreamAdapter") | 807 @NativeClassQualifiedName("CronetBidirectionalStreamAdapter") |
| 807 private native boolean nativeWritevData(long nativePtr, ByteBuffer[] buffers
, int[] positions, | 808 private native boolean nativeWritevData(long nativePtr, ByteBuffer[] buffers
, int[] positions, |
| 808 int[] limits, boolean endOfStream); | 809 int[] limits, boolean endOfStream); |
| 809 | 810 |
| 810 @NativeClassQualifiedName("CronetBidirectionalStreamAdapter") | 811 @NativeClassQualifiedName("CronetBidirectionalStreamAdapter") |
| 811 private native void nativeDestroy(long nativePtr, boolean sendOnCanceled); | 812 private native void nativeDestroy(long nativePtr, boolean sendOnCanceled); |
| 812 } | 813 } |
| OLD | NEW |