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

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

Issue 1149793002: Detach old frame on WebFrame::swap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: renaming enum Created 5 years, 6 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/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"
11 #include "content/common/frame_messages.h" 11 #include "content/common/frame_messages.h"
12 #include "content/common/frame_replication_state.h" 12 #include "content/common/frame_replication_state.h"
13 #include "content/common/swapped_out_messages.h" 13 #include "content/common/swapped_out_messages.h"
14 #include "content/common/view_messages.h" 14 #include "content/common/view_messages.h"
15 #include "content/renderer/child_frame_compositing_helper.h" 15 #include "content/renderer/child_frame_compositing_helper.h"
16 #include "content/renderer/render_frame_impl.h" 16 #include "content/renderer/render_frame_impl.h"
17 #include "content/renderer/render_thread_impl.h" 17 #include "content/renderer/render_thread_impl.h"
18 #include "content/renderer/render_view_impl.h" 18 #include "content/renderer/render_view_impl.h"
19 #include "third_party/WebKit/public/platform/WebString.h" 19 #include "third_party/WebKit/public/platform/WebString.h"
20 #include "third_party/WebKit/public/web/WebFrameClient.h"
dcheng 2015/06/01 21:15:54 This include shouldn't be needed.
lfg 2015/06/01 21:34:19 Done.
20 #include "third_party/WebKit/public/web/WebLocalFrame.h" 21 #include "third_party/WebKit/public/web/WebLocalFrame.h"
21 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" 22 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h"
22 #include "third_party/WebKit/public/web/WebView.h" 23 #include "third_party/WebKit/public/web/WebView.h"
23 24
24 namespace content { 25 namespace content {
25 26
26 namespace { 27 namespace {
27 28
28 // Facilitates lookup of RenderFrameProxy by routing_id. 29 // Facilitates lookup of RenderFrameProxy by routing_id.
29 typedef std::map<int, RenderFrameProxy*> RoutingIDProxyMap; 30 typedef std::map<int, RenderFrameProxy*> RoutingIDProxyMap;
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 void RenderFrameProxy::OnDidUpdateName(const std::string& name) { 304 void RenderFrameProxy::OnDidUpdateName(const std::string& name) {
304 web_frame_->setReplicatedName(blink::WebString::fromUTF8(name)); 305 web_frame_->setReplicatedName(blink::WebString::fromUTF8(name));
305 } 306 }
306 307
307 void RenderFrameProxy::OnDidUpdateOrigin(const url::Origin& origin) { 308 void RenderFrameProxy::OnDidUpdateOrigin(const url::Origin& origin) {
308 web_frame_->setReplicatedOrigin(blink::WebSecurityOrigin::createFromString( 309 web_frame_->setReplicatedOrigin(blink::WebSecurityOrigin::createFromString(
309 blink::WebString::fromUTF8(origin.string()))); 310 blink::WebString::fromUTF8(origin.string())));
310 } 311 }
311 312
312 void RenderFrameProxy::frameDetached() { 313 void RenderFrameProxy::frameDetached() {
313 if (web_frame_->parent()) { 314 frameDetached(blink::WebRemoteFrameClient::DetachType::Remove);
315 }
316
317 void RenderFrameProxy::frameDetached(
318 blink::WebRemoteFrameClient::DetachType type) {
319 if (type == blink::WebRemoteFrameClient::DetachType::Remove &&
320 web_frame_->parent()) {
314 web_frame_->parent()->removeChild(web_frame_); 321 web_frame_->parent()->removeChild(web_frame_);
315 322
316 // Let the browser process know this subframe is removed, so that it is 323 // Let the browser process know this subframe is removed, so that it is
317 // destroyed in its current process. 324 // destroyed in its current process.
318 Send(new FrameHostMsg_Detach(routing_id_)); 325 Send(new FrameHostMsg_Detach(routing_id_));
319 } 326 }
320 327
321 web_frame_->close(); 328 web_frame_->close();
322 329
323 // Remove the entry in the WebFrame->RenderFrameProxy map, as the |web_frame_| 330 // Remove the entry in the WebFrame->RenderFrameProxy map, as the |web_frame_|
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 blink::WebUserGestureIndicator::isProcessingUserGesture(); 391 blink::WebUserGestureIndicator::isProcessingUserGesture();
385 blink::WebUserGestureIndicator::consumeUserGesture(); 392 blink::WebUserGestureIndicator::consumeUserGesture();
386 Send(new FrameHostMsg_OpenURL(routing_id_, params)); 393 Send(new FrameHostMsg_OpenURL(routing_id_, params));
387 } 394 }
388 395
389 void RenderFrameProxy::forwardInputEvent(const blink::WebInputEvent* event) { 396 void RenderFrameProxy::forwardInputEvent(const blink::WebInputEvent* event) {
390 Send(new FrameHostMsg_ForwardInputEvent(routing_id_, event)); 397 Send(new FrameHostMsg_ForwardInputEvent(routing_id_, event));
391 } 398 }
392 399
393 } // namespace 400 } // namespace
OLDNEW
« content/renderer/render_frame_impl.cc ('K') | « content/renderer/render_frame_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698