xref: /aosp_15_r20/external/cronet/base/android/jni_registrar.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2012 The Chromium Authors
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 "base/android/jni_registrar.h"
6 
7 #include "base/android/jni_android.h"
8 #include "base/logging.h"
9 #include "base/trace_event/base_tracing.h"
10 
11 namespace base {
12 namespace android {
13 
RegisterNativeMethods(JNIEnv * env,const RegistrationMethod * method,size_t count)14 bool RegisterNativeMethods(JNIEnv* env,
15                            const RegistrationMethod* method,
16                            size_t count) {
17   TRACE_EVENT0("startup", "base_android::RegisterNativeMethods");
18   const RegistrationMethod* end = method + count;
19   while (method != end) {
20     if (!method->func(env)) {
21       DLOG(ERROR) << method->name << " failed registration!";
22       return false;
23     }
24     method++;
25   }
26   return true;
27 }
28 
29 }  // namespace android
30 }  // namespace base
31