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.impl; | 5 package org.chromium.net.impl; |
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 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 } | 690 } |
691 | 691 |
692 /** | 692 /** |
693 * Called by the native code to report metrics. | 693 * Called by the native code to report metrics. |
694 */ | 694 */ |
695 @SuppressWarnings("unused") | 695 @SuppressWarnings("unused") |
696 @CalledByNative | 696 @CalledByNative |
697 private void onMetricsCollected(long requestStartMs, long dnsStartMs, long d
nsEndMs, | 697 private void onMetricsCollected(long requestStartMs, long dnsStartMs, long d
nsEndMs, |
698 long connectStartMs, long connectEndMs, long sslStartMs, long sslEnd
Ms, | 698 long connectStartMs, long connectEndMs, long sslStartMs, long sslEnd
Ms, |
699 long sendingStartMs, long sendingEndMs, long pushStartMs, long pushE
ndMs, | 699 long sendingStartMs, long sendingEndMs, long pushStartMs, long pushE
ndMs, |
700 long responseStartMs, long responseEndMs, boolean socketReused, long
sentBytesCount, | 700 long responseStartMs, long requestEndMs, boolean socketReused, long
sentBytesCount, |
701 long receivedBytesCount) { | 701 long receivedBytesCount) { |
702 synchronized (mUrlRequestAdapterLock) { | 702 synchronized (mUrlRequestAdapterLock) { |
703 if (mMetrics != null) { | 703 if (mMetrics != null) { |
704 throw new IllegalStateException("Metrics collection should only
happen once."); | 704 throw new IllegalStateException("Metrics collection should only
happen once."); |
705 } | 705 } |
706 mMetrics = new CronetMetrics(requestStartMs, dnsStartMs, dnsEndMs, c
onnectStartMs, | 706 mMetrics = new CronetMetrics(requestStartMs, dnsStartMs, dnsEndMs, c
onnectStartMs, |
707 connectEndMs, sslStartMs, sslEndMs, sendingStartMs, sendingE
ndMs, pushStartMs, | 707 connectEndMs, sslStartMs, sslEndMs, sendingStartMs, sendingE
ndMs, pushStartMs, |
708 pushEndMs, responseStartMs, responseEndMs, socketReused, sen
tBytesCount, | 708 pushEndMs, responseStartMs, requestEndMs, socketReused, sent
BytesCount, |
709 receivedBytesCount); | 709 receivedBytesCount); |
710 } | 710 } |
711 mRequestContext.reportFinished(getRequestFinishedInfo()); | 711 mRequestContext.reportFinished(getRequestFinishedInfo()); |
712 } | 712 } |
713 | 713 |
714 private RequestFinishedInfo getRequestFinishedInfo() { | 714 private RequestFinishedInfo getRequestFinishedInfo() { |
715 // TODO(mgersh): fill in real values for finishedReason and exception | 715 // TODO(mgersh): fill in real values for finishedReason and exception |
716 return new RequestFinishedInfo(mInitialUrl, mRequestAnnotations, mMetric
s, mFinishedReason, | 716 return new RequestFinishedInfo(mInitialUrl, mRequestAnnotations, mMetric
s, mFinishedReason, |
717 mResponseInfo, mException); | 717 mResponseInfo, mException); |
718 } | 718 } |
(...skipping 26 matching lines...) Expand all Loading... |
745 @NativeClassQualifiedName("CronetURLRequestAdapter") | 745 @NativeClassQualifiedName("CronetURLRequestAdapter") |
746 private native boolean nativeReadData( | 746 private native boolean nativeReadData( |
747 long nativePtr, ByteBuffer byteBuffer, int position, int capacity); | 747 long nativePtr, ByteBuffer byteBuffer, int position, int capacity); |
748 | 748 |
749 @NativeClassQualifiedName("CronetURLRequestAdapter") | 749 @NativeClassQualifiedName("CronetURLRequestAdapter") |
750 private native void nativeDestroy(long nativePtr, boolean sendOnCanceled); | 750 private native void nativeDestroy(long nativePtr, boolean sendOnCanceled); |
751 | 751 |
752 @NativeClassQualifiedName("CronetURLRequestAdapter") | 752 @NativeClassQualifiedName("CronetURLRequestAdapter") |
753 private native void nativeGetStatus(long nativePtr, UrlRequest.StatusListene
r listener); | 753 private native void nativeGetStatus(long nativePtr, UrlRequest.StatusListene
r listener); |
754 } | 754 } |
OLD | NEW |