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

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

Issue 794493002: Add UMA Histogram Manager to Cronet. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moved histogram_manager_unittest to components/metrics Created 6 years 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/histogram_manager.cc
diff --git a/components/cronet/android/histogram_manager.cc b/components/cronet/android/histogram_manager.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0c857911405fb08012c70899327fb5b39178c32b
--- /dev/null
+++ b/components/cronet/android/histogram_manager.cc
@@ -0,0 +1,37 @@
+// Copyright 2014 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/histogram_manager.h"
+
+#include <string>
+#include <vector>
+
+#include "base/android/jni_array.h"
+#include "components/metrics/histogram_manager.h"
+
+#include "jni/HistogramManager_jni.h"
+
+namespace cronet {
+
+// Explicitly register static JNI functions.
+bool HistogramManagerRegisterJni(JNIEnv* env) {
+ return RegisterNativesImpl(env);
+}
+
+HistogramManager::HistogramManager() {
Alexei Svitkine (slow) 2014/12/11 20:09:09 Remove?
ramant (doing other things) 2014/12/11 20:23:53 Done.
+}
+
+HistogramManager::~HistogramManager() {
+}
+
+static jbyteArray GetHistogramDeltas(JNIEnv* env, jobject jcaller) {
+ std::vector<uint8> data =
+ metrics::HistogramManager::GetInstance()->GetDeltas();
+ if (!data.empty()) {
+ return base::android::ToJavaByteArray(env, &data[0], data.size()).Release();
+ }
+ return NULL;
+}
+
+} // namespace cronet

Powered by Google App Engine
This is Rietveld 408576698