Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "content/browser/android/java/gin_java_bridge_dispatcher_host.h" | 5 #include "content/browser/android/java/gin_java_bridge_dispatcher_host.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/scoped_java_ref.h" | 8 #include "base/android/scoped_java_ref.h" |
| 9 #include "content/browser/android/java/gin_java_bound_object_delegate.h" | 9 #include "content/browser/android/java/gin_java_bound_object_delegate.h" |
| 10 #include "content/browser/android/java/gin_java_bridge_message_filter.h" | 10 #include "content/browser/android/java/gin_java_bridge_message_filter.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 } | 72 } |
| 73 } | 73 } |
| 74 | 74 |
| 75 void GinJavaBridgeDispatcherHost::WebContentsDestroyed() { | 75 void GinJavaBridgeDispatcherHost::WebContentsDestroyed() { |
| 76 scoped_refptr<GinJavaBridgeMessageFilter> filter = | 76 scoped_refptr<GinJavaBridgeMessageFilter> filter = |
| 77 GinJavaBridgeMessageFilter::FromHost(this, false); | 77 GinJavaBridgeMessageFilter::FromHost(this, false); |
| 78 if (filter) | 78 if (filter) |
| 79 filter->RemoveHost(this); | 79 filter->RemoveHost(this); |
| 80 } | 80 } |
| 81 | 81 |
| 82 void GinJavaBridgeDispatcherHost::RenderProcessGone( | |
| 83 base::TerminationStatus status) { | |
| 84 scoped_refptr<GinJavaBridgeMessageFilter> filter = | |
|
mnaganov (inactive)
2015/12/28 19:00:17
A simpler approach is to remove the user data from
Pritam Nikam
2015/12/29 11:24:46
Done.
| |
| 85 GinJavaBridgeMessageFilter::FromHost(this, false); | |
| 86 if (filter) | |
| 87 filter->SetNeedsToAddFilterForNewIpcChannel(true); | |
| 88 } | |
| 89 | |
| 90 void GinJavaBridgeDispatcherHost::RenderViewHostChanged( | |
| 91 RenderViewHost* old_host, | |
| 92 RenderViewHost* new_host) { | |
| 93 scoped_refptr<GinJavaBridgeMessageFilter> filter = | |
| 94 GinJavaBridgeMessageFilter::FromHost(this, false); | |
| 95 if (!filter) | |
| 96 InstallFilterAndRegisterAllRoutingIds(); | |
| 97 } | |
| 98 | |
| 82 GinJavaBoundObject::ObjectID GinJavaBridgeDispatcherHost::AddObject( | 99 GinJavaBoundObject::ObjectID GinJavaBridgeDispatcherHost::AddObject( |
| 83 const base::android::JavaRef<jobject>& object, | 100 const base::android::JavaRef<jobject>& object, |
| 84 const base::android::JavaRef<jclass>& safe_annotation_clazz, | 101 const base::android::JavaRef<jclass>& safe_annotation_clazz, |
| 85 bool is_named, | 102 bool is_named, |
| 86 int32 holder) { | 103 int32 holder) { |
| 87 // Can be called on any thread. Calls come from the UI thread via | 104 // Can be called on any thread. Calls come from the UI thread via |
| 88 // AddNamedObject, and from the background thread, when injected Java | 105 // AddNamedObject, and from the background thread, when injected Java |
| 89 // object's method returns a Java object. | 106 // object's method returns a Java object. |
| 90 DCHECK(is_named || holder); | 107 DCHECK(is_named || holder); |
| 91 JNIEnv* env = base::android::AttachCurrentThread(); | 108 JNIEnv* env = base::android::AttachCurrentThread(); |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 358 if (iter == objects_.end()) | 375 if (iter == objects_.end()) |
| 359 return; | 376 return; |
| 360 JavaObjectWeakGlobalRef ref = | 377 JavaObjectWeakGlobalRef ref = |
| 361 RemoveHolderAndAdvanceLocked(routing_id, &iter); | 378 RemoveHolderAndAdvanceLocked(routing_id, &iter); |
| 362 if (!ref.is_empty()) { | 379 if (!ref.is_empty()) { |
| 363 RemoveFromRetainedObjectSetLocked(ref); | 380 RemoveFromRetainedObjectSetLocked(ref); |
| 364 } | 381 } |
| 365 } | 382 } |
| 366 | 383 |
| 367 } // namespace content | 384 } // namespace content |
| OLD | NEW |