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 android.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
8 import android.util.Log; | 8 import android.util.Log; |
9 | 9 |
10 import org.chromium.base.VisibleForTesting; | 10 import org.chromium.base.VisibleForTesting; |
(...skipping 14 matching lines...) Expand all Loading... |
25 * encapsulated in the embedder's {@link UploadDataSink} and a C++ | 25 * encapsulated in the embedder's {@link UploadDataSink} and a C++ |
26 * UploadDataStreamAdapter, which it owns. It's attached to a {@link | 26 * UploadDataStreamAdapter, which it owns. It's attached to a {@link |
27 * CronetUrlRequest}'s during the construction of request's native C++ objects | 27 * CronetUrlRequest}'s during the construction of request's native C++ objects |
28 * on the network thread, though it's created on one of the embedder's threads. | 28 * on the network thread, though it's created on one of the embedder's threads. |
29 * It is called by the UploadDataStreamAdapter on the network thread, but calls | 29 * It is called by the UploadDataStreamAdapter on the network thread, but calls |
30 * into the UploadDataSink and the UploadDataStreamAdapter on the Executor | 30 * into the UploadDataSink and the UploadDataStreamAdapter on the Executor |
31 * passed into its constructor. | 31 * passed into its constructor. |
32 */ | 32 */ |
33 @JNINamespace("cronet") | 33 @JNINamespace("cronet") |
34 @VisibleForTesting | 34 @VisibleForTesting |
35 public final class CronetUploadDataStream implements UploadDataSink { | 35 public final class CronetUploadDataStream extends UploadDataSink { |
36 private static final String TAG = "CronetUploadDataStream"; | 36 private static final String TAG = "CronetUploadDataStream"; |
37 // These are never changed, once a request starts. | 37 // These are never changed, once a request starts. |
38 private final Executor mExecutor; | 38 private final Executor mExecutor; |
39 private final UploadDataProvider mDataProvider; | 39 private final UploadDataProvider mDataProvider; |
40 private long mLength; | 40 private long mLength; |
41 private long mRemainingLength; | 41 private long mRemainingLength; |
42 private CronetUrlRequest mRequest; | 42 private CronetUrlRequest mRequest; |
43 | 43 |
44 // Reusable read task, to reduce redundant memory allocation. | 44 // Reusable read task, to reduce redundant memory allocation. |
45 private final Runnable mReadTask = new Runnable() { | 45 private final Runnable mReadTask = new Runnable() { |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 | 386 |
387 @NativeClassQualifiedName("CronetUploadDataStreamAdapter") | 387 @NativeClassQualifiedName("CronetUploadDataStreamAdapter") |
388 private native void nativeOnReadSucceeded(long nativePtr, int bytesRead, boo
lean finalChunk); | 388 private native void nativeOnReadSucceeded(long nativePtr, int bytesRead, boo
lean finalChunk); |
389 | 389 |
390 @NativeClassQualifiedName("CronetUploadDataStreamAdapter") | 390 @NativeClassQualifiedName("CronetUploadDataStreamAdapter") |
391 private native void nativeOnRewindSucceeded(long nativePtr); | 391 private native void nativeOnRewindSucceeded(long nativePtr); |
392 | 392 |
393 @NativeClassQualifiedName("CronetUploadDataStreamAdapter") | 393 @NativeClassQualifiedName("CronetUploadDataStreamAdapter") |
394 private static native void nativeDestroy(long nativePtr); | 394 private static native void nativeDestroy(long nativePtr); |
395 } | 395 } |
OLD | NEW |