| OLD | NEW |
| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 1377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1388 Send(new FrameMsg_SwapOut(routing_id_, proxy->GetRoutingID(), is_loading, | 1388 Send(new FrameMsg_SwapOut(routing_id_, proxy->GetRoutingID(), is_loading, |
| 1389 replication_state)); | 1389 replication_state)); |
| 1390 } | 1390 } |
| 1391 | 1391 |
| 1392 if (web_ui()) | 1392 if (web_ui()) |
| 1393 web_ui()->RenderFrameHostSwappingOut(); | 1393 web_ui()->RenderFrameHostSwappingOut(); |
| 1394 | 1394 |
| 1395 // TODO(nasko): If the frame is not live, the RFH should just be deleted by | 1395 // TODO(nasko): If the frame is not live, the RFH should just be deleted by |
| 1396 // simulating the receipt of swap out ack. | 1396 // simulating the receipt of swap out ack. |
| 1397 is_waiting_for_swapout_ack_ = true; | 1397 is_waiting_for_swapout_ack_ = true; |
| 1398 if (frame_tree_node_->IsMainFrame()) |
| 1399 render_view_host_->set_is_active(false); |
| 1398 } | 1400 } |
| 1399 | 1401 |
| 1400 void RenderFrameHostImpl::OnBeforeUnloadACK( | 1402 void RenderFrameHostImpl::OnBeforeUnloadACK( |
| 1401 bool proceed, | 1403 bool proceed, |
| 1402 const base::TimeTicks& renderer_before_unload_start_time, | 1404 const base::TimeTicks& renderer_before_unload_start_time, |
| 1403 const base::TimeTicks& renderer_before_unload_end_time) { | 1405 const base::TimeTicks& renderer_before_unload_end_time) { |
| 1404 TRACE_EVENT_ASYNC_END1("navigation", "RenderFrameHostImpl BeforeUnload", this, | 1406 TRACE_EVENT_ASYNC_END1("navigation", "RenderFrameHostImpl BeforeUnload", this, |
| 1405 "FrameTreeNode id", | 1407 "FrameTreeNode id", |
| 1406 frame_tree_node_->frame_tree_node_id()); | 1408 frame_tree_node_->frame_tree_node_id()); |
| 1407 // If this renderer navigated while the beforeunload request was in flight, we | 1409 // If this renderer navigated while the beforeunload request was in flight, we |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1556 // Ignore spurious swap out ack. | 1558 // Ignore spurious swap out ack. |
| 1557 if (!is_waiting_for_swapout_ack_) | 1559 if (!is_waiting_for_swapout_ack_) |
| 1558 return; | 1560 return; |
| 1559 | 1561 |
| 1560 TRACE_EVENT_ASYNC_END0("navigation", "RenderFrameHostImpl::SwapOut", this); | 1562 TRACE_EVENT_ASYNC_END0("navigation", "RenderFrameHostImpl::SwapOut", this); |
| 1561 if (swapout_event_monitor_timeout_) | 1563 if (swapout_event_monitor_timeout_) |
| 1562 swapout_event_monitor_timeout_->Stop(); | 1564 swapout_event_monitor_timeout_->Stop(); |
| 1563 | 1565 |
| 1564 ClearAllWebUI(); | 1566 ClearAllWebUI(); |
| 1565 | 1567 |
| 1568 // If this is a main frame RFH that's about to be deleted, update its RVH's |
| 1569 // swapped-out state here. https://crbug.com/505887 |
| 1570 if (frame_tree_node_->IsMainFrame()) { |
| 1571 render_view_host_->set_is_active(false); |
| 1572 render_view_host_->set_is_swapped_out(true); |
| 1573 } |
| 1574 |
| 1566 bool deleted = | 1575 bool deleted = |
| 1567 frame_tree_node_->render_manager()->DeleteFromPendingList(this); | 1576 frame_tree_node_->render_manager()->DeleteFromPendingList(this); |
| 1568 CHECK(deleted); | 1577 CHECK(deleted); |
| 1569 } | 1578 } |
| 1570 | 1579 |
| 1571 void RenderFrameHostImpl::DisableSwapOutTimerForTesting() { | 1580 void RenderFrameHostImpl::DisableSwapOutTimerForTesting() { |
| 1572 swapout_event_monitor_timeout_.reset(); | 1581 swapout_event_monitor_timeout_.reset(); |
| 1573 } | 1582 } |
| 1574 | 1583 |
| 1575 void RenderFrameHostImpl::OnRendererConnect( | 1584 void RenderFrameHostImpl::OnRendererConnect( |
| (...skipping 1882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3458 // There is no pending NavigationEntry in these cases, so pass 0 as the | 3467 // There is no pending NavigationEntry in these cases, so pass 0 as the |
| 3459 // pending_nav_entry_id. If the previous handle was a prematurely aborted | 3468 // pending_nav_entry_id. If the previous handle was a prematurely aborted |
| 3460 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. | 3469 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. |
| 3461 return NavigationHandleImpl::Create( | 3470 return NavigationHandleImpl::Create( |
| 3462 params.url, params.redirects, frame_tree_node_, is_renderer_initiated, | 3471 params.url, params.redirects, frame_tree_node_, is_renderer_initiated, |
| 3463 params.was_within_same_page, base::TimeTicks::Now(), | 3472 params.was_within_same_page, base::TimeTicks::Now(), |
| 3464 entry_id_for_data_nav, false); // started_from_context_menu | 3473 entry_id_for_data_nav, false); // started_from_context_menu |
| 3465 } | 3474 } |
| 3466 | 3475 |
| 3467 } // namespace content | 3476 } // namespace content |
| OLD | NEW |