blob: 7c72604ee5ffda3ffe07dbdf2bc5c8ae48170a65 [file] [log] [blame]
Elliott Hughesbf86d042011-08-31 17:53:14 -07001/*
2 * Copyright (C) 2008 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#include "jni_internal.h"
18#include "object.h"
19
20#include "JniConstants.h" // Last to avoid problems with LOG redefinition.
21
22namespace art {
23
24namespace {
25
Elliott Hughesbf86d042011-08-31 17:53:14 -070026jobject Object_internalClone(JNIEnv* env, jobject javaThis) {
Brian Carlstromb82b6872011-10-26 17:18:07 -070027 ScopedThreadStateChange tsc(Thread::Current(), Thread::kRunnable);
Elliott Hughesbf86d042011-08-31 17:53:14 -070028 Object* o = Decode<Object*>(env, javaThis);
29 return AddLocalReference<jobject>(env, o->Clone());
30}
31
32void Object_notify(JNIEnv* env, jobject javaThis) {
33 Object* o = Decode<Object*>(env, javaThis);
34 o->Notify();
35}
36
37void Object_notifyAll(JNIEnv* env, jobject javaThis) {
38 Object* o = Decode<Object*>(env, javaThis);
39 o->NotifyAll();
40}
41
42void Object_wait(JNIEnv* env, jobject javaThis, jlong ms, jint ns) {
43 Object* o = Decode<Object*>(env, javaThis);
44 o->Wait(ms, ns);
45}
46
47JNINativeMethod gMethods[] = {
Elliott Hughesbf86d042011-08-31 17:53:14 -070048 NATIVE_METHOD(Object, internalClone, "(Ljava/lang/Cloneable;)Ljava/lang/Object;"),
49 NATIVE_METHOD(Object, notify, "()V"),
50 NATIVE_METHOD(Object, notifyAll, "()V"),
51 NATIVE_METHOD(Object, wait, "(JI)V"),
52};
53
54} // namespace
55
56void register_java_lang_Object(JNIEnv* env) {
57 jniRegisterNativeMethods(env, "java/lang/Object", gMethods, NELEM(gMethods));
58}
59
60} // namespace art