Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(878)

Unified Diff: components/cronet/android/api/src/org/chromium/net/UrlRequestMetrics.java

Issue 2204533002: Move Cronet metrics-related classes into their own files (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/cronet/android/api/src/org/chromium/net/UrlRequestMetrics.java
diff --git a/components/cronet/android/api/src/org/chromium/net/UrlRequestMetrics.java b/components/cronet/android/api/src/org/chromium/net/UrlRequestMetrics.java
new file mode 100644
index 0000000000000000000000000000000000000000..1753bfaa700d2e7a839b64a9928e5ef3ab812353
--- /dev/null
+++ b/components/cronet/android/api/src/org/chromium/net/UrlRequestMetrics.java
@@ -0,0 +1,65 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.net;
+
+import android.support.annotation.Nullable;
+
+/**
+ * Metrics collected for a single request.
+ *
+ * {@hide} as it's a prototype.
+ */
+public final class UrlRequestMetrics {
+ @Nullable
+ private final Long mTtfbMs;
+ @Nullable
+ private final Long mTotalTimeMs;
+ @Nullable
+ private final Long mSentBytesCount;
+ @Nullable
+ private final Long mReceivedBytesCount;
+
+ public UrlRequestMetrics(@Nullable Long ttfbMs, @Nullable Long totalTimeMs,
+ @Nullable Long sentBytesCount, @Nullable Long receivedBytesCount) {
+ mTtfbMs = ttfbMs;
+ mTotalTimeMs = totalTimeMs;
+ mSentBytesCount = sentBytesCount;
+ mReceivedBytesCount = receivedBytesCount;
+ }
+
+ /**
+ * Returns milliseconds between request initiation and first byte of response headers,
+ * or null if not collected.
+ */
+ @Nullable
+ public Long getTtfbMs() {
+ return mTtfbMs;
+ }
+
+ /**
+ * Returns milliseconds between request initiation and finish,
+ * including a failure or cancellation, or null if not collected.
+ */
+ @Nullable
+ public Long getTotalTimeMs() {
+ return mTotalTimeMs;
+ }
+
+ /**
+ * Returns total bytes sent over the network transport layer, or null if not collected.
+ */
+ @Nullable
+ public Long getSentBytesCount() {
+ return mSentBytesCount;
+ }
+
+ /**
+ * Returns total bytes received over the network transport layer, or null if not collected.
+ */
+ @Nullable
+ public Long getReceivedBytesCount() {
+ return mReceivedBytesCount;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698