diff options
author | michaelbai@google.com <michaelbai@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-02 16:11:16 +0000 |
---|---|---|
committer | michaelbai@google.com <michaelbai@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-02 16:11:16 +0000 |
commit | 61c86c6a23ab32e81337f66f1b958d8ec3e8bd45 (patch) | |
tree | 64f18cd34be5ad9ec1140c3e334f5483af8af462 /base/android/jni_android.h | |
parent | eccefee0229e222c0130dca22412b4dccfa3f181 (diff) | |
download | chromium_src-61c86c6a23ab32e81337f66f1b958d8ec3e8bd45.zip chromium_src-61c86c6a23ab32e81337f66f1b958d8ec3e8bd45.tar.gz chromium_src-61c86c6a23ab32e81337f66f1b958d8ec3e8bd45.tar.bz2 |
Android's paths and message loop implementation with JNI
BUG=
TEST=
Review URL: http://codereview.chromium.org/7518032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95085 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/android/jni_android.h')
-rw-r--r-- | base/android/jni_android.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/base/android/jni_android.h b/base/android/jni_android.h new file mode 100644 index 0000000..0e34724 --- /dev/null +++ b/base/android/jni_android.h @@ -0,0 +1,45 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef BASE_ANDROID_JNI_ANDROID_H_ +#define BASE_ANDROID_JNI_ANDROID_H_ + +#include <jni.h> +#include <sys/types.h> + +namespace base { +namespace android { + +// Attach the current thread to the VM (if necessary) and return the JNIEnv*. +JNIEnv* AttachCurrentThread(); + +// Detach the current thread from VM if it is attached. +void DetachFromVM(); + +// Initializes the global JVM. It is not necessarily called before +// InitApplicationContext(). +void InitVM(JavaVM* vm); + +// Initializes the global application context object. The |context| should be +// the global reference of application context object. It is not necessarily +// called after InitVM(). +// TODO: We might combine InitVM() and InitApplicationContext() into one method. +void InitApplicationContext(jobject context); + +jobject GetApplicationContext(); + +// Get the method ID for a method. Will clear the pending Java +// exception and return 0 if the method is not found. +jmethodID GetMethodID(JNIEnv* env, + jclass clazz, + const char* const method, + const char* const jni_signature); + +// Returns true if an exception is pending in the provided JNIEnv*. +// If an exception is pending, it is printed. +bool CheckException(JNIEnv* env); + +} // namespace android +} // namespace base +#endif |