Chromium Code Reviews| Index: base/android/animation_frame_time_histogram.cc |
| diff --git a/base/android/animation_frame_time_histogram.cc b/base/android/animation_frame_time_histogram.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..273a4b5af2726fb186b166207c6546721d420ca2 |
| --- /dev/null |
| +++ b/base/android/animation_frame_time_histogram.cc |
| @@ -0,0 +1,36 @@ |
| +// Copyright 2015 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 "base/android/animation_frame_time_histogram.h" |
| + |
| +#include "base/android/jni_string.h" |
| +#include "base/metrics/histogram_macros.h" |
| +#include "jni/AnimationFrameTimeHistogram_jni.h" |
| + |
| +// static |
| +void SaveHistogram(JNIEnv* env, |
| + jobject jcaller, |
| + jstring j_histogram_name, |
| + jlongArray j_frame_times_ms, |
| + jint j_count) { |
| + jlong *frame_times_ns = env->GetLongArrayElements(j_frame_times_ms, NULL); |
| + std::string histogram_name = base::android::ConvertJavaStringToUTF8( |
| + env, j_histogram_name); |
| + |
| + for (int i = 0; i < j_count; ++i) { |
|
nyquist
2015/02/27 04:02:19
size_t?
Kibeom Kim (inactive)
2015/02/27 19:56:40
Currently j_count is jint type so I'm getting "com
|
| + UMA_HISTOGRAM_TIMES(histogram_name.c_str(), |
| + base::TimeDelta::FromMilliseconds(frame_times_ns[i])); |
| + } |
| +} |
| + |
| +namespace base { |
| +namespace android { |
| + |
| +// static |
| +bool RegisterAnimationFrameTimeHistogram(JNIEnv* env) { |
| + return RegisterNativesImpl(env); |
| +} |
| + |
| +} // namespace android |
| +} // namespace base |