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

Unified Diff: base/android/jni_android.h

Issue 8894002: Clean up base::android::Init/GetApplicationContext() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/android/jni_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/android/jni_android.h
diff --git a/base/android/jni_android.h b/base/android/jni_android.h
index 08e4b6dc96dec4a45479305c92a5e82005967c31..a5571e023fb87060a3b410d18eccb7124135fad9 100644
--- a/base/android/jni_android.h
+++ b/base/android/jni_android.h
@@ -8,6 +8,8 @@
#include <jni.h>
#include <sys/types.h>
+#include "base/android/scoped_java_ref.h"
+
namespace base {
namespace android {
@@ -21,13 +23,15 @@ void DetachFromVM();
// 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().
+// Initializes the global application context object. The |context| can be any
+// valid reference to the application context. Internally holds a global ref to
+// the context. InitVM and InitApplicationContext maybe called in either order.
// TODO: We might combine InitVM() and InitApplicationContext() into one method.
-void InitApplicationContext(jobject context);
+void InitApplicationContext(const JavaRef<jobject>& context);
-// Returns the application context assigned by InitApplicationContext().
+// Gets a global ref to the application context set with
+// InitApplicationContext(). Ownership is retained by the function - the caller
+// must NOT release it.
jobject GetApplicationContext();
// Gets the method ID from the class name. Clears the pending Java exception
« 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