| 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 <string> | 10 #include <string> |
| (...skipping 2150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2161 } else { | 2161 } else { |
| 2162 // PlzNavigate | 2162 // PlzNavigate |
| 2163 DCHECK(speculative_render_frame_host_); | 2163 DCHECK(speculative_render_frame_host_); |
| 2164 old_render_frame_host = | 2164 old_render_frame_host = |
| 2165 SetRenderFrameHost(std::move(speculative_render_frame_host_)); | 2165 SetRenderFrameHost(std::move(speculative_render_frame_host_)); |
| 2166 } | 2166 } |
| 2167 | 2167 |
| 2168 // The process will no longer try to exit, so we can decrement the count. | 2168 // The process will no longer try to exit, so we can decrement the count. |
| 2169 render_frame_host_->GetProcess()->RemovePendingView(); | 2169 render_frame_host_->GetProcess()->RemovePendingView(); |
| 2170 | 2170 |
| 2171 // Save off the old background color before possibly deleting the |
| 2172 // old RenderWidgetHostView. |
| 2173 SkColor old_background_color = SK_ColorWHITE; |
| 2174 bool has_old_background_color = false; |
| 2175 if (old_render_frame_host->GetView()) { |
| 2176 has_old_background_color = true; |
| 2177 old_background_color = old_render_frame_host->GetView()->background_color(); |
| 2178 } |
| 2179 |
| 2171 // The RenderViewHost keeps track of the main RenderFrameHost routing id. | 2180 // The RenderViewHost keeps track of the main RenderFrameHost routing id. |
| 2172 // If this is committing a main frame navigation, update it and set the | 2181 // If this is committing a main frame navigation, update it and set the |
| 2173 // routing id in the RenderViewHost associated with the old RenderFrameHost | 2182 // routing id in the RenderViewHost associated with the old RenderFrameHost |
| 2174 // to MSG_ROUTING_NONE. | 2183 // to MSG_ROUTING_NONE. |
| 2175 if (is_main_frame) { | 2184 if (is_main_frame) { |
| 2176 RenderViewHostImpl* rvh = render_frame_host_->render_view_host(); | 2185 RenderViewHostImpl* rvh = render_frame_host_->render_view_host(); |
| 2177 rvh->set_main_frame_routing_id(render_frame_host_->routing_id()); | 2186 rvh->set_main_frame_routing_id(render_frame_host_->routing_id()); |
| 2178 | 2187 |
| 2179 // If we are reusing the RenderViewHost, we need to create the | 2188 // If we are reusing the RenderViewHost, we need to create the |
| 2180 // RenderWidgetHostView if this is the main frame. | 2189 // RenderWidgetHostView if this is the main frame. |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2237 frame_tree_node_->frame_tree()->SetPageFocus( | 2246 frame_tree_node_->frame_tree()->SetPageFocus( |
| 2238 render_frame_host_->GetSiteInstance(), true); | 2247 render_frame_host_->GetSiteInstance(), true); |
| 2239 } | 2248 } |
| 2240 } | 2249 } |
| 2241 | 2250 |
| 2242 // Notify that we've swapped RenderFrameHosts. We do this before shutting down | 2251 // Notify that we've swapped RenderFrameHosts. We do this before shutting down |
| 2243 // the RFH so that we can clean up RendererResources related to the RFH first. | 2252 // the RFH so that we can clean up RendererResources related to the RFH first. |
| 2244 delegate_->NotifySwappedFromRenderManager( | 2253 delegate_->NotifySwappedFromRenderManager( |
| 2245 old_render_frame_host.get(), render_frame_host_.get(), is_main_frame); | 2254 old_render_frame_host.get(), render_frame_host_.get(), is_main_frame); |
| 2246 | 2255 |
| 2256 if (has_old_background_color && render_frame_host_->GetView()) |
| 2257 render_frame_host_->GetView()->SetBackgroundColor(old_background_color); |
| 2258 |
| 2247 // Swap out the old frame now that the new one is visible. | 2259 // Swap out the old frame now that the new one is visible. |
| 2248 // This will swap it out and schedule it for deletion when the swap out ack | 2260 // This will swap it out and schedule it for deletion when the swap out ack |
| 2249 // arrives (or immediately if the process isn't live). | 2261 // arrives (or immediately if the process isn't live). |
| 2250 SwapOutOldFrame(std::move(old_render_frame_host)); | 2262 SwapOutOldFrame(std::move(old_render_frame_host)); |
| 2251 | 2263 |
| 2252 // Since the new RenderFrameHost is now committed, there must be no proxies | 2264 // Since the new RenderFrameHost is now committed, there must be no proxies |
| 2253 // for its SiteInstance. Delete any existing ones. | 2265 // for its SiteInstance. Delete any existing ones. |
| 2254 DeleteRenderFrameProxyHost(render_frame_host_->GetSiteInstance()); | 2266 DeleteRenderFrameProxyHost(render_frame_host_->GetSiteInstance()); |
| 2255 | 2267 |
| 2256 // If this is a subframe, it should have a CrossProcessFrameConnector | 2268 // If this is a subframe, it should have a CrossProcessFrameConnector |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2775 resolved_url)) { | 2787 resolved_url)) { |
| 2776 DCHECK(!dest_instance || | 2788 DCHECK(!dest_instance || |
| 2777 dest_instance == render_frame_host_->GetSiteInstance()); | 2789 dest_instance == render_frame_host_->GetSiteInstance()); |
| 2778 return false; | 2790 return false; |
| 2779 } | 2791 } |
| 2780 | 2792 |
| 2781 return true; | 2793 return true; |
| 2782 } | 2794 } |
| 2783 | 2795 |
| 2784 } // namespace content | 2796 } // namespace content |
| OLD | NEW |