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

Unified Diff: base/android/jni_android.cc

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 | « base/android/jni_android.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/android/jni_android.cc
diff --git a/base/android/jni_android.cc b/base/android/jni_android.cc
index dca2ca439d8a14cf6d6e1fc6a1426770ac99e1eb..a746fd4e47389586a4876b795ab84bad6cf533fb 100644
--- a/base/android/jni_android.cc
+++ b/base/android/jni_android.cc
@@ -6,7 +6,6 @@
#include <map>
-#include "base/android/scoped_java_ref.h"
#include "base/atomicops.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
@@ -55,7 +54,6 @@ namespace android {
JNIEnv* AttachCurrentThread() {
if (!g_jvm)
return NULL;
-
JNIEnv* env = NULL;
jint ret = g_jvm->AttachCurrentThread(&env, NULL);
DCHECK_EQ(ret, JNI_OK);
@@ -74,9 +72,9 @@ void InitVM(JavaVM* vm) {
g_jvm = vm;
}
-void InitApplicationContext(jobject context) {
+void InitApplicationContext(const JavaRef<jobject>& context) {
DCHECK(!g_application_context);
- g_application_context = context;
+ g_application_context = context.env()->NewGlobalRef(context.obj());
}
jobject GetApplicationContext() {
« no previous file with comments | « base/android/jni_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698