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

Unified Diff: content/browser/android/java/gin_java_bridge_dispatcher_host.cc

Issue 767453003: [Android] Fix a subtle issue in Java Bridge regarding interfaces removal (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 | content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeBasicsTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/android/java/gin_java_bridge_dispatcher_host.cc
diff --git a/content/browser/android/java/gin_java_bridge_dispatcher_host.cc b/content/browser/android/java/gin_java_bridge_dispatcher_host.cc
index c0b20b975abde48041526e049028b6c35ca18d72..c8fb2fd989962a0d27e7e59b46f4cfbf32a7c399 100644
--- a/content/browser/android/java/gin_java_bridge_dispatcher_host.cc
+++ b/content/browser/android/java/gin_java_bridge_dispatcher_host.cc
@@ -210,18 +210,10 @@ void GinJavaBridgeDispatcherHost::RemoveNamedObject(
named_objects_.erase(iter);
object->RemoveName();
- // Not erasing from the objects map, as we can still receive method
- // invocation requests for this object, and they should work until the
- // java object is gone.
- if (!object->IsNamed()) {
- JNIEnv* env = base::android::AttachCurrentThread();
- base::android::ScopedJavaLocalRef<jobject> retained_object_set =
- retained_object_set_.get(env);
- if (!retained_object_set.is_null()) {
- JNI_Java_HashSet_remove(
- env, retained_object_set, object->GetLocalRef(env));
- }
- }
+ // As the object isn't going to be removed from the JavaScript side until the
+ // next page reload, calls to it must still work, thus we should continue to
+ // hold it. All the transient objects and removed named objects will be purged
+ // during the cleansing caused by DocumentAvailableInMainFrame event.
web_contents()->SendToAllFrames(
new GinJavaBridgeMsg_RemoveNamedObject(MSG_ROUTING_NONE, copied_name));
« no previous file with comments | « no previous file | content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeBasicsTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698