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

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

Issue 2854163003: [cc] Plumb BeginFrameAcks through SurfaceManager to DisplayScheduler. (Closed)
Patch Set: Pass ack via SurfaceDamaged, add back tests. Created 3 years, 7 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 "base/containers/flat_set.h" 5 #include "base/containers/flat_set.h"
6 #include "cc/surfaces/compositor_frame_sink_support.h" 6 #include "cc/surfaces/compositor_frame_sink_support.h"
7 #include "cc/surfaces/surface_id.h" 7 #include "cc/surfaces/surface_id.h"
8 #include "cc/surfaces/surface_manager.h" 8 #include "cc/surfaces/surface_manager.h"
9 #include "cc/surfaces/surface_observer.h" 9 #include "cc/surfaces/surface_observer.h"
10 #include "cc/test/begin_frame_args_test.h" 10 #include "cc/test/begin_frame_args_test.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 145
146 damaged_surfaces_.clear(); 146 damaged_surfaces_.clear();
147 } 147 }
148 148
149 bool IsSurfaceDamaged(const SurfaceId& surface_id) const { 149 bool IsSurfaceDamaged(const SurfaceId& surface_id) const {
150 return damaged_surfaces_.count(surface_id) > 0; 150 return damaged_surfaces_.count(surface_id) > 0;
151 } 151 }
152 152
153 // SurfaceObserver implementation: 153 // SurfaceObserver implementation:
154 void OnSurfaceCreated(const SurfaceInfo& surface_info) override {} 154 void OnSurfaceCreated(const SurfaceInfo& surface_info) override {}
155 void OnSurfaceDamaged(const SurfaceId& surface_id, bool* changed) override { 155 void OnSurfaceDamaged(const SurfaceId& surface_id,
156 damaged_surfaces_.insert(surface_id); 156 const BeginFrameAck& ack,
157 bool* changed) override {
158 if (ack.has_damage)
159 damaged_surfaces_.insert(surface_id);
157 } 160 }
158 void OnSurfaceDiscarded(const SurfaceId& surface_id) override {} 161 void OnSurfaceDiscarded(const SurfaceId& surface_id) override {}
162 void OnSurfaceDestroyed(const SurfaceId& surface_id) override {}
163 void OnSurfaceDamageExpected(const SurfaceId& surface_id,
164 const BeginFrameArgs& args) override {}
159 165
160 protected: 166 protected:
161 testing::NiceMock<MockCompositorFrameSinkSupportClient> support_client_; 167 testing::NiceMock<MockCompositorFrameSinkSupportClient> support_client_;
162 168
163 private: 169 private:
164 base::flat_set<SurfaceId> damaged_surfaces_; 170 base::flat_set<SurfaceId> damaged_surfaces_;
165 SurfaceManager surface_manager_; 171 SurfaceManager surface_manager_;
166 std::unique_ptr<FakeExternalBeginFrameSource> begin_frame_source_; 172 std::unique_ptr<FakeExternalBeginFrameSource> begin_frame_source_;
167 std::vector<std::unique_ptr<CompositorFrameSinkSupport>> supports_; 173 std::vector<std::unique_ptr<CompositorFrameSinkSupport>> supports_;
168 174
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 ui::LatencyInfo::LatencyComponent comp1; 975 ui::LatencyInfo::LatencyComponent comp1;
970 EXPECT_TRUE( 976 EXPECT_TRUE(
971 aggregated_latency_info.FindLatency(latency_type1, latency_id1, &comp1)); 977 aggregated_latency_info.FindLatency(latency_type1, latency_id1, &comp1));
972 EXPECT_EQ(latency_sequence_number1, comp1.sequence_number); 978 EXPECT_EQ(latency_sequence_number1, comp1.sequence_number);
973 EXPECT_TRUE( 979 EXPECT_TRUE(
974 aggregated_latency_info.FindLatency(latency_type2, latency_id2, nullptr)); 980 aggregated_latency_info.FindLatency(latency_type2, latency_id2, nullptr));
975 EXPECT_TRUE(aggregated_latency_info.FindLatency( 981 EXPECT_TRUE(aggregated_latency_info.FindLatency(
976 ui::DISPLAY_COMPOSITOR_RECEIVED_FRAME_COMPONENT, nullptr)); 982 ui::DISPLAY_COMPOSITOR_RECEIVED_FRAME_COMPONENT, nullptr));
977 } 983 }
978 984
979 // TODO(eseckler): Add back tests for BeginFrameAck forwarding through
980 // CompositorFrameSinkSupport when we add plumbing of BeginFrameAcks through
981 // SurfaceObservers.
982
983 // Checks that resources and ack are sent together if possible. 985 // Checks that resources and ack are sent together if possible.
984 TEST_F(SurfaceSynchronizationTest, ReturnResourcesWithAck) { 986 TEST_F(SurfaceSynchronizationTest, ReturnResourcesWithAck) {
985 const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); 987 const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1);
986 TransferableResource resource; 988 TransferableResource resource;
987 resource.id = 1234; 989 resource.id = 1234;
988 parent_support().SubmitCompositorFrame( 990 parent_support().SubmitCompositorFrame(
989 parent_id.local_surface_id(), 991 parent_id.local_surface_id(),
990 MakeCompositorFrame(empty_surface_ids(), empty_surface_ids(), 992 MakeCompositorFrame(empty_surface_ids(), empty_surface_ids(),
991 {resource})); 993 {resource}));
992 ReturnedResourceArray returned_resources; 994 ReturnedResourceArray returned_resources;
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
1355 DidReceiveCompositorFrameAck(Eq(returned_resources2))); 1357 DidReceiveCompositorFrameAck(Eq(returned_resources2)));
1356 child_support1().SubmitCompositorFrame( 1358 child_support1().SubmitCompositorFrame(
1357 child_id1.local_surface_id(), 1359 child_id1.local_surface_id(),
1358 MakeCompositorFrame(empty_surface_ids(), empty_surface_ids(), 1360 MakeCompositorFrame(empty_surface_ids(), empty_surface_ids(),
1359 {resource2})); 1361 {resource2}));
1360 testing::Mock::VerifyAndClearExpectations(&support_client_); 1362 testing::Mock::VerifyAndClearExpectations(&support_client_);
1361 } 1363 }
1362 1364
1363 } // namespace test 1365 } // namespace test
1364 } // namespace cc 1366 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698