| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "components/cronet/android/histogram_manager.h" | |
| 6 | |
| 7 #include <string> | |
| 8 #include <vector> | |
| 9 | |
| 10 #include "base/android/jni_array.h" | |
| 11 #include "base/metrics/statistics_recorder.h" | |
| 12 #include "components/metrics/histogram_manager.h" | |
| 13 | |
| 14 #include "jni/HistogramManager_jni.h" | |
| 15 | |
| 16 namespace cronet { | |
| 17 | |
| 18 // Explicitly register static JNI functions. | |
| 19 bool HistogramManagerRegisterJni(JNIEnv* env) { | |
| 20 return RegisterNativesImpl(env); | |
| 21 } | |
| 22 | |
| 23 static void EnsureInitialized(JNIEnv* env, jobject jcaller) { | |
| 24 base::StatisticsRecorder::Initialize(); | |
| 25 } | |
| 26 | |
| 27 static jbyteArray GetHistogramDeltas(JNIEnv* env, jobject jcaller) { | |
| 28 std::vector<uint8> data; | |
| 29 if (!metrics::HistogramManager::GetInstance()->GetDeltas(&data)) | |
| 30 return NULL; | |
| 31 return base::android::ToJavaByteArray(env, &data[0], data.size()).Release(); | |
| 32 } | |
| 33 | |
| 34 } // namespace cronet | |
| OLD | NEW |