Remove obsolete entries from .gitignore.
[chromium-blink-merge.git] / components / cronet / android / cronet_histogram_manager.cc
blobca7c3f070a256b9b61abe678898402accc0fd0b0
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.
5 #include "components/cronet/android/cronet_histogram_manager.h"
7 #include <string>
8 #include <vector>
10 #include "base/android/jni_array.h"
11 #include "base/metrics/statistics_recorder.h"
12 #include "components/cronet/histogram_manager.h"
14 #include "jni/CronetHistogramManager_jni.h"
16 namespace cronet {
18 // Explicitly register static JNI functions.
19 bool CronetHistogramManagerRegisterJni(JNIEnv* env) {
20 return RegisterNativesImpl(env);
23 static void EnsureInitialized(JNIEnv* env,
24 const JavaParamRef<jobject>& jcaller) {
25 base::StatisticsRecorder::Initialize();
28 static ScopedJavaLocalRef<jbyteArray> GetHistogramDeltas(
29 JNIEnv* env,
30 const JavaParamRef<jobject>& jcaller) {
31 std::vector<uint8> data;
32 if (!HistogramManager::GetInstance()->GetDeltas(&data))
33 return ScopedJavaLocalRef<jbyteArray>();
34 return base::android::ToJavaByteArray(env, &data[0], data.size());
37 } // namespace cronet