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

Unified Diff: components/cronet/android/metrics_util.cc

Issue 2360813003: [Cronet] Pass metrics information from C++ BidirectionalStream to Java (Closed)
Patch Set: Rebased Created 4 years, 2 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/metrics_util.cc
diff --git a/components/cronet/android/metrics_util.cc b/components/cronet/android/metrics_util.cc
new file mode 100644
index 0000000000000000000000000000000000000000..de18baaeab2222f5edec924d8debf03bbe9e05c4
--- /dev/null
+++ b/components/cronet/android/metrics_util.cc
@@ -0,0 +1,25 @@
+// 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.
+
+#include "components/cronet/android/metrics_util.h"
+
+#include "base/logging.h"
+
+namespace cronet {
+
+namespace metrics_util {
+
+int64_t ConvertTime(const base::TimeTicks& ticks,
+ const base::TimeTicks& start_ticks,
+ const base::Time& start_time) {
+ if (ticks.is_null() || start_ticks.is_null()) {
+ return -1;
+ }
+ DCHECK(!start_time.is_null());
+ return (start_time + (ticks - start_ticks)).ToJavaTime();
+}
+
+} // namespace metrics_util
+
+} // namespace cronet

Powered by Google App Engine
This is Rietveld 408576698