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

Unified Diff: content/browser/frame_host/render_frame_host_manager.cc

Issue 2733093002: Set an initial background for RenderFrameHosts during commit. (Closed)
Patch Set: none 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/render_frame_host_manager.cc
diff --git a/content/browser/frame_host/render_frame_host_manager.cc b/content/browser/frame_host/render_frame_host_manager.cc
index 3ec87d36263b55afd0769088dbaf5edcc6980a7e..956a40740f7b623722ba49c635f7458186d48ac3 100644
--- a/content/browser/frame_host/render_frame_host_manager.cc
+++ b/content/browser/frame_host/render_frame_host_manager.cc
@@ -2168,6 +2168,15 @@ void RenderFrameHostManager::CommitPending() {
// The process will no longer try to exit, so we can decrement the count.
render_frame_host_->GetProcess()->RemovePendingView();
+ // Save off the old background color before possibly deleting the
+ // old RenderWidgetHostView.
+ SkColor old_background_color = SK_ColorWHITE;
+ bool has_old_background_color = false;
+ if (old_render_frame_host && old_render_frame_host->GetView()) {
nasko 2017/03/08 22:54:20 Why null check old_render_frame_host? It is set un
chrishtr 2017/03/08 23:02:59 Done.
+ has_old_background_color = true;
+ old_background_color = old_render_frame_host->GetView()->background_color();
+ }
+
// The RenderViewHost keeps track of the main RenderFrameHost routing id.
// If this is committing a main frame navigation, update it and set the
// routing id in the RenderViewHost associated with the old RenderFrameHost
@@ -2244,6 +2253,11 @@ void RenderFrameHostManager::CommitPending() {
delegate_->NotifySwappedFromRenderManager(
old_render_frame_host.get(), render_frame_host_.get(), is_main_frame);
+ if (has_old_background_color) {
+ delegate_->NotifyInitialBackground(old_background_color,
nasko 2017/03/08 22:54:20 Is there any specific reason to go through the del
chrishtr 2017/03/08 23:02:59 Just thought it might be cleaner. I'm happy to inl
+ render_frame_host_.get());
+ }
+
// Swap out the old frame now that the new one is visible.
// This will swap it out and schedule it for deletion when the swap out ack
// arrives (or immediately if the process isn't live).

Powered by Google App Engine
This is Rietveld 408576698