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

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

Issue 275453002: Update WebFrameClient::didClearWindowObject API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/java/java_bridge_dispatcher.h ('k') | content/renderer/render_frame_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/java_bridge_dispatcher.h" 5 #include "content/renderer/java/java_bridge_dispatcher.h"
6 6
7 #include "content/child/child_process.h" 7 #include "content/child/child_process.h"
8 #include "content/child/npapi/npobject_util.h" // For CreateNPVariant() 8 #include "content/child/npapi/npobject_util.h" // For CreateNPVariant()
9 #include "content/common/java_bridge_messages.h" 9 #include "content/common/java_bridge_messages.h"
10 #include "content/public/renderer/render_frame.h" 10 #include "content/public/renderer/render_frame.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 bool handled = true; 44 bool handled = true;
45 IPC_BEGIN_MESSAGE_MAP(JavaBridgeDispatcher, msg) 45 IPC_BEGIN_MESSAGE_MAP(JavaBridgeDispatcher, msg)
46 IPC_MESSAGE_HANDLER(JavaBridgeMsg_AddNamedObject, OnAddNamedObject) 46 IPC_MESSAGE_HANDLER(JavaBridgeMsg_AddNamedObject, OnAddNamedObject)
47 IPC_MESSAGE_HANDLER(JavaBridgeMsg_RemoveNamedObject, 47 IPC_MESSAGE_HANDLER(JavaBridgeMsg_RemoveNamedObject,
48 OnRemoveNamedObject) 48 OnRemoveNamedObject)
49 IPC_MESSAGE_UNHANDLED(handled = false) 49 IPC_MESSAGE_UNHANDLED(handled = false)
50 IPC_END_MESSAGE_MAP() 50 IPC_END_MESSAGE_MAP()
51 return handled; 51 return handled;
52 } 52 }
53 53
54 void JavaBridgeDispatcher::DidClearWindowObject(int world_id) { 54 void JavaBridgeDispatcher::DidClearWindowObject() {
55 // Note that we have to (re)bind all objects, as they will have been unbound 55 // Note that we have to (re)bind all objects, as they will have been unbound
56 // when the window object was cleared. 56 // when the window object was cleared.
57 for (ObjectMap::const_iterator iter = objects_.begin(); 57 for (ObjectMap::const_iterator iter = objects_.begin();
58 iter != objects_.end(); 58 iter != objects_.end();
59 ++iter) { 59 ++iter) {
60 // This refs the NPObject. This reference is dropped when either the window 60 // This refs the NPObject. This reference is dropped when either the window
61 // object is later cleared, or the object is GC'ed. So the object may be 61 // object is later cleared, or the object is GC'ed. So the object may be
62 // deleted at any time after OnRemoveNamedObject() is called. 62 // deleted at any time after OnRemoveNamedObject() is called.
63 render_frame()->GetWebFrame()->bindToWindowObject( 63 render_frame()->GetWebFrame()->bindToWindowObject(
64 iter->first, NPVARIANT_TO_OBJECT(iter->second)); 64 iter->first, NPVARIANT_TO_OBJECT(iter->second));
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 // Removing an object does not unbind it from JavaScript until the window 105 // Removing an object does not unbind it from JavaScript until the window
106 // object is next cleared. Note that the browser checks that the named object 106 // object is next cleared. Note that the browser checks that the named object
107 // is present. 107 // is present.
108 ObjectMap::iterator iter = objects_.find(name); 108 ObjectMap::iterator iter = objects_.find(name);
109 DCHECK(iter != objects_.end()); 109 DCHECK(iter != objects_.end());
110 blink::WebBindings::releaseObject(NPVARIANT_TO_OBJECT(iter->second)); 110 blink::WebBindings::releaseObject(NPVARIANT_TO_OBJECT(iter->second));
111 objects_.erase(iter); 111 objects_.erase(iter);
112 } 112 }
113 113
114 } // namespace content 114 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/java/java_bridge_dispatcher.h ('k') | content/renderer/render_frame_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698