| Index: base/android/jni_registrar.cc
|
| diff --git a/base/android/jni_registrar.cc b/base/android/jni_registrar.cc
|
| index 696924a09d03ef4a768f0ec06614c05bd5f8972f..637e27a8c4b46529ea31038aacb867a1f6c97ffd 100644
|
| --- a/base/android/jni_registrar.cc
|
| +++ b/base/android/jni_registrar.cc
|
| @@ -4,12 +4,44 @@
|
|
|
| #include "base/android/jni_registrar.h"
|
|
|
| +#include <vector>
|
| #include "base/logging.h"
|
| #include "base/android/jni_android.h"
|
|
|
| namespace base {
|
| namespace android {
|
|
|
| +typedef std::vector<RegistrationMethod> RegistrationMethodList;
|
| +
|
| +// Retrieve a reference to the global RegistrationMethods list.
|
| +RegistrationMethodList &GetRegistrationMethodList() {
|
| + static RegistrationMethodList test_registration_method_list;
|
| + return test_registration_method_list;
|
| +}
|
| +
|
| +AppendRegistrationMethods::AppendRegistrationMethods(
|
| + const RegistrationMethod* methods, size_t count) {
|
| + const RegistrationMethod* end = methods + count;
|
| + while (methods != end) {
|
| + GetRegistrationMethodList().push_back(*methods);
|
| + LOG(ERROR) << "Adding method:" << methods->name;
|
| + methods++;
|
| + }
|
| +}
|
| +
|
| +bool RegisterAllNativeMethodsForTest(JNIEnv* env) {
|
| + RegistrationMethodList& native_methods = GetRegistrationMethodList();
|
| + for (RegistrationMethodList::iterator it = native_methods.begin();
|
| + it != native_methods.end(); ++it) {
|
| + if (!it->func(env) < 0) {
|
| + DLOG(ERROR) << it->name << " failed registration!";
|
| + return false;
|
| + }
|
| + LOG(ERROR) << "Registering method:" << it->name;
|
| + }
|
| + return true;
|
| +}
|
| +
|
| bool RegisterNativeMethods(JNIEnv* env,
|
| const RegistrationMethod* method,
|
| size_t count) {
|
|
|