blob: 6a6dd60853023c0a5250e75b792f18986813838c [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;
Elliott Hugheseac76672012-05-24 21:56:51 -070040 static jclass java_lang_reflect_InvocationHandler;
41 static jclass java_lang_reflect_Method;
42 static jclass java_lang_reflect_Proxy;
Elliott Hughesa4f94742012-05-29 16:28:38 -070043 static jclass java_lang_RuntimeException;
Elliott Hugheseac76672012-05-24 21:56:51 -070044 static jclass java_lang_Thread;
Elliott Hughesaf8d15a2012-05-29 09:12:18 -070045 static jclass java_lang_ThreadGroup;
46 static jclass java_lang_ThreadLock;
47 static jclass java_lang_Thread$UncaughtExceptionHandler;
Elliott Hughesa4f94742012-05-29 16:28:38 -070048 static jclass java_lang_Throwable;
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;
Elliott Hughesa4f94742012-05-29 16:28:38 -070054 static jmethodID java_lang_ClassLoader_loadClass;
Elliott Hugheseac76672012-05-24 21:56:51 -070055 static jmethodID java_lang_ClassNotFoundException_init;
56 static jmethodID java_lang_Daemons_requestHeapTrim;
57 static jmethodID java_lang_Daemons_start;
Elliott Hughesa4f94742012-05-29 16:28:38 -070058 static jmethodID java_lang_ref_FinalizerReference_add;
59 static jmethodID java_lang_ref_ReferenceQueue_add;
Elliott Hugheseac76672012-05-24 21:56:51 -070060 static jmethodID java_lang_reflect_InvocationHandler_invoke;
61 static jmethodID java_lang_Thread_init;
Elliott Hughesaf8d15a2012-05-29 09:12:18 -070062 static jmethodID java_lang_Thread_run;
63 static jmethodID java_lang_Thread$UncaughtExceptionHandler_uncaughtException;
64 static jmethodID java_lang_ThreadGroup_removeThread;
Elliott Hugheseac76672012-05-24 21:56:51 -070065 static jmethodID java_nio_ReadWriteDirectByteBuffer_init;
66 static jmethodID org_apache_harmony_dalvik_ddmc_DdmServer_broadcast;
67 static jmethodID org_apache_harmony_dalvik_ddmc_DdmServer_dispatch;
68
69 static jfieldID java_lang_reflect_Proxy_h;
Elliott Hughesaf8d15a2012-05-29 09:12:18 -070070 static jfieldID java_lang_Thread_daemon;
71 static jfieldID java_lang_Thread_group;
72 static jfieldID java_lang_Thread_lock;
73 static jfieldID java_lang_Thread_name;
74 static jfieldID java_lang_Thread_priority;
75 static jfieldID java_lang_Thread_uncaughtHandler;
76 static jfieldID java_lang_Thread_vmData;
77 static jfieldID java_lang_ThreadGroup_mainThreadGroup;
78 static jfieldID java_lang_ThreadGroup_name;
79 static jfieldID java_lang_ThreadGroup_systemThreadGroup;
80 static jfieldID java_lang_ThreadLock_thread;
Elliott Hugheseac76672012-05-24 21:56:51 -070081 static jfieldID java_nio_ReadWriteDirectByteBuffer_capacity;
82 static jfieldID java_nio_ReadWriteDirectByteBuffer_effectiveDirectAddress;
83 static jfieldID org_apache_harmony_dalvik_ddmc_Chunk_data;
84 static jfieldID org_apache_harmony_dalvik_ddmc_Chunk_length;
85 static jfieldID org_apache_harmony_dalvik_ddmc_Chunk_offset;
86 static jfieldID org_apache_harmony_dalvik_ddmc_Chunk_type;
87};
88
89} // namespace art
90
91#endif // ART_SRC_WELL_KNOWN_CLASSES_H_