Elliott Hughes | 2faa5f1 | 2012-01-30 14:42:07 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
Ian Rogers | df20fe0 | 2011-07-20 20:34:16 -0700 | [diff] [blame] | 16 | |
Brian Carlstrom | fc0e321 | 2013-07-17 14:40:12 -0700 | [diff] [blame] | 17 | #ifndef ART_RUNTIME_JNI_INTERNAL_H_ |
| 18 | #define ART_RUNTIME_JNI_INTERNAL_H_ |
Ian Rogers | df20fe0 | 2011-07-20 20:34:16 -0700 | [diff] [blame] | 19 | |
Ian Rogers | 68d8b42 | 2014-07-17 11:09:10 -0700 | [diff] [blame] | 20 | #include <jni.h> |
Elliott Hughes | ae80b49 | 2012-04-24 10:43:17 -0700 | [diff] [blame] | 21 | #include <iosfwd> |
Elliott Hughes | 0af5543 | 2011-08-17 18:37:28 -0700 | [diff] [blame] | 22 | |
Elliott Hughes | eac7667 | 2012-05-24 21:56:51 -0700 | [diff] [blame] | 23 | #ifndef NATIVE_METHOD |
| 24 | #define NATIVE_METHOD(className, functionName, signature) \ |
| 25 | { #functionName, signature, reinterpret_cast<void*>(className ## _ ## functionName) } |
| 26 | #endif |
| 27 | #define REGISTER_NATIVE_METHODS(jni_class_name) \ |
| 28 | RegisterNativeMethods(env, jni_class_name, gMethods, arraysize(gMethods)) |
| 29 | |
Ian Rogers | df20fe0 | 2011-07-20 20:34:16 -0700 | [diff] [blame] | 30 | namespace art { |
Ian Rogers | df20fe0 | 2011-07-20 20:34:16 -0700 | [diff] [blame] | 31 | |
Ian Rogers | 68d8b42 | 2014-07-17 11:09:10 -0700 | [diff] [blame] | 32 | const JNINativeInterface* GetJniNativeInterface(); |
| 33 | |
| 34 | // Similar to RegisterNatives except its passed a descriptor for a class name and failures are |
| 35 | // fatal. |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 36 | void RegisterNativeMethods(JNIEnv* env, const char* jni_class_name, const JNINativeMethod* methods, |
Ian Rogers | abd7be9 | 2013-08-15 10:26:54 -0700 | [diff] [blame] | 37 | jint method_count); |
Elliott Hughes | a250199 | 2011-08-26 19:39:54 -0700 | [diff] [blame] | 38 | |
Elliott Hughes | a4f9474 | 2012-05-29 16:28:38 -0700 | [diff] [blame] | 39 | int ThrowNewException(JNIEnv* env, jclass exception_class, const char* msg, jobject cause); |
| 40 | |
Ian Rogers | df20fe0 | 2011-07-20 20:34:16 -0700 | [diff] [blame] | 41 | } // namespace art |
Carl Shapiro | ea4dca8 | 2011-08-01 13:45:38 -0700 | [diff] [blame] | 42 | |
Elliott Hughes | b465ab0 | 2011-08-24 11:21:21 -0700 | [diff] [blame] | 43 | std::ostream& operator<<(std::ostream& os, const jobjectRefType& rhs); |
Ian Rogers | 68d8b42 | 2014-07-17 11:09:10 -0700 | [diff] [blame] | 44 | |
Brian Carlstrom | fc0e321 | 2013-07-17 14:40:12 -0700 | [diff] [blame] | 45 | #endif // ART_RUNTIME_JNI_INTERNAL_H_ |