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

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

Powered by Google App Engine
This is Rietveld 408576698