| 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_manager.h" | 5 #include "content/browser/frame_host/render_frame_host_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 2127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2138 // Notify that we've swapped RenderFrameHosts. We do this before shutting down | 2138 // Notify that we've swapped RenderFrameHosts. We do this before shutting down |
| 2139 // the RFH so that we can clean up RendererResources related to the RFH first. | 2139 // the RFH so that we can clean up RendererResources related to the RFH first. |
| 2140 delegate_->NotifySwappedFromRenderManager( | 2140 delegate_->NotifySwappedFromRenderManager( |
| 2141 old_render_frame_host.get(), render_frame_host_.get(), is_main_frame); | 2141 old_render_frame_host.get(), render_frame_host_.get(), is_main_frame); |
| 2142 | 2142 |
| 2143 // The RenderViewHost keeps track of the main RenderFrameHost routing id. | 2143 // The RenderViewHost keeps track of the main RenderFrameHost routing id. |
| 2144 // If this is committing a main frame navigation, update it and set the | 2144 // If this is committing a main frame navigation, update it and set the |
| 2145 // routing id in the RenderViewHost associated with the old RenderFrameHost | 2145 // routing id in the RenderViewHost associated with the old RenderFrameHost |
| 2146 // to MSG_ROUTING_NONE. | 2146 // to MSG_ROUTING_NONE. |
| 2147 if (is_main_frame) { | 2147 if (is_main_frame) { |
| 2148 render_frame_host_->render_view_host()->set_main_frame_routing_id( | 2148 RenderViewHostImpl* rvh = render_frame_host_->render_view_host(); |
| 2149 render_frame_host_->routing_id()); | 2149 rvh->set_main_frame_routing_id(render_frame_host_->routing_id()); |
| 2150 render_frame_host_->render_view_host()->set_is_active(true); | 2150 |
| 2151 render_frame_host_->render_view_host()->set_is_swapped_out(false); | 2151 // If the RenderViewHost is transitioning from swapped out to active state, |
| 2152 // it was reused, so dispatch a RenderViewReady event. For example, this |
| 2153 // is necessary to hide the sad tab if one is currently displayed. See |
| 2154 // https://crbug.com/591984. |
| 2155 // |
| 2156 // TODO(alexmos): Remove this and move RenderViewReady consumers to use |
| 2157 // the main frame's RenderFrameCreated instead. |
| 2158 if (!rvh->is_active()) |
| 2159 rvh->PostRenderViewReady(); |
| 2160 |
| 2161 rvh->set_is_active(true); |
| 2162 rvh->set_is_swapped_out(false); |
| 2152 old_render_frame_host->render_view_host()->set_main_frame_routing_id( | 2163 old_render_frame_host->render_view_host()->set_main_frame_routing_id( |
| 2153 MSG_ROUTING_NONE); | 2164 MSG_ROUTING_NONE); |
| 2154 } | 2165 } |
| 2155 | 2166 |
| 2156 // Swap out the old frame now that the new one is visible. | 2167 // Swap out the old frame now that the new one is visible. |
| 2157 // This will swap it out and schedule it for deletion when the swap out ack | 2168 // This will swap it out and schedule it for deletion when the swap out ack |
| 2158 // arrives (or immediately if the process isn't live). | 2169 // arrives (or immediately if the process isn't live). |
| 2159 SwapOutOldFrame(std::move(old_render_frame_host)); | 2170 SwapOutOldFrame(std::move(old_render_frame_host)); |
| 2160 | 2171 |
| 2161 // Since the new RenderFrameHost is now committed, there must be no proxies | 2172 // Since the new RenderFrameHost is now committed, there must be no proxies |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2624 resolved_url)) { | 2635 resolved_url)) { |
| 2625 DCHECK(!dest_instance || | 2636 DCHECK(!dest_instance || |
| 2626 dest_instance == render_frame_host_->GetSiteInstance()); | 2637 dest_instance == render_frame_host_->GetSiteInstance()); |
| 2627 return false; | 2638 return false; |
| 2628 } | 2639 } |
| 2629 | 2640 |
| 2630 return true; | 2641 return true; |
| 2631 } | 2642 } |
| 2632 | 2643 |
| 2633 } // namespace content | 2644 } // namespace content |
| OLD | NEW |