Chromium Code Reviews| 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 metrics::HistogramManager::GetInstance()->GetDeltas(); | |
|
mef
2014/12/11 23:11:40
qq: how big are deltas? Would this result in extra
ramant (doing other things)
2014/12/12 02:43:05
Do we do return value optimization on Android?
A
| |
| 25 if (!data.empty()) { | |
| 26 return base::android::ToJavaByteArray(env, &data[0], data.size()).Release(); | |
|
mef
2014/12/11 23:11:40
nit: no need for curly braces.
ramant (doing other things)
2014/12/12 02:43:05
Done.
| |
| 27 } | |
| 28 return NULL; | |
| 29 } | |
| 30 | |
| 31 } // namespace cronet | |
| OLD | NEW |