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

Unified Diff: base/android/jni_android.cc

Issue 54923002: Android: Allow duplicate calls to InitApplicationContext. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 months 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') | content/app/android/content_main.cc » ('j') | 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 6dc6a8dac0b1b4d134d1b2834fc24162dd3fc35c..59f25e2e817dbe6ea258d16b65b7d71e5bedb9ec 100644
--- a/base/android/jni_android.cc
+++ b/base/android/jni_android.cc
@@ -97,7 +97,11 @@ bool IsVMInitialized() {
return g_jvm != NULL;
}
-void InitApplicationContext(const JavaRef<jobject>& context) {
+void InitApplicationContext(JNIEnv* env, const JavaRef<jobject>& context) {
+ if (env->IsSameObject(g_application_context.Get().obj(), context.obj())) {
+ // It's safe to set the context more than once if it's the same context.
+ return;
+ }
DCHECK(g_application_context.Get().is_null());
g_application_context.Get().Reset(context);
}
« no previous file with comments | « base/android/jni_android.h ('k') | content/app/android/content_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698