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 "components/metrics/histogram_manager.h" | |
12 | |
13 #include "jni/HistogramManager_jni.h" | |
14 | |
15 namespace cronet { | |
16 | |
17 // Explicitly register static JNI functions. | |
18 bool HistogramManagerRegisterJni(JNIEnv* env) { | |
19 return RegisterNativesImpl(env); | |
20 } | |
21 | |
22 static jbyteArray GetHistogramDeltas(JNIEnv* env, jobject jcaller) { | |
23 std::vector<uint8> data; | |
24 if (!metrics::HistogramManager::GetInstance()->GetDeltas(&data)) | |
25 return NULL; | |
26 return base::android::ToJavaByteArray(env, &data[0], data.size()).Release(); | |
27 } | |
28 | |
29 } // namespace cronet | |
OLD | NEW |