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

Side by Side Diff: content/renderer/java/gin_java_bridge_dispatcher.cc

Issue 1018413002: [Android] Fix method invocation and wrappers cleanup handling in Java Bridge (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added a dedicated test for attempting to call a non-existing method via `call` Created 5 years, 9 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 unified diff | Download patch
OLDNEW
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/renderer/java/gin_java_bridge_dispatcher.h" 5 #include "content/renderer/java/gin_java_bridge_dispatcher.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "content/common/gin_java_bridge_messages.h" 10 #include "content/common/gin_java_bridge_messages.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 GinJavaBridgeObject* GinJavaBridgeDispatcher::GetObject(ObjectID object_id) { 116 GinJavaBridgeObject* GinJavaBridgeDispatcher::GetObject(ObjectID object_id) {
117 GinJavaBridgeObject* result = objects_.Lookup(object_id); 117 GinJavaBridgeObject* result = objects_.Lookup(object_id);
118 if (!result) { 118 if (!result) {
119 result = GinJavaBridgeObject::InjectAnonymous(AsWeakPtr(), object_id); 119 result = GinJavaBridgeObject::InjectAnonymous(AsWeakPtr(), object_id);
120 if (result) 120 if (result)
121 objects_.AddWithID(result, object_id); 121 objects_.AddWithID(result, object_id);
122 } 122 }
123 return result; 123 return result;
124 } 124 }
125 125
126 void GinJavaBridgeDispatcher::OnGinJavaBridgeObjectDeleted(ObjectID object_id) { 126 void GinJavaBridgeDispatcher::OnGinJavaBridgeObjectDeleted(
127 if (!objects_.Lookup(object_id)) 127 GinJavaBridgeObject* object) {
128 return; 128 int object_id = object->object_id();
129 // Ignore cleaning up of old object wrappers.
130 if (objects_.Lookup(object_id) != object) return;
129 objects_.Remove(object_id); 131 objects_.Remove(object_id);
130 render_frame()->Send( 132 render_frame()->Send(
131 new GinJavaBridgeHostMsg_ObjectWrapperDeleted(routing_id(), object_id)); 133 new GinJavaBridgeHostMsg_ObjectWrapperDeleted(routing_id(), object_id));
132 } 134 }
133 135
134 } // namespace content 136 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/java/gin_java_bridge_dispatcher.h ('k') | content/renderer/java/gin_java_bridge_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698