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

Fix black screen when navigating to somewhere after js alert dialog

The renderer's surface should not be destroyed while it is still
visible, because future CompositorFrames to that surface will be
rejected.

Bug: 933374
Change-Id: I46c34bad903f052bfd2ee43e6b673a8ef26fca30
Reviewed-on: https://chromium-review.googlesource.com/c/1495368
Commit-Queue: Saman Sami <samans@chromium.org>
Reviewed-by: default avatarEric Karl <ericrk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#636567}
parent 0bb4549e
...@@ -198,7 +198,7 @@ void DelegatedFrameHostAndroid::EvictDelegatedFrame() { ...@@ -198,7 +198,7 @@ void DelegatedFrameHostAndroid::EvictDelegatedFrame() {
content_layer_->RemoveFromParent(); content_layer_->RemoveFromParent();
content_layer_ = nullptr; content_layer_ = nullptr;
} }
if (!HasSavedFrame()) if (!HasSavedFrame() || frame_evictor_->visible())
return; return;
std::vector<viz::SurfaceId> surface_ids = { std::vector<viz::SurfaceId> surface_ids = {
viz::SurfaceId(frame_sink_id_, local_surface_id_)}; viz::SurfaceId(frame_sink_id_, local_surface_id_)};
......
...@@ -367,16 +367,15 @@ TEST_F(DelegatedFrameHostAndroidLegacyNonVizTest, TestBothCompositorLocks) { ...@@ -367,16 +367,15 @@ TEST_F(DelegatedFrameHostAndroidLegacyNonVizTest, TestBothCompositorLocks) {
// Make sure frame evictor is notified of the newly embedded surface after // Make sure frame evictor is notified of the newly embedded surface after
// WasShown. // WasShown.
TEST_F(DelegatedFrameHostAndroidVizTest, EmbedWhileHidden) { TEST_F(DelegatedFrameHostAndroidVizTest, EmbedWhileHidden) {
{ // Ensure there is currently no frame.
EXPECT_CALL(client_, WasEvicted()); frame_host_->WasHidden();
frame_host_->EvictDelegatedFrame(); frame_host_->EvictDelegatedFrame();
}
EXPECT_FALSE(frame_host_->HasSavedFrame()); EXPECT_FALSE(frame_host_->HasSavedFrame());
allocator_.GenerateId(); allocator_.GenerateId();
viz::LocalSurfaceId id = viz::LocalSurfaceId id =
allocator_.GetCurrentLocalSurfaceIdAllocation().local_surface_id(); allocator_.GetCurrentLocalSurfaceIdAllocation().local_surface_id();
gfx::Size size(100, 100); gfx::Size size(100, 100);
frame_host_->WasHidden();
frame_host_->EmbedSurface(id, size, cc::DeadlinePolicy::UseDefaultDeadline()); frame_host_->EmbedSurface(id, size, cc::DeadlinePolicy::UseDefaultDeadline());
EXPECT_FALSE(frame_host_->HasSavedFrame()); EXPECT_FALSE(frame_host_->HasSavedFrame());
frame_host_->WasShown(id, size); frame_host_->WasShown(id, size);
......
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