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

Side by Side Diff: content/renderer/render_frame_proxy.cc

Issue 1136593003: Delete entry in WebFrame->RenderFrameProxy map at WebFrame::close time. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/render_frame_proxy.h" 5 #include "content/renderer/render_frame_proxy.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "content/child/webmessageportchannel_impl.h" 10 #include "content/child/webmessageportchannel_impl.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 // TODO(nasko): Set the render_frame_proxy to null to avoid a double deletion 123 // TODO(nasko): Set the render_frame_proxy to null to avoid a double deletion
124 // when detaching the main frame. This can be removed once RenderFrameImpl and 124 // when detaching the main frame. This can be removed once RenderFrameImpl and
125 // RenderFrameProxy have been completely decoupled. See 125 // RenderFrameProxy have been completely decoupled. See
126 // https://crbug.com/357747. 126 // https://crbug.com/357747.
127 RenderFrameImpl* render_frame = 127 RenderFrameImpl* render_frame =
128 RenderFrameImpl::FromRoutingID(frame_routing_id_); 128 RenderFrameImpl::FromRoutingID(frame_routing_id_);
129 if (render_frame) 129 if (render_frame)
130 render_frame->set_render_frame_proxy(nullptr); 130 render_frame->set_render_frame_proxy(nullptr);
131 131
132 render_view()->UnregisterRenderFrameProxy(this); 132 render_view()->UnregisterRenderFrameProxy(this);
133 133
ncarter (slow) 2015/05/07 21:35:52 Is it worth adding a CHECK here to ensure sure tha
nasko 2015/05/07 21:40:52 Yeah, I thought of doing that and forgot to add it
134 FrameMap::iterator it = g_frame_map.Get().find(web_frame_);
135 CHECK(it != g_frame_map.Get().end());
136 CHECK_EQ(it->second, this);
137 g_frame_map.Get().erase(it);
138
139 RenderThread::Get()->RemoveRoute(routing_id_); 134 RenderThread::Get()->RemoveRoute(routing_id_);
140 g_routing_id_proxy_map.Get().erase(routing_id_); 135 g_routing_id_proxy_map.Get().erase(routing_id_);
141 } 136 }
142 137
143 void RenderFrameProxy::Init(blink::WebRemoteFrame* web_frame, 138 void RenderFrameProxy::Init(blink::WebRemoteFrame* web_frame,
144 RenderViewImpl* render_view) { 139 RenderViewImpl* render_view) {
145 CHECK(web_frame); 140 CHECK(web_frame);
146 CHECK(render_view); 141 CHECK(render_view);
147 142
148 web_frame_ = web_frame; 143 web_frame_ = web_frame;
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 void RenderFrameProxy::frameDetached() { 307 void RenderFrameProxy::frameDetached() {
313 if (web_frame_->parent()) { 308 if (web_frame_->parent()) {
314 web_frame_->parent()->removeChild(web_frame_); 309 web_frame_->parent()->removeChild(web_frame_);
315 310
316 // Let the browser process know this subframe is removed, so that it is 311 // Let the browser process know this subframe is removed, so that it is
317 // destroyed in its current process. 312 // destroyed in its current process.
318 Send(new FrameHostMsg_Detach(routing_id_)); 313 Send(new FrameHostMsg_Detach(routing_id_));
319 } 314 }
320 315
321 web_frame_->close(); 316 web_frame_->close();
317
318 // Remove the entry in the WebFrame->RenderFrameProxy map, as the |web_frame_|
319 // is no longer valid.
320 FrameMap::iterator it = g_frame_map.Get().find(web_frame_);
321 CHECK(it != g_frame_map.Get().end());
322 CHECK_EQ(it->second, this);
323 g_frame_map.Get().erase(it);
324
325 web_frame_ = nullptr;
326
322 delete this; 327 delete this;
323 } 328 }
324 329
325 void RenderFrameProxy::postMessageEvent( 330 void RenderFrameProxy::postMessageEvent(
326 blink::WebLocalFrame* source_frame, 331 blink::WebLocalFrame* source_frame,
327 blink::WebRemoteFrame* target_frame, 332 blink::WebRemoteFrame* target_frame,
328 blink::WebSecurityOrigin target_origin, 333 blink::WebSecurityOrigin target_origin,
329 blink::WebDOMMessageEvent event) { 334 blink::WebDOMMessageEvent event) {
330 DCHECK(!web_frame_ || web_frame_ == target_frame); 335 DCHECK(!web_frame_ || web_frame_ == target_frame);
331 336
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 blink::WebUserGestureIndicator::isProcessingUserGesture(); 379 blink::WebUserGestureIndicator::isProcessingUserGesture();
375 blink::WebUserGestureIndicator::consumeUserGesture(); 380 blink::WebUserGestureIndicator::consumeUserGesture();
376 Send(new FrameHostMsg_OpenURL(routing_id_, params)); 381 Send(new FrameHostMsg_OpenURL(routing_id_, params));
377 } 382 }
378 383
379 void RenderFrameProxy::forwardInputEvent(const blink::WebInputEvent* event) { 384 void RenderFrameProxy::forwardInputEvent(const blink::WebInputEvent* event) {
380 Send(new FrameHostMsg_ForwardInputEvent(routing_id_, event)); 385 Send(new FrameHostMsg_ForwardInputEvent(routing_id_, event));
381 } 386 }
382 387
383 } // namespace 388 } // namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698