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 android.util.Log; | 7 import android.util.Log; |
8 | 8 |
9 import org.chromium.base.VisibleForTesting; | 9 import org.chromium.base.VisibleForTesting; |
10 import org.chromium.base.annotations.CalledByNative; | 10 import org.chromium.base.annotations.CalledByNative; |
(...skipping 11 matching lines...) Expand all Loading... |
22 * encapsulated in the embedder's {@link UploadDataSink} and a C++ | 22 * encapsulated in the embedder's {@link UploadDataSink} and a C++ |
23 * UploadDataStreamAdapter, which it owns. It's attached to a {@link | 23 * UploadDataStreamAdapter, which it owns. It's attached to a {@link |
24 * CronetUrlRequest}'s during the construction of request's native C++ objects | 24 * CronetUrlRequest}'s during the construction of request's native C++ objects |
25 * on the network thread, though it's created on one of the embedder's threads. | 25 * on the network thread, though it's created on one of the embedder's threads. |
26 * It is called by the UploadDataStreamAdapter on the network thread, but calls | 26 * It is called by the UploadDataStreamAdapter on the network thread, but calls |
27 * into the UploadDataSink and the UploadDataStreamAdapter on the Executor | 27 * into the UploadDataSink and the UploadDataStreamAdapter on the Executor |
28 * passed into its constructor. | 28 * passed into its constructor. |
29 */ | 29 */ |
30 @JNINamespace("cronet") | 30 @JNINamespace("cronet") |
31 final class CronetUploadDataStream implements UploadDataSink { | 31 final class CronetUploadDataStream implements UploadDataSink { |
32 private static final String TAG = "CronetUploadDataStream"; | 32 private static final String TAG = CronetUploadDataStream.class.getSimpleName
(); |
33 // These are never changed, once a request starts. | 33 // These are never changed, once a request starts. |
34 private final Executor mExecutor; | 34 private final Executor mExecutor; |
35 private final UploadDataProvider mDataProvider; | 35 private final UploadDataProvider mDataProvider; |
36 private long mLength; | 36 private long mLength; |
37 private long mRemainingLength; | 37 private long mRemainingLength; |
38 private CronetUrlRequest mRequest; | 38 private CronetUrlRequest mRequest; |
39 | 39 |
40 // Reusable read task, to reduce redundant memory allocation. | 40 // Reusable read task, to reduce redundant memory allocation. |
41 private final Runnable mReadTask = new Runnable() { | 41 private final Runnable mReadTask = new Runnable() { |
42 @Override | 42 @Override |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 @NativeClassQualifiedName("CronetUploadDataStreamAdapter") | 365 @NativeClassQualifiedName("CronetUploadDataStreamAdapter") |
366 private native void nativeOnReadSucceeded(long nativePtr, | 366 private native void nativeOnReadSucceeded(long nativePtr, |
367 int bytesRead, boolean finalChunk); | 367 int bytesRead, boolean finalChunk); |
368 | 368 |
369 @NativeClassQualifiedName("CronetUploadDataStreamAdapter") | 369 @NativeClassQualifiedName("CronetUploadDataStreamAdapter") |
370 private native void nativeOnRewindSucceeded(long nativePtr); | 370 private native void nativeOnRewindSucceeded(long nativePtr); |
371 | 371 |
372 @NativeClassQualifiedName("CronetUploadDataStreamAdapter") | 372 @NativeClassQualifiedName("CronetUploadDataStreamAdapter") |
373 private static native void nativeDestroy(long nativePtr); | 373 private static native void nativeDestroy(long nativePtr); |
374 } | 374 } |
OLD | NEW |