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

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 2496233003: Destroy the old RenderWidgetHostView when swapping out a main frame. (Closed)
Patch Set: rebase Created 4 years 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/frame_host/render_frame_host_impl.h" 5 #include "content/browser/frame_host/render_frame_host_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after
1370 Send(new FrameMsg_SwapOut(routing_id_, proxy->GetRoutingID(), is_loading, 1370 Send(new FrameMsg_SwapOut(routing_id_, proxy->GetRoutingID(), is_loading,
1371 replication_state)); 1371 replication_state));
1372 } 1372 }
1373 1373
1374 if (web_ui()) 1374 if (web_ui())
1375 web_ui()->RenderFrameHostSwappingOut(); 1375 web_ui()->RenderFrameHostSwappingOut();
1376 1376
1377 // TODO(nasko): If the frame is not live, the RFH should just be deleted by 1377 // TODO(nasko): If the frame is not live, the RFH should just be deleted by
1378 // simulating the receipt of swap out ack. 1378 // simulating the receipt of swap out ack.
1379 is_waiting_for_swapout_ack_ = true; 1379 is_waiting_for_swapout_ack_ = true;
1380 if (frame_tree_node_->IsMainFrame())
1381 render_view_host_->set_is_active(false);
1382 } 1380 }
1383 1381
1384 void RenderFrameHostImpl::OnBeforeUnloadACK( 1382 void RenderFrameHostImpl::OnBeforeUnloadACK(
1385 bool proceed, 1383 bool proceed,
1386 const base::TimeTicks& renderer_before_unload_start_time, 1384 const base::TimeTicks& renderer_before_unload_start_time,
1387 const base::TimeTicks& renderer_before_unload_end_time) { 1385 const base::TimeTicks& renderer_before_unload_end_time) {
1388 TRACE_EVENT_ASYNC_END1("navigation", "RenderFrameHostImpl BeforeUnload", this, 1386 TRACE_EVENT_ASYNC_END1("navigation", "RenderFrameHostImpl BeforeUnload", this,
1389 "FrameTreeNode id", 1387 "FrameTreeNode id",
1390 frame_tree_node_->frame_tree_node_id()); 1388 frame_tree_node_->frame_tree_node_id());
1391 DCHECK(!GetParent()); 1389 DCHECK(!GetParent());
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1538 // Ignore spurious swap out ack. 1536 // Ignore spurious swap out ack.
1539 if (!is_waiting_for_swapout_ack_) 1537 if (!is_waiting_for_swapout_ack_)
1540 return; 1538 return;
1541 1539
1542 TRACE_EVENT_ASYNC_END0("navigation", "RenderFrameHostImpl::SwapOut", this); 1540 TRACE_EVENT_ASYNC_END0("navigation", "RenderFrameHostImpl::SwapOut", this);
1543 if (swapout_event_monitor_timeout_) 1541 if (swapout_event_monitor_timeout_)
1544 swapout_event_monitor_timeout_->Stop(); 1542 swapout_event_monitor_timeout_->Stop();
1545 1543
1546 ClearAllWebUI(); 1544 ClearAllWebUI();
1547 1545
1548 // If this is a main frame RFH that's about to be deleted, update its RVH's
1549 // swapped-out state here. https://crbug.com/505887
1550 if (frame_tree_node_->IsMainFrame()) {
1551 render_view_host_->set_is_active(false);
1552 render_view_host_->set_is_swapped_out(true);
1553 }
1554
1555 bool deleted = 1546 bool deleted =
1556 frame_tree_node_->render_manager()->DeleteFromPendingList(this); 1547 frame_tree_node_->render_manager()->DeleteFromPendingList(this);
1557 CHECK(deleted); 1548 CHECK(deleted);
1558 } 1549 }
1559 1550
1560 void RenderFrameHostImpl::DisableSwapOutTimerForTesting() { 1551 void RenderFrameHostImpl::DisableSwapOutTimerForTesting() {
1561 swapout_event_monitor_timeout_.reset(); 1552 swapout_event_monitor_timeout_.reset();
1562 } 1553 }
1563 1554
1564 void RenderFrameHostImpl::OnRendererConnect( 1555 void RenderFrameHostImpl::OnRendererConnect(
(...skipping 1762 matching lines...) Expand 10 before | Expand all | Expand 10 after
3327 // There is no pending NavigationEntry in these cases, so pass 0 as the 3318 // There is no pending NavigationEntry in these cases, so pass 0 as the
3328 // pending_nav_entry_id. If the previous handle was a prematurely aborted 3319 // pending_nav_entry_id. If the previous handle was a prematurely aborted
3329 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. 3320 // navigation loaded via LoadDataWithBaseURL, propagate the entry id.
3330 return NavigationHandleImpl::Create( 3321 return NavigationHandleImpl::Create(
3331 params.url, frame_tree_node_, is_renderer_initiated, 3322 params.url, frame_tree_node_, is_renderer_initiated,
3332 params.was_within_same_page, base::TimeTicks::Now(), 3323 params.was_within_same_page, base::TimeTicks::Now(),
3333 entry_id_for_data_nav, false); // started_from_context_menu 3324 entry_id_for_data_nav, false); // started_from_context_menu
3334 } 3325 }
3335 3326
3336 } // namespace content 3327 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698