Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Side by Side Diff: base/android/jni_android.h

Issue 54923002: Android: Allow duplicate calls to InitApplicationContext. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | base/android/jni_android.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_ANDROID_JNI_ANDROID_H_ 5 #ifndef BASE_ANDROID_JNI_ANDROID_H_
6 #define BASE_ANDROID_JNI_ANDROID_H_ 6 #define BASE_ANDROID_JNI_ANDROID_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 #include <sys/types.h> 9 #include <sys/types.h>
10 10
(...skipping 23 matching lines...) Expand all
34 // Initializes the global JVM. It is not necessarily called before 34 // Initializes the global JVM. It is not necessarily called before
35 // InitApplicationContext(). 35 // InitApplicationContext().
36 BASE_EXPORT void InitVM(JavaVM* vm); 36 BASE_EXPORT void InitVM(JavaVM* vm);
37 37
38 // Returns true if the global JVM has been initialized. 38 // Returns true if the global JVM has been initialized.
39 BASE_EXPORT bool IsVMInitialized(); 39 BASE_EXPORT bool IsVMInitialized();
40 40
41 // Initializes the global application context object. The |context| can be any 41 // Initializes the global application context object. The |context| can be any
42 // valid reference to the application context. Internally holds a global ref to 42 // valid reference to the application context. Internally holds a global ref to
43 // the context. InitVM and InitApplicationContext maybe called in either order. 43 // the context. InitVM and InitApplicationContext maybe called in either order.
44 BASE_EXPORT void InitApplicationContext(const JavaRef<jobject>& context); 44 BASE_EXPORT void InitApplicationContext(JNIEnv* env,
45 const JavaRef<jobject>& context);
45 46
46 // Gets a global ref to the application context set with 47 // Gets a global ref to the application context set with
47 // InitApplicationContext(). Ownership is retained by the function - the caller 48 // InitApplicationContext(). Ownership is retained by the function - the caller
48 // must NOT release it. 49 // must NOT release it.
49 const BASE_EXPORT jobject GetApplicationContext(); 50 const BASE_EXPORT jobject GetApplicationContext();
50 51
51 // Finds the class named |class_name| and returns it. 52 // Finds the class named |class_name| and returns it.
52 // Use this method instead of invoking directly the JNI FindClass method (to 53 // Use this method instead of invoking directly the JNI FindClass method (to
53 // prevent leaking local references). 54 // prevent leaking local references).
54 // This method triggers a fatal assertion if the class could not be found. 55 // This method triggers a fatal assertion if the class could not be found.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // and returns true. 91 // and returns true.
91 BASE_EXPORT bool ClearException(JNIEnv* env); 92 BASE_EXPORT bool ClearException(JNIEnv* env);
92 93
93 // This function will call CHECK() macro if there's any pending exception. 94 // This function will call CHECK() macro if there's any pending exception.
94 BASE_EXPORT void CheckException(JNIEnv* env); 95 BASE_EXPORT void CheckException(JNIEnv* env);
95 96
96 } // namespace android 97 } // namespace android
97 } // namespace base 98 } // namespace base
98 99
99 #endif // BASE_ANDROID_JNI_ANDROID_H_ 100 #endif // BASE_ANDROID_JNI_ANDROID_H_
OLDNEW
« no previous file with comments | « no previous file | base/android/jni_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698