diff options
author | pkotwicz <pkotwicz@chromium.org> | 2015-04-09 09:30:31 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-09 16:31:28 +0000 |
commit | 40c037c1fa0a2913b74e2b148ee127d81ccb38f0 (patch) | |
tree | a42aa369e743e040087fcca28bbbe89d02e88cfa /base/android/record_user_action.cc | |
parent | 87a51a7345593c850ed196791c66cc6ab30479a0 (diff) | |
download | chromium_src-40c037c1fa0a2913b74e2b148ee127d81ccb38f0.zip chromium_src-40c037c1fa0a2913b74e2b148ee127d81ccb38f0.tar.gz chromium_src-40c037c1fa0a2913b74e2b148ee127d81ccb38f0.tar.bz2 |
Added RecordUserAction.record() to avoid having to add a JNI call per UMA action
This CL:
- Adds RecordUserAction.record() and changes the UmaBridge callsites to
use RecordUserAction.record() instead. This routes all of the UMA action
recording through the same JNI call and avoids having to add a JNI call
for each new user action.
- Modifies the extract_actions.py script to extract UMA actions for string
literals parsed to RecordUserAction.record()
BUG=428903
Review URL: https://codereview.chromium.org/1055933002
Cr-Commit-Position: refs/heads/master@{#324458}
Diffstat (limited to 'base/android/record_user_action.cc')
-rw-r--r-- | base/android/record_user_action.cc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/base/android/record_user_action.cc b/base/android/record_user_action.cc new file mode 100644 index 0000000..6172f2e --- /dev/null +++ b/base/android/record_user_action.cc @@ -0,0 +1,24 @@ +// 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/record_user_action.h" + +#include "base/android/jni_string.h" +#include "base/metrics/user_metrics.h" +#include "jni/RecordUserAction_jni.h" + +namespace base { +namespace android { + +static void RecordUserAction(JNIEnv* env, jclass clazz, jstring j_action) { + RecordComputedAction(ConvertJavaStringToUTF8(env, j_action)); +} + +// Register native methods +bool RegisterRecordUserAction(JNIEnv* env) { + return RegisterNativesImpl(env); +} + +} // namespace android +} // namespace base |