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

Side by Side Diff: content/browser/frame_host/render_frame_host_manager.cc

Issue 2738983004: Set an initial background for RenderFrameHosts during commit. (Closed)
Patch Set: Created 3 years, 9 months 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
« no previous file with comments | « no previous file | content/browser/frame_host/render_frame_host_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_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 2189 matching lines...) Expand 10 before | Expand all | Expand 10 after
2200 } else { 2200 } else {
2201 // PlzNavigate 2201 // PlzNavigate
2202 DCHECK(speculative_render_frame_host_); 2202 DCHECK(speculative_render_frame_host_);
2203 old_render_frame_host = 2203 old_render_frame_host =
2204 SetRenderFrameHost(std::move(speculative_render_frame_host_)); 2204 SetRenderFrameHost(std::move(speculative_render_frame_host_));
2205 } 2205 }
2206 2206
2207 // The process will no longer try to exit, so we can decrement the count. 2207 // The process will no longer try to exit, so we can decrement the count.
2208 render_frame_host_->GetProcess()->RemovePendingView(); 2208 render_frame_host_->GetProcess()->RemovePendingView();
2209 2209
2210 // Save off the old background color before possibly deleting the
2211 // old RenderWidgetHostView.
2212 SkColor old_background_color = SK_ColorWHITE;
2213 bool has_old_background_color = false;
2214 if (old_render_frame_host->GetView()) {
2215 has_old_background_color = true;
2216 old_background_color = old_render_frame_host->GetView()->background_color();
2217 }
2218
2210 // The RenderViewHost keeps track of the main RenderFrameHost routing id. 2219 // The RenderViewHost keeps track of the main RenderFrameHost routing id.
2211 // If this is committing a main frame navigation, update it and set the 2220 // If this is committing a main frame navigation, update it and set the
2212 // routing id in the RenderViewHost associated with the old RenderFrameHost 2221 // routing id in the RenderViewHost associated with the old RenderFrameHost
2213 // to MSG_ROUTING_NONE. 2222 // to MSG_ROUTING_NONE.
2214 if (is_main_frame) { 2223 if (is_main_frame) {
2215 RenderViewHostImpl* rvh = render_frame_host_->render_view_host(); 2224 RenderViewHostImpl* rvh = render_frame_host_->render_view_host();
2216 rvh->set_main_frame_routing_id(render_frame_host_->routing_id()); 2225 rvh->set_main_frame_routing_id(render_frame_host_->routing_id());
2217 2226
2218 // If we are reusing the RenderViewHost, we need to create the 2227 // If we are reusing the RenderViewHost, we need to create the
2219 // RenderWidgetHostView if this is the main frame. 2228 // RenderWidgetHostView if this is the main frame.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
2276 frame_tree_node_->frame_tree()->SetPageFocus( 2285 frame_tree_node_->frame_tree()->SetPageFocus(
2277 render_frame_host_->GetSiteInstance(), true); 2286 render_frame_host_->GetSiteInstance(), true);
2278 } 2287 }
2279 } 2288 }
2280 2289
2281 // Notify that we've swapped RenderFrameHosts. We do this before shutting down 2290 // Notify that we've swapped RenderFrameHosts. We do this before shutting down
2282 // the RFH so that we can clean up RendererResources related to the RFH first. 2291 // the RFH so that we can clean up RendererResources related to the RFH first.
2283 delegate_->NotifySwappedFromRenderManager( 2292 delegate_->NotifySwappedFromRenderManager(
2284 old_render_frame_host.get(), render_frame_host_.get(), is_main_frame); 2293 old_render_frame_host.get(), render_frame_host_.get(), is_main_frame);
2285 2294
2295 if (has_old_background_color && render_frame_host_->GetView())
2296 render_frame_host_->GetView()->SetBackgroundColor(old_background_color);
2297
2286 // Swap out the old frame now that the new one is visible. 2298 // Swap out the old frame now that the new one is visible.
2287 // This will swap it out and schedule it for deletion when the swap out ack 2299 // This will swap it out and schedule it for deletion when the swap out ack
2288 // arrives (or immediately if the process isn't live). 2300 // arrives (or immediately if the process isn't live).
2289 SwapOutOldFrame(std::move(old_render_frame_host)); 2301 SwapOutOldFrame(std::move(old_render_frame_host));
2290 2302
2291 // Since the new RenderFrameHost is now committed, there must be no proxies 2303 // Since the new RenderFrameHost is now committed, there must be no proxies
2292 // for its SiteInstance. Delete any existing ones. 2304 // for its SiteInstance. Delete any existing ones.
2293 DeleteRenderFrameProxyHost(render_frame_host_->GetSiteInstance()); 2305 DeleteRenderFrameProxyHost(render_frame_host_->GetSiteInstance());
2294 2306
2295 // If this is a subframe, it should have a CrossProcessFrameConnector 2307 // If this is a subframe, it should have a CrossProcessFrameConnector
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
2814 resolved_url)) { 2826 resolved_url)) {
2815 DCHECK(!dest_instance || 2827 DCHECK(!dest_instance ||
2816 dest_instance == render_frame_host_->GetSiteInstance()); 2828 dest_instance == render_frame_host_->GetSiteInstance());
2817 return false; 2829 return false;
2818 } 2830 }
2819 2831
2820 return true; 2832 return true;
2821 } 2833 }
2822 2834
2823 } // namespace content 2835 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/render_frame_host_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698