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

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 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after
1395 Send(new FrameMsg_SwapOut(routing_id_, proxy->GetRoutingID(), is_loading, 1395 Send(new FrameMsg_SwapOut(routing_id_, proxy->GetRoutingID(), is_loading,
1396 replication_state)); 1396 replication_state));
1397 } 1397 }
1398 1398
1399 if (web_ui()) 1399 if (web_ui())
1400 web_ui()->RenderFrameHostSwappingOut(); 1400 web_ui()->RenderFrameHostSwappingOut();
1401 1401
1402 // TODO(nasko): If the frame is not live, the RFH should just be deleted by 1402 // TODO(nasko): If the frame is not live, the RFH should just be deleted by
1403 // simulating the receipt of swap out ack. 1403 // simulating the receipt of swap out ack.
1404 is_waiting_for_swapout_ack_ = true; 1404 is_waiting_for_swapout_ack_ = true;
1405 if (frame_tree_node_->IsMainFrame())
1406 render_view_host_->set_is_active(false);
1407 } 1405 }
1408 1406
1409 void RenderFrameHostImpl::OnBeforeUnloadACK( 1407 void RenderFrameHostImpl::OnBeforeUnloadACK(
1410 bool proceed, 1408 bool proceed,
1411 const base::TimeTicks& renderer_before_unload_start_time, 1409 const base::TimeTicks& renderer_before_unload_start_time,
1412 const base::TimeTicks& renderer_before_unload_end_time) { 1410 const base::TimeTicks& renderer_before_unload_end_time) {
1413 TRACE_EVENT_ASYNC_END1("navigation", "RenderFrameHostImpl BeforeUnload", this, 1411 TRACE_EVENT_ASYNC_END1("navigation", "RenderFrameHostImpl BeforeUnload", this,
1414 "FrameTreeNode id", 1412 "FrameTreeNode id",
1415 frame_tree_node_->frame_tree_node_id()); 1413 frame_tree_node_->frame_tree_node_id());
1416 DCHECK(!GetParent()); 1414 DCHECK(!GetParent());
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1563 // Ignore spurious swap out ack. 1561 // Ignore spurious swap out ack.
1564 if (!is_waiting_for_swapout_ack_) 1562 if (!is_waiting_for_swapout_ack_)
1565 return; 1563 return;
1566 1564
1567 TRACE_EVENT_ASYNC_END0("navigation", "RenderFrameHostImpl::SwapOut", this); 1565 TRACE_EVENT_ASYNC_END0("navigation", "RenderFrameHostImpl::SwapOut", this);
1568 if (swapout_event_monitor_timeout_) 1566 if (swapout_event_monitor_timeout_)
1569 swapout_event_monitor_timeout_->Stop(); 1567 swapout_event_monitor_timeout_->Stop();
1570 1568
1571 ClearAllWebUI(); 1569 ClearAllWebUI();
1572 1570
1573 // If this is a main frame RFH that's about to be deleted, update its RVH's
1574 // swapped-out state here. https://crbug.com/505887
1575 if (frame_tree_node_->IsMainFrame()) {
1576 render_view_host_->set_is_active(false);
1577 render_view_host_->set_is_swapped_out(true);
1578 }
1579
1580 bool deleted = 1571 bool deleted =
1581 frame_tree_node_->render_manager()->DeleteFromPendingList(this); 1572 frame_tree_node_->render_manager()->DeleteFromPendingList(this);
1582 CHECK(deleted); 1573 CHECK(deleted);
1583 } 1574 }
1584 1575
1585 void RenderFrameHostImpl::DisableSwapOutTimerForTesting() { 1576 void RenderFrameHostImpl::DisableSwapOutTimerForTesting() {
1586 swapout_event_monitor_timeout_.reset(); 1577 swapout_event_monitor_timeout_.reset();
1587 } 1578 }
1588 1579
1589 void RenderFrameHostImpl::OnRendererConnect( 1580 void RenderFrameHostImpl::OnRendererConnect(
(...skipping 1741 matching lines...) Expand 10 before | Expand all | Expand 10 after
3331 // There is no pending NavigationEntry in these cases, so pass 0 as the 3322 // There is no pending NavigationEntry in these cases, so pass 0 as the
3332 // pending_nav_entry_id. If the previous handle was a prematurely aborted 3323 // pending_nav_entry_id. If the previous handle was a prematurely aborted
3333 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. 3324 // navigation loaded via LoadDataWithBaseURL, propagate the entry id.
3334 return NavigationHandleImpl::Create( 3325 return NavigationHandleImpl::Create(
3335 params.url, frame_tree_node_, is_renderer_initiated, 3326 params.url, frame_tree_node_, is_renderer_initiated,
3336 params.was_within_same_page, params.is_srcdoc, base::TimeTicks::Now(), 3327 params.was_within_same_page, params.is_srcdoc, base::TimeTicks::Now(),
3337 entry_id_for_data_nav, false); // started_from_context_menu 3328 entry_id_for_data_nav, false); // started_from_context_menu
3338 } 3329 }
3339 3330
3340 } // namespace content 3331 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698