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

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

Issue 2727553004: [cc] Forward BeginFrameAcks through DirectCFS and CFSSupport. (Closed)
Patch Set: 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 unified diff | Download patch
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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 true /* handles_frame_sink_id_invalidation */, 146 true /* handles_frame_sink_id_invalidation */,
147 true /* needs_sync_points */)); 147 true /* needs_sync_points */));
148 supports_.push_back(base::MakeUnique<CompositorFrameSinkSupport>( 148 supports_.push_back(base::MakeUnique<CompositorFrameSinkSupport>(
149 this, &surface_manager_, kChildFrameSink1, false /* is_root */, 149 this, &surface_manager_, kChildFrameSink1, false /* is_root */,
150 true /* handles_frame_sink_id_invalidation */, 150 true /* handles_frame_sink_id_invalidation */,
151 true /* needs_sync_points */)); 151 true /* needs_sync_points */));
152 supports_.push_back(base::MakeUnique<CompositorFrameSinkSupport>( 152 supports_.push_back(base::MakeUnique<CompositorFrameSinkSupport>(
153 this, &surface_manager_, kChildFrameSink2, false /* is_root */, 153 this, &surface_manager_, kChildFrameSink2, false /* is_root */,
154 true /* handles_frame_sink_id_invalidation */, 154 true /* handles_frame_sink_id_invalidation */,
155 true /* needs_sync_points */)); 155 true /* needs_sync_points */));
156 surface_manager_.RegisterBeginFrameSource(begin_frame_source_.get(),
Fady Samuel 2017/03/01 19:49:07 I guess cc::Display normally does this? Could you
Eric Seckler 2017/03/02 09:41:59 Correct, normally done by the display. The other t
157 kDisplayFrameSink);
156 } 158 }
157 159
158 void TearDown() override { 160 void TearDown() override {
159 surface_manager_.SetDependencyTracker(nullptr); 161 surface_manager_.SetDependencyTracker(nullptr);
162 surface_manager_.UnregisterBeginFrameSource(begin_frame_source_.get());
160 163
161 // SurfaceDependencyTracker depends on this BeginFrameSource and so it must 164 // SurfaceDependencyTracker depends on this BeginFrameSource and so it must
162 // be destroyed AFTER the dependency tracker is destroyed. 165 // be destroyed AFTER the dependency tracker is destroyed.
163 begin_frame_source_.reset(); 166 begin_frame_source_.reset();
164 167
165 supports_.clear(); 168 supports_.clear();
166 } 169 }
167 170
168 // CompositorFrameSinkSupportClient implementation. 171 // CompositorFrameSinkSupportClient implementation.
169 void DidReceiveCompositorFrameAck() override {} 172 void DidReceiveCompositorFrameAck() override {}
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 719
717 // Verify that the parent Surface has activated and no longer has a pending 720 // Verify that the parent Surface has activated and no longer has a pending
718 // CompositorFrame. Also verify that |child_id1| is no longer a child 721 // CompositorFrame. Also verify that |child_id1| is no longer a child
719 // reference of |parent_id|. 722 // reference of |parent_id|.
720 EXPECT_TRUE(parent_surface()->HasActiveFrame()); 723 EXPECT_TRUE(parent_surface()->HasActiveFrame());
721 EXPECT_FALSE(parent_surface()->HasPendingFrame()); 724 EXPECT_FALSE(parent_surface()->HasPendingFrame());
722 EXPECT_THAT(parent_surface()->blocking_surfaces_for_testing(), IsEmpty()); 725 EXPECT_THAT(parent_surface()->blocking_surfaces_for_testing(), IsEmpty());
723 EXPECT_THAT(GetChildReferences(parent_id), UnorderedElementsAre(child_id2)); 726 EXPECT_THAT(GetChildReferences(parent_id), UnorderedElementsAre(child_id2));
724 } 727 }
725 728
729 TEST_F(CompositorFrameSinkSupportTest, PassesOnBeginFrameAcks) {
730 // Request BeginFrames.
731 display_support().SetNeedsBeginFrame(true);
732
733 // Issue a BeginFrame.
734 BeginFrameArgs args =
735 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 0, 1);
736 begin_frame_source()->TestOnBeginFrame(args);
737
738 // Check that the support forwards our ack to the BeginFrameSource.
739 BeginFrameAck ack(0, 1, 1, 0, false);
740 display_support().DidFinishFrame(ack);
741 EXPECT_EQ(ack, begin_frame_source()->LastAckForObserver(&display_support()));
742 }
743
726 } // namespace test 744 } // namespace test
727 } // namespace cc 745 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/compositor_frame_sink_support.cc ('k') | cc/surfaces/direct_compositor_frame_sink.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698