1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_JAVA_JNI_HELPER_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_JAVA_JNI_HELPER_H_
10 #include "base/android/scoped_java_ref.h"
11 #include "content/common/content_export.h"
15 // Gets the method ID from the class name. Clears the pending Java exception
16 // and returns NULL if the method is not found. Caches results.
17 // Strings passed to this function are held in the cache and MUST remain valid
18 // beyond the duration of all future calls to this function, across all
19 // threads. In practice, this means that the function should only be used with
21 CONTENT_EXPORT jmethodID GetMethodIDFromClassName(JNIEnv* env,
22 const char* class_name,
24 const char* jni_signature);
26 // Gets the field ID for a class field.
27 // This method triggers a fatal assertion if the field could not be found.
28 CONTENT_EXPORT jfieldID GetFieldID(JNIEnv* env,
29 const base::android::JavaRef<jclass>& clazz,
30 const char* field_name,
31 const char* jni_signature);
33 } // namespace content
35 #endif // CONTENT_BROWSER_RENDERER_HOST_JAVA_JNI_HELPER_H_