xref: /aosp_15_r20/external/libchrome/base/android/jni_registrar.cc (revision 635a864187cb8b6c713ff48b7e790a6b21769273)
1*635a8641SAndroid Build Coastguard Worker // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2*635a8641SAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be
3*635a8641SAndroid Build Coastguard Worker // found in the LICENSE file.
4*635a8641SAndroid Build Coastguard Worker 
5*635a8641SAndroid Build Coastguard Worker #include "base/android/jni_registrar.h"
6*635a8641SAndroid Build Coastguard Worker 
7*635a8641SAndroid Build Coastguard Worker #include "base/logging.h"
8*635a8641SAndroid Build Coastguard Worker #include "base/android/jni_android.h"
9*635a8641SAndroid Build Coastguard Worker #include "base/trace_event/trace_event.h"
10*635a8641SAndroid Build Coastguard Worker 
11*635a8641SAndroid Build Coastguard Worker namespace base {
12*635a8641SAndroid Build Coastguard Worker namespace android {
13*635a8641SAndroid Build Coastguard Worker 
RegisterNativeMethods(JNIEnv * env,const RegistrationMethod * method,size_t count)14*635a8641SAndroid Build Coastguard Worker bool RegisterNativeMethods(JNIEnv* env,
15*635a8641SAndroid Build Coastguard Worker                            const RegistrationMethod* method,
16*635a8641SAndroid Build Coastguard Worker                            size_t count) {
17*635a8641SAndroid Build Coastguard Worker   TRACE_EVENT0("startup", "base_android::RegisterNativeMethods")
18*635a8641SAndroid Build Coastguard Worker   const RegistrationMethod* end = method + count;
19*635a8641SAndroid Build Coastguard Worker   while (method != end) {
20*635a8641SAndroid Build Coastguard Worker     if (!method->func(env)) {
21*635a8641SAndroid Build Coastguard Worker       DLOG(ERROR) << method->name << " failed registration!";
22*635a8641SAndroid Build Coastguard Worker       return false;
23*635a8641SAndroid Build Coastguard Worker     }
24*635a8641SAndroid Build Coastguard Worker     method++;
25*635a8641SAndroid Build Coastguard Worker   }
26*635a8641SAndroid Build Coastguard Worker   return true;
27*635a8641SAndroid Build Coastguard Worker }
28*635a8641SAndroid Build Coastguard Worker 
29*635a8641SAndroid Build Coastguard Worker }  // namespace android
30*635a8641SAndroid Build Coastguard Worker }  // namespace base
31