| 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 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 } | 622 } |
| 623 | 623 |
| 624 /** | 624 /** |
| 625 * Called by the native code to report metrics just before the native adapter
is destroyed. | 625 * Called by the native code to report metrics just before the native adapter
is destroyed. |
| 626 */ | 626 */ |
| 627 @SuppressWarnings("unused") | 627 @SuppressWarnings("unused") |
| 628 @CalledByNative | 628 @CalledByNative |
| 629 private void onMetricsCollected(long requestStartMs, long dnsStartMs, long d
nsEndMs, | 629 private void onMetricsCollected(long requestStartMs, long dnsStartMs, long d
nsEndMs, |
| 630 long connectStartMs, long connectEndMs, long sslStartMs, long sslEnd
Ms, | 630 long connectStartMs, long connectEndMs, long sslStartMs, long sslEnd
Ms, |
| 631 long sendingStartMs, long sendingEndMs, long pushStartMs, long pushE
ndMs, | 631 long sendingStartMs, long sendingEndMs, long pushStartMs, long pushE
ndMs, |
| 632 long responseStartMs, long responseEndMs, boolean socketReused, long
sentBytesCount, | 632 long responseStartMs, long requestEndMs, boolean socketReused, long
sentBytesCount, |
| 633 long receivedBytesCount) { | 633 long receivedBytesCount) { |
| 634 synchronized (mNativeStreamLock) { | 634 synchronized (mNativeStreamLock) { |
| 635 if (mMetrics != null) { | 635 if (mMetrics != null) { |
| 636 throw new IllegalStateException("Metrics collection should only
happen once."); | 636 throw new IllegalStateException("Metrics collection should only
happen once."); |
| 637 } | 637 } |
| 638 mMetrics = new CronetMetrics(requestStartMs, dnsStartMs, dnsEndMs, c
onnectStartMs, | 638 mMetrics = new CronetMetrics(requestStartMs, dnsStartMs, dnsEndMs, c
onnectStartMs, |
| 639 connectEndMs, sslStartMs, sslEndMs, sendingStartMs, sendingE
ndMs, pushStartMs, | 639 connectEndMs, sslStartMs, sslEndMs, sendingStartMs, sendingE
ndMs, pushStartMs, |
| 640 pushEndMs, responseStartMs, responseEndMs, socketReused, sen
tBytesCount, | 640 pushEndMs, responseStartMs, requestEndMs, socketReused, sent
BytesCount, |
| 641 receivedBytesCount); | 641 receivedBytesCount); |
| 642 // TODO(xunjieli): Fill this with real values. | 642 // TODO(xunjieli): Fill this with real values. |
| 643 final RequestFinishedInfo requestFinishedInfo = | 643 final RequestFinishedInfo requestFinishedInfo = |
| 644 new RequestFinishedInfo(mInitialUrl, mRequestAnnotations, mM
etrics, | 644 new RequestFinishedInfo(mInitialUrl, mRequestAnnotations, mM
etrics, |
| 645 RequestFinishedInfo.SUCCEEDED, mResponseInfo, null); | 645 RequestFinishedInfo.SUCCEEDED, mResponseInfo, null); |
| 646 mRequestContext.reportFinished(requestFinishedInfo); | 646 mRequestContext.reportFinished(requestFinishedInfo); |
| 647 } | 647 } |
| 648 } | 648 } |
| 649 | 649 |
| 650 @VisibleForTesting | 650 @VisibleForTesting |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 private native boolean nativeReadData( | 792 private native boolean nativeReadData( |
| 793 long nativePtr, ByteBuffer byteBuffer, int position, int limit); | 793 long nativePtr, ByteBuffer byteBuffer, int position, int limit); |
| 794 | 794 |
| 795 @NativeClassQualifiedName("CronetBidirectionalStreamAdapter") | 795 @NativeClassQualifiedName("CronetBidirectionalStreamAdapter") |
| 796 private native boolean nativeWritevData(long nativePtr, ByteBuffer[] buffers
, int[] positions, | 796 private native boolean nativeWritevData(long nativePtr, ByteBuffer[] buffers
, int[] positions, |
| 797 int[] limits, boolean endOfStream); | 797 int[] limits, boolean endOfStream); |
| 798 | 798 |
| 799 @NativeClassQualifiedName("CronetBidirectionalStreamAdapter") | 799 @NativeClassQualifiedName("CronetBidirectionalStreamAdapter") |
| 800 private native void nativeDestroy(long nativePtr, boolean sendOnCanceled); | 800 private native void nativeDestroy(long nativePtr, boolean sendOnCanceled); |
| 801 } | 801 } |
| OLD | NEW |