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) { ...@@ -46,7 +46,6 @@ void OverlaySurfaceEmbedder::SetSurfaceId(const viz::SurfaceId& surface_id) {
SK_ColorBLACK, SK_ColorBLACK,
cc::DeadlinePolicy::UseDefaultDeadline(), cc::DeadlinePolicy::UseDefaultDeadline(),
true /* stretch_content_to_fill_bounds */); true /* stretch_content_to_fill_bounds */);
video_layer_->SetOldestAcceptableFallback(surface_id);
} }
void OverlaySurfaceEmbedder::UpdateLayerBounds() { void OverlaySurfaceEmbedder::UpdateLayerBounds() {
......
...@@ -33,8 +33,7 @@ ChildFrameCompositingHelper::~ChildFrameCompositingHelper() = default; ...@@ -33,8 +33,7 @@ ChildFrameCompositingHelper::~ChildFrameCompositingHelper() = default;
void ChildFrameCompositingHelper::ChildFrameGone( void ChildFrameCompositingHelper::ChildFrameGone(
const gfx::Size& frame_size_in_dip, const gfx::Size& frame_size_in_dip,
float device_scale_factor) { float device_scale_factor) {
primary_surface_id_ = viz::SurfaceId(); surface_id_ = viz::SurfaceId();
fallback_surface_id_ = viz::SurfaceId();
scoped_refptr<cc::SolidColorLayer> crashed_layer = scoped_refptr<cc::SolidColorLayer> crashed_layer =
cc::SolidColorLayer::Create(); cc::SolidColorLayer::Create();
...@@ -75,10 +74,10 @@ void ChildFrameCompositingHelper::SetSurfaceId( ...@@ -75,10 +74,10 @@ void ChildFrameCompositingHelper::SetSurfaceId(
const viz::SurfaceId& surface_id, const viz::SurfaceId& surface_id,
const gfx::Size& frame_size_in_dip, const gfx::Size& frame_size_in_dip,
const cc::DeadlinePolicy& deadline) { const cc::DeadlinePolicy& deadline) {
if (primary_surface_id_ == surface_id) if (surface_id_ == surface_id)
return; return;
primary_surface_id_ = surface_id; surface_id_ = surface_id;
surface_layer_ = cc::SurfaceLayer::Create(); surface_layer_ = cc::SurfaceLayer::Create();
surface_layer_->SetMasksToBounds(true); surface_layer_->SetMasksToBounds(true);
...@@ -86,7 +85,6 @@ void ChildFrameCompositingHelper::SetSurfaceId( ...@@ -86,7 +85,6 @@ void ChildFrameCompositingHelper::SetSurfaceId(
surface_layer_->SetBackgroundColor(SK_ColorTRANSPARENT); surface_layer_->SetBackgroundColor(SK_ColorTRANSPARENT);
surface_layer_->SetSurfaceId(surface_id, deadline); surface_layer_->SetSurfaceId(surface_id, deadline);
surface_layer_->SetOldestAcceptableFallback(fallback_surface_id_);
// TODO(lfg): Investigate if it's possible to propagate the information // TODO(lfg): Investigate if it's possible to propagate the information
// about the child surface's opacity. https://crbug.com/629851. // about the child surface's opacity. https://crbug.com/629851.
...@@ -100,20 +98,6 @@ void ChildFrameCompositingHelper::SetSurfaceId( ...@@ -100,20 +98,6 @@ void ChildFrameCompositingHelper::SetSurfaceId(
surface_layer_->SetBounds(frame_size_in_dip); 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) { void ChildFrameCompositingHelper::UpdateVisibility(bool visible) {
cc::Layer* layer = child_frame_compositor_->GetLayer(); cc::Layer* layer = child_frame_compositor_->GetLayer();
if (layer) if (layer)
......
...@@ -38,22 +38,15 @@ class CONTENT_EXPORT ChildFrameCompositingHelper { ...@@ -38,22 +38,15 @@ class CONTENT_EXPORT ChildFrameCompositingHelper {
void SetSurfaceId(const viz::SurfaceId& surface_id, void SetSurfaceId(const viz::SurfaceId& surface_id,
const gfx::Size& frame_size_in_dip, const gfx::Size& frame_size_in_dip,
const cc::DeadlinePolicy& deadline); const cc::DeadlinePolicy& deadline);
void SetOldestAcceptableFallback(const viz::SurfaceId& surface_id,
const gfx::Size& frame_size_in_dip);
void UpdateVisibility(bool visible); void UpdateVisibility(bool visible);
void ChildFrameGone(const gfx::Size& frame_size_in_dip, void ChildFrameGone(const gfx::Size& frame_size_in_dip,
float device_scale_factor); float device_scale_factor);
const viz::SurfaceId& surface_id() const { return primary_surface_id_; } const viz::SurfaceId& surface_id() const { return surface_id_; }
const viz::SurfaceId& oldest_acceptable_fallback() const {
return fallback_surface_id_;
}
private: private:
ChildFrameCompositor* const child_frame_compositor_; ChildFrameCompositor* const child_frame_compositor_;
viz::SurfaceId primary_surface_id_; viz::SurfaceId surface_id_;
viz::SurfaceId fallback_surface_id_;
scoped_refptr<cc::SurfaceLayer> surface_layer_; scoped_refptr<cc::SurfaceLayer> surface_layer_;
DISALLOW_COPY_AND_ASSIGN(ChildFrameCompositingHelper); DISALLOW_COPY_AND_ASSIGN(ChildFrameCompositingHelper);
......
...@@ -69,25 +69,16 @@ class ChildFrameCompositingHelperTest : public testing::Test { ...@@ -69,25 +69,16 @@ class ChildFrameCompositingHelperTest : public testing::Test {
TEST_F(ChildFrameCompositingHelperTest, ChildFrameGoneClearsFallback) { TEST_F(ChildFrameCompositingHelperTest, ChildFrameGoneClearsFallback) {
// The primary and fallback surface IDs should start out as invalid. // The primary and fallback surface IDs should start out as invalid.
EXPECT_FALSE(compositing_helper()->surface_id().is_valid()); EXPECT_FALSE(compositing_helper()->surface_id().is_valid());
EXPECT_FALSE(compositing_helper()->oldest_acceptable_fallback().is_valid());
const viz::SurfaceId fallback_surface_id = const viz::SurfaceId surface_id = MakeSurfaceId(viz::FrameSinkId(1, 1), 1);
MakeSurfaceId(viz::FrameSinkId(1, 1), 1);
const gfx::Size frame_size_in_dip(100, 100); const gfx::Size frame_size_in_dip(100, 100);
compositing_helper()->SetOldestAcceptableFallback(fallback_surface_id, compositing_helper()->SetSurfaceId(surface_id, frame_size_in_dip,
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 // Reporting that the child frame is gone should clear the surface id.
// 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.
compositing_helper()->ChildFrameGone(frame_size_in_dip, 1.f); compositing_helper()->ChildFrameGone(frame_size_in_dip, 1.f);
EXPECT_FALSE(compositing_helper()->surface_id().is_valid()); EXPECT_FALSE(compositing_helper()->surface_id().is_valid());
EXPECT_FALSE(compositing_helper()->oldest_acceptable_fallback().is_valid());
} }
} // namespace content } // namespace content
...@@ -462,6 +462,8 @@ void RenderFrameProxy::OnChildFrameProcessGone() { ...@@ -462,6 +462,8 @@ void RenderFrameProxy::OnChildFrameProcessGone() {
void RenderFrameProxy::OnFirstSurfaceActivation( void RenderFrameProxy::OnFirstSurfaceActivation(
const viz::SurfaceInfo& surface_info) { const viz::SurfaceInfo& surface_info) {
DCHECK(!enable_surface_synchronization_);
// If this WebFrame has already been detached, its parent will be null. This // If this WebFrame has already been detached, its parent will be null. This
// can happen when swapping a WebRemoteFrame with a WebLocalFrame, where 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 // message may arrive after the frame was removed from the frame tree, but
...@@ -469,12 +471,8 @@ void RenderFrameProxy::OnFirstSurfaceActivation( ...@@ -469,12 +471,8 @@ void RenderFrameProxy::OnFirstSurfaceActivation(
if (!web_frame()->Parent()) if (!web_frame()->Parent())
return; return;
if (!enable_surface_synchronization_) { compositing_helper_->SetSurfaceId(surface_info.id(), local_frame_size(),
compositing_helper_->SetSurfaceId(surface_info.id(), local_frame_size(), cc::DeadlinePolicy::UseDefaultDeadline());
cc::DeadlinePolicy::UseDefaultDeadline());
}
compositing_helper_->SetOldestAcceptableFallback(surface_info.id(),
local_frame_size());
} }
void RenderFrameProxy::OnIntrinsicSizingInfoOfChildChanged( void RenderFrameProxy::OnIntrinsicSizingInfoOfChildChanged(
......
...@@ -236,7 +236,6 @@ void WindowPortLocal::OnFirstSurfaceActivation( ...@@ -236,7 +236,6 @@ void WindowPortLocal::OnFirstSurfaceActivation(
SK_ColorWHITE, SK_ColorWHITE,
cc::DeadlinePolicy::UseDefaultDeadline(), cc::DeadlinePolicy::UseDefaultDeadline(),
false /* stretch_content_to_fill_bounds */); false /* stretch_content_to_fill_bounds */);
window_->layer()->SetOldestAcceptableFallback(surface_info.id());
} }
void WindowPortLocal::OnFrameTokenChanged(uint32_t frame_token) {} void WindowPortLocal::OnFrameTokenChanged(uint32_t frame_token) {}
......
...@@ -49,7 +49,6 @@ bool ClientSurfaceEmbedder::HasPrimarySurfaceId() const { ...@@ -49,7 +49,6 @@ bool ClientSurfaceEmbedder::HasPrimarySurfaceId() const {
void ClientSurfaceEmbedder::SetFallbackSurfaceInfo( void ClientSurfaceEmbedder::SetFallbackSurfaceInfo(
const viz::SurfaceInfo& surface_info) { const viz::SurfaceInfo& surface_info) {
fallback_surface_info_ = surface_info; fallback_surface_info_ = surface_info;
surface_layer_owner_->layer()->SetOldestAcceptableFallback(surface_info.id());
UpdateSizeAndGutters(); 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