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

Side by Side Diff: components/cronet/android/java/src/org/chromium/net/impl/CronetBidirectionalStream.java

Issue 2697833003: [Cronet] Add isDone() check in CronetBidirectionalStream#onWritevCompleted (Closed)
Patch Set: re-enable check Created 3 years, 10 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 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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698