blob: 613c47e9b767a9ca5d63a1b6cc9e377e5d20ff3c [file] [log] [blame]
Elliott Hugheseac76672012-05-24 21:56:51 -07001/*
2 * Copyright (C) 2012 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 */
16
17#ifndef ART_SRC_WELL_KNOWN_CLASSES_H_
18#define ART_SRC_WELL_KNOWN_CLASSES_H_
19
20#include "jni.h"
21
22namespace art {
23
Elliott Hughesaf8d15a2012-05-29 09:12:18 -070024class Class;
25
Elliott Hugheseac76672012-05-24 21:56:51 -070026// Various classes used in JNI. We cache them so we don't have to keep looking
27// them up. Similar to libcore's JniConstants (except there's no overlap, so
28// we keep them separate).
29
30struct WellKnownClasses {
31 static void Init(JNIEnv* env);
32
Elliott Hughesaf8d15a2012-05-29 09:12:18 -070033 static Class* ToClass(jclass global_jclass);
34
Elliott Hugheseac76672012-05-24 21:56:51 -070035 static jclass com_android_dex_Dex;
36 static jclass java_lang_ClassLoader;
37 static jclass java_lang_ClassNotFoundException;
38 static jclass java_lang_Daemons;
39 static jclass java_lang_Error;
40 static jclass java_lang_ExceptionInInitializerError;
41 static jclass java_lang_reflect_InvocationHandler;
42 static jclass java_lang_reflect_Method;
43 static jclass java_lang_reflect_Proxy;
44 static jclass java_lang_reflect_UndeclaredThrowableException;
45 static jclass java_lang_Thread;
Elliott Hughesaf8d15a2012-05-29 09:12:18 -070046 static jclass java_lang_ThreadGroup;
47 static jclass java_lang_ThreadLock;
48 static jclass java_lang_Thread$UncaughtExceptionHandler;
Elliott Hugheseac76672012-05-24 21:56:51 -070049 static jclass java_nio_ReadWriteDirectByteBuffer;
50 static jclass org_apache_harmony_dalvik_ddmc_Chunk;
51 static jclass org_apache_harmony_dalvik_ddmc_DdmServer;
52
53 static jmethodID com_android_dex_Dex_create;
54 static jmethodID java_lang_ClassNotFoundException_init;
55 static jmethodID java_lang_Daemons_requestHeapTrim;
56 static jmethodID java_lang_Daemons_start;
57 static jmethodID java_lang_reflect_InvocationHandler_invoke;
58 static jmethodID java_lang_Thread_init;
Elliott Hughesaf8d15a2012-05-29 09:12:18 -070059 static jmethodID java_lang_Thread_run;
60 static jmethodID java_lang_Thread$UncaughtExceptionHandler_uncaughtException;
61 static jmethodID java_lang_ThreadGroup_removeThread;
Elliott Hugheseac76672012-05-24 21:56:51 -070062 static jmethodID java_nio_ReadWriteDirectByteBuffer_init;
63 static jmethodID org_apache_harmony_dalvik_ddmc_DdmServer_broadcast;
64 static jmethodID org_apache_harmony_dalvik_ddmc_DdmServer_dispatch;
65
66 static jfieldID java_lang_reflect_Proxy_h;
Elliott Hughesaf8d15a2012-05-29 09:12:18 -070067 static jfieldID java_lang_Thread_daemon;
68 static jfieldID java_lang_Thread_group;
69 static jfieldID java_lang_Thread_lock;
70 static jfieldID java_lang_Thread_name;
71 static jfieldID java_lang_Thread_priority;
72 static jfieldID java_lang_Thread_uncaughtHandler;
73 static jfieldID java_lang_Thread_vmData;
74 static jfieldID java_lang_ThreadGroup_mainThreadGroup;
75 static jfieldID java_lang_ThreadGroup_name;
76 static jfieldID java_lang_ThreadGroup_systemThreadGroup;
77 static jfieldID java_lang_ThreadLock_thread;
Elliott Hugheseac76672012-05-24 21:56:51 -070078 static jfieldID java_nio_ReadWriteDirectByteBuffer_capacity;
79 static jfieldID java_nio_ReadWriteDirectByteBuffer_effectiveDirectAddress;
80 static jfieldID org_apache_harmony_dalvik_ddmc_Chunk_data;
81 static jfieldID org_apache_harmony_dalvik_ddmc_Chunk_length;
82 static jfieldID org_apache_harmony_dalvik_ddmc_Chunk_offset;
83 static jfieldID org_apache_harmony_dalvik_ddmc_Chunk_type;
84};
85
86} // namespace art
87
88#endif // ART_SRC_WELL_KNOWN_CLASSES_H_