OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 import android.util.Pair; | 8 import android.util.Pair; |
9 | 9 |
10 import org.chromium.base.CalledByNative; | 10 import org.chromium.base.CalledByNative; |
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 mOnReadCompletedTask.mByteBuffer = byteBuffer; | 609 mOnReadCompletedTask.mByteBuffer = byteBuffer; |
610 postTaskToExecutor(mOnReadCompletedTask); | 610 postTaskToExecutor(mOnReadCompletedTask); |
611 } | 611 } |
612 | 612 |
613 /** | 613 /** |
614 * Called when request is completed successfully, no callbacks will be | 614 * Called when request is completed successfully, no callbacks will be |
615 * called afterwards. | 615 * called afterwards. |
616 */ | 616 */ |
617 @SuppressWarnings("unused") | 617 @SuppressWarnings("unused") |
618 @CalledByNative | 618 @CalledByNative |
619 private void onSucceeded() { | 619 private void onSucceeded(long totalReceivedBytes) { |
620 long totalReceivedBytes; | |
621 synchronized (mUrlRequestAdapterLock) { | |
622 if (mUrlRequestAdapter == 0) { | |
623 return; | |
624 } | |
625 totalReceivedBytes = | |
626 nativeGetTotalReceivedBytes(mUrlRequestAdapter); | |
627 } | |
628 | |
629 final NativeExtendedResponseInfo extendedResponseInfo = | 620 final NativeExtendedResponseInfo extendedResponseInfo = |
630 new NativeExtendedResponseInfo(mResponseInfo, | 621 new NativeExtendedResponseInfo(mResponseInfo, |
631 totalReceivedBytes); | 622 totalReceivedBytes); |
632 Runnable task = new Runnable() { | 623 Runnable task = new Runnable() { |
633 public void run() { | 624 public void run() { |
634 synchronized (mUrlRequestAdapterLock) { | 625 synchronized (mUrlRequestAdapterLock) { |
635 if (isCanceled()) { | 626 if (isCanceled()) { |
636 return; | 627 return; |
637 } | 628 } |
638 // Destroy adapter first, so request context could be shut | 629 // Destroy adapter first, so request context could be shut |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 private native void nativePopulateResponseHeaders(long nativePtr, HeadersLis
t headers); | 698 private native void nativePopulateResponseHeaders(long nativePtr, HeadersLis
t headers); |
708 | 699 |
709 @NativeClassQualifiedName("CronetURLRequestAdapter") | 700 @NativeClassQualifiedName("CronetURLRequestAdapter") |
710 private native String nativeGetHttpStatusText(long nativePtr); | 701 private native String nativeGetHttpStatusText(long nativePtr); |
711 | 702 |
712 @NativeClassQualifiedName("CronetURLRequestAdapter") | 703 @NativeClassQualifiedName("CronetURLRequestAdapter") |
713 private native String nativeGetNegotiatedProtocol(long nativePtr); | 704 private native String nativeGetNegotiatedProtocol(long nativePtr); |
714 | 705 |
715 @NativeClassQualifiedName("CronetURLRequestAdapter") | 706 @NativeClassQualifiedName("CronetURLRequestAdapter") |
716 private native boolean nativeGetWasCached(long nativePtr); | 707 private native boolean nativeGetWasCached(long nativePtr); |
717 | |
718 @NativeClassQualifiedName("CronetURLRequestAdapter") | |
719 private native long nativeGetTotalReceivedBytes(long nativePtr); | |
720 } | 708 } |
OLD | NEW |