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

Side by Side Diff: cc/surfaces/compositor_frame_sink_support_unittest.cc

Issue 2689213003: Evicted frames should immediately unblock dependent CompositorFrames (Closed)
Patch Set: Created 3 years, 10 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 | cc/surfaces/surface_dependency_tracker.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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "cc/surfaces/compositor_frame_sink_support.h" 5 #include "cc/surfaces/compositor_frame_sink_support.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "cc/output/compositor_frame.h" 8 #include "cc/output/compositor_frame.h"
9 #include "cc/surfaces/compositor_frame_sink_support_client.h" 9 #include "cc/surfaces/compositor_frame_sink_support_client.h"
10 #include "cc/surfaces/frame_sink_id.h" 10 #include "cc/surfaces/frame_sink_id.h"
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 EXPECT_TRUE(child_surface1()->HasActiveFrame()); 566 EXPECT_TRUE(child_surface1()->HasActiveFrame());
567 EXPECT_FALSE(child_surface1()->HasPendingFrame()); 567 EXPECT_FALSE(child_surface1()->HasPendingFrame());
568 EXPECT_THAT(child_surface1()->blocking_surfaces_for_testing(), IsEmpty()); 568 EXPECT_THAT(child_surface1()->blocking_surfaces_for_testing(), IsEmpty());
569 569
570 // Verify that there is no temporary reference for the child and that 570 // Verify that there is no temporary reference for the child and that
571 // the reference from the parent to the child still exists. 571 // the reference from the parent to the child still exists.
572 EXPECT_THAT(GetTempReferences(child_id.frame_sink_id()), IsEmpty()); 572 EXPECT_THAT(GetTempReferences(child_id.frame_sink_id()), IsEmpty());
573 EXPECT_THAT(GetChildReferences(parent_id), UnorderedElementsAre(child_id)); 573 EXPECT_THAT(GetChildReferences(parent_id), UnorderedElementsAre(child_id));
574 } 574 }
575 575
576 // The parent Surface is blocked on |child_id2| which is blocked on |child_id3|.
577 // child_support1 evicts its blocked Surface. The parent surface should
578 // activate.
579 TEST_F(CompositorFrameSinkSupportTest, EvictSurfaceWithPendingFrame) {
580 const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1);
581 const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1);
582 const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1);
583
584 // Submit a CompositorFrame that depends on |child_id1|.
585 parent_support().SubmitCompositorFrame(parent_id1.local_surface_id(),
586 MakeCompositorFrame({child_id1}));
587
588 // Verify that the CompositorFrame is blocked on |child_id1|.
589 EXPECT_FALSE(parent_surface()->HasActiveFrame());
590 EXPECT_TRUE(parent_surface()->HasPendingFrame());
591 EXPECT_THAT(parent_surface()->blocking_surfaces_for_testing(),
592 UnorderedElementsAre(child_id1));
593
594 // Submit a CompositorFrame that depends on |child_id2|.
595 child_support1().SubmitCompositorFrame(child_id1.local_surface_id(),
596 MakeCompositorFrame({child_id2}));
597
598 // Verify that the CompositorFrame is blocked on |child_id2|.
599 EXPECT_FALSE(child_surface1()->HasActiveFrame());
600 EXPECT_TRUE(child_surface1()->HasPendingFrame());
601 EXPECT_THAT(child_surface1()->blocking_surfaces_for_testing(),
602 UnorderedElementsAre(child_id2));
603
604 // Evict child_support1's current Surface.
605 // TODO(fsamuel): EvictFrame => EvictCurrentSurface.
606 child_support1().EvictFrame();
607
608 // The parent Surface should immediately activate.
609 EXPECT_TRUE(parent_surface()->HasActiveFrame());
610 EXPECT_FALSE(parent_surface()->HasPendingFrame());
611 EXPECT_THAT(parent_surface()->blocking_surfaces_for_testing(), IsEmpty());
612 EXPECT_FALSE(dependency_tracker().has_deadline());
613 }
614
576 } // namespace test 615 } // namespace test
577 } // namespace cc 616 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/surfaces/surface_dependency_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698