Commit c8fc00a7 authored by Saman Sami's avatar Saman Sami Committed by Commit Bot

Remove unnecessary calls to SetOldestAcceptableFallback

We only need to call this method during main frame navigation.

TBR=apacible@chromium.org

Bug: 893850
Change-Id: Id78fb02440f646c07de9bec3460cbb64809781f1
Reviewed-on: https://chromium-review.googlesource.com/c/1340702
Commit-Queue: Saman Sami <samans@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarFady Samuel <fsamuel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609493}
parent 7afae31e
......@@ -46,7 +46,6 @@ void OverlaySurfaceEmbedder::SetSurfaceId(const viz::SurfaceId& surface_id) {
SK_ColorBLACK,
cc::DeadlinePolicy::UseDefaultDeadline(),
true /* stretch_content_to_fill_bounds */);
video_layer_->SetOldestAcceptableFallback(surface_id);
}
void OverlaySurfaceEmbedder::UpdateLayerBounds() {
......
......@@ -33,8 +33,7 @@ ChildFrameCompositingHelper::~ChildFrameCompositingHelper() = default;
void ChildFrameCompositingHelper::ChildFrameGone(
const gfx::Size& frame_size_in_dip,
float device_scale_factor) {
primary_surface_id_ = viz::SurfaceId();
fallback_surface_id_ = viz::SurfaceId();
surface_id_ = viz::SurfaceId();
scoped_refptr<cc::SolidColorLayer> crashed_layer =
cc::SolidColorLayer::Create();
......@@ -75,10 +74,10 @@ void ChildFrameCompositingHelper::SetSurfaceId(
const viz::SurfaceId& surface_id,
const gfx::Size& frame_size_in_dip,
const cc::DeadlinePolicy& deadline) {
if (primary_surface_id_ == surface_id)
if (surface_id_ == surface_id)
return;
primary_surface_id_ = surface_id;
surface_id_ = surface_id;
surface_layer_ = cc::SurfaceLayer::Create();
surface_layer_->SetMasksToBounds(true);
......@@ -86,7 +85,6 @@ void ChildFrameCompositingHelper::SetSurfaceId(
surface_layer_->SetBackgroundColor(SK_ColorTRANSPARENT);
surface_layer_->SetSurfaceId(surface_id, deadline);
surface_layer_->SetOldestAcceptableFallback(fallback_surface_id_);
// TODO(lfg): Investigate if it's possible to propagate the information
// about the child surface's opacity. https://crbug.com/629851.
......@@ -100,20 +98,6 @@ void ChildFrameCompositingHelper::SetSurfaceId(
surface_layer_->SetBounds(frame_size_in_dip);
}
void ChildFrameCompositingHelper::SetOldestAcceptableFallback(
const viz::SurfaceId& surface_id,
const gfx::Size& frame_size_in_dip) {
fallback_surface_id_ = surface_id;
if (!surface_layer_) {
SetSurfaceId(surface_id, frame_size_in_dip,
cc::DeadlinePolicy::UseDefaultDeadline());
return;
}
surface_layer_->SetOldestAcceptableFallback(surface_id);
}
void ChildFrameCompositingHelper::UpdateVisibility(bool visible) {
cc::Layer* layer = child_frame_compositor_->GetLayer();
if (layer)
......
......@@ -38,22 +38,15 @@ class CONTENT_EXPORT ChildFrameCompositingHelper {
void SetSurfaceId(const viz::SurfaceId& surface_id,
const gfx::Size& frame_size_in_dip,
const cc::DeadlinePolicy& deadline);
void SetOldestAcceptableFallback(const viz::SurfaceId& surface_id,
const gfx::Size& frame_size_in_dip);
void UpdateVisibility(bool visible);
void ChildFrameGone(const gfx::Size& frame_size_in_dip,
float device_scale_factor);
const viz::SurfaceId& surface_id() const { return primary_surface_id_; }
const viz::SurfaceId& oldest_acceptable_fallback() const {
return fallback_surface_id_;
}
const viz::SurfaceId& surface_id() const { return surface_id_; }
private:
ChildFrameCompositor* const child_frame_compositor_;
viz::SurfaceId primary_surface_id_;
viz::SurfaceId fallback_surface_id_;
viz::SurfaceId surface_id_;
scoped_refptr<cc::SurfaceLayer> surface_layer_;
DISALLOW_COPY_AND_ASSIGN(ChildFrameCompositingHelper);
......
......@@ -69,25 +69,16 @@ class ChildFrameCompositingHelperTest : public testing::Test {
TEST_F(ChildFrameCompositingHelperTest, ChildFrameGoneClearsFallback) {
// The primary and fallback surface IDs should start out as invalid.
EXPECT_FALSE(compositing_helper()->surface_id().is_valid());
EXPECT_FALSE(compositing_helper()->oldest_acceptable_fallback().is_valid());
const viz::SurfaceId fallback_surface_id =
MakeSurfaceId(viz::FrameSinkId(1, 1), 1);
const viz::SurfaceId surface_id = MakeSurfaceId(viz::FrameSinkId(1, 1), 1);
const gfx::Size frame_size_in_dip(100, 100);
compositing_helper()->SetOldestAcceptableFallback(fallback_surface_id,
frame_size_in_dip);
compositing_helper()->SetSurfaceId(surface_id, frame_size_in_dip,
cc::DeadlinePolicy::UseDefaultDeadline());
EXPECT_EQ(surface_id, compositing_helper()->surface_id());
// Since the fallback surface ID was set before the primary surface ID then
// the primary is set to the same value as the fallback. Verify this is so.
EXPECT_EQ(fallback_surface_id, compositing_helper()->surface_id());
EXPECT_EQ(fallback_surface_id,
compositing_helper()->oldest_acceptable_fallback());
// Reporting that the child frame is gone should clear both the primary and
// fallback surface Ids.
// Reporting that the child frame is gone should clear the surface id.
compositing_helper()->ChildFrameGone(frame_size_in_dip, 1.f);
EXPECT_FALSE(compositing_helper()->surface_id().is_valid());
EXPECT_FALSE(compositing_helper()->oldest_acceptable_fallback().is_valid());
}
} // namespace content
......@@ -462,6 +462,8 @@ void RenderFrameProxy::OnChildFrameProcessGone() {
void RenderFrameProxy::OnFirstSurfaceActivation(
const viz::SurfaceInfo& surface_info) {
DCHECK(!enable_surface_synchronization_);
// If this WebFrame has already been detached, its parent will be null. This
// can happen when swapping a WebRemoteFrame with a WebLocalFrame, where this
// message may arrive after the frame was removed from the frame tree, but
......@@ -469,12 +471,8 @@ void RenderFrameProxy::OnFirstSurfaceActivation(
if (!web_frame()->Parent())
return;
if (!enable_surface_synchronization_) {
compositing_helper_->SetSurfaceId(surface_info.id(), local_frame_size(),
cc::DeadlinePolicy::UseDefaultDeadline());
}
compositing_helper_->SetOldestAcceptableFallback(surface_info.id(),
local_frame_size());
compositing_helper_->SetSurfaceId(surface_info.id(), local_frame_size(),
cc::DeadlinePolicy::UseDefaultDeadline());
}
void RenderFrameProxy::OnIntrinsicSizingInfoOfChildChanged(
......
......@@ -236,7 +236,6 @@ void WindowPortLocal::OnFirstSurfaceActivation(
SK_ColorWHITE,
cc::DeadlinePolicy::UseDefaultDeadline(),
false /* stretch_content_to_fill_bounds */);
window_->layer()->SetOldestAcceptableFallback(surface_info.id());
}
void WindowPortLocal::OnFrameTokenChanged(uint32_t frame_token) {}
......
......@@ -49,7 +49,6 @@ bool ClientSurfaceEmbedder::HasPrimarySurfaceId() const {
void ClientSurfaceEmbedder::SetFallbackSurfaceInfo(
const viz::SurfaceInfo& surface_info) {
fallback_surface_info_ = surface_info;
surface_layer_owner_->layer()->SetOldestAcceptableFallback(surface_info.id());
UpdateSizeAndGutters();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment