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

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

Issue 2779633002: [cc] Remove remaining_frames from BeginFrameAck. (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/debug/stack_trace.h" 7 #include "base/debug/stack_trace.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "cc/output/compositor_frame.h" 9 #include "cc/output/compositor_frame.h"
10 #include "cc/surfaces/compositor_frame_sink_support_client.h" 10 #include "cc/surfaces/compositor_frame_sink_support_client.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } 66 }
67 67
68 SurfaceId MakeSurfaceId(const FrameSinkId& frame_sink_id, uint32_t local_id) { 68 SurfaceId MakeSurfaceId(const FrameSinkId& frame_sink_id, uint32_t local_id) {
69 return SurfaceId( 69 return SurfaceId(
70 frame_sink_id, 70 frame_sink_id,
71 LocalSurfaceId(local_id, base::UnguessableToken::Deserialize(0, 1u))); 71 LocalSurfaceId(local_id, base::UnguessableToken::Deserialize(0, 1u)));
72 } 72 }
73 73
74 CompositorFrame MakeCompositorFrame() { 74 CompositorFrame MakeCompositorFrame() {
75 CompositorFrame compositor_frame; 75 CompositorFrame compositor_frame;
76 compositor_frame.metadata.begin_frame_ack = BeginFrameAck(0, 1, 1, 0, true); 76 compositor_frame.metadata.begin_frame_ack = BeginFrameAck(0, 1, 1, true);
77 return compositor_frame; 77 return compositor_frame;
78 } 78 }
79 79
80 CompositorFrame MakeCompositorFrame( 80 CompositorFrame MakeCompositorFrame(
81 std::vector<SurfaceId> referenced_surfaces) { 81 std::vector<SurfaceId> referenced_surfaces) {
82 CompositorFrame compositor_frame; 82 CompositorFrame compositor_frame;
83 compositor_frame.metadata.begin_frame_ack = BeginFrameAck(0, 1, 1, 0, true); 83 compositor_frame.metadata.begin_frame_ack = BeginFrameAck(0, 1, 1, true);
84 compositor_frame.metadata.referenced_surfaces = 84 compositor_frame.metadata.referenced_surfaces =
85 std::move(referenced_surfaces); 85 std::move(referenced_surfaces);
86 return compositor_frame; 86 return compositor_frame;
87 } 87 }
88 88
89 CompositorFrame MakeCompositorFrameWithResources( 89 CompositorFrame MakeCompositorFrameWithResources(
90 std::vector<SurfaceId> referenced_surfaces, 90 std::vector<SurfaceId> referenced_surfaces,
91 TransferableResourceArray resource_list) { 91 TransferableResourceArray resource_list) {
92 CompositorFrame compositor_frame; 92 CompositorFrame compositor_frame;
93 compositor_frame.metadata.begin_frame_ack = BeginFrameAck(0, 1, 1, 0, true); 93 compositor_frame.metadata.begin_frame_ack = BeginFrameAck(0, 1, 1, true);
94 compositor_frame.metadata.referenced_surfaces = 94 compositor_frame.metadata.referenced_surfaces =
95 std::move(referenced_surfaces); 95 std::move(referenced_surfaces);
96 compositor_frame.resource_list = std::move(resource_list); 96 compositor_frame.resource_list = std::move(resource_list);
97 return compositor_frame; 97 return compositor_frame;
98 } 98 }
99 99
100 TransferableResource MakeResource(ResourceId id, 100 TransferableResource MakeResource(ResourceId id,
101 ResourceFormat format, 101 ResourceFormat format,
102 uint32_t filter, 102 uint32_t filter,
103 const gfx::Size& size) { 103 const gfx::Size& size) {
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 // Request BeginFrames. 961 // Request BeginFrames.
962 display_support().SetNeedsBeginFrame(true); 962 display_support().SetNeedsBeginFrame(true);
963 963
964 // Issue a BeginFrame. 964 // Issue a BeginFrame.
965 BeginFrameArgs args = 965 BeginFrameArgs args =
966 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 0, 1); 966 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 0, 1);
967 begin_frame_source()->TestOnBeginFrame(args); 967 begin_frame_source()->TestOnBeginFrame(args);
968 968
969 // Check that the support forwards a BeginFrameDidNotSwap ack to the 969 // Check that the support forwards a BeginFrameDidNotSwap ack to the
970 // BeginFrameSource. 970 // BeginFrameSource.
971 BeginFrameAck ack(0, 1, 1, 0, false); 971 BeginFrameAck ack(0, 1, 1, false);
972 display_support().BeginFrameDidNotSwap(ack); 972 display_support().BeginFrameDidNotSwap(ack);
973 EXPECT_EQ(ack, begin_frame_source()->LastAckForObserver(&display_support())); 973 EXPECT_EQ(ack, begin_frame_source()->LastAckForObserver(&display_support()));
974 974
975 // TODO(eseckler): Check that the support forwards the BeginFrameAck attached 975 // TODO(eseckler): Check that the support forwards the BeginFrameAck attached
976 // to a CompositorFrame to the BeginFrameSource. 976 // to a CompositorFrame to the BeginFrameSource.
977 } 977 }
978 978
979 // Checks whether the resources are returned before we send an ack. 979 // Checks whether the resources are returned before we send an ack.
980 TEST_F(CompositorFrameSinkSupportTest, ReturnResourcesBeforeAck) { 980 TEST_F(CompositorFrameSinkSupportTest, ReturnResourcesBeforeAck) {
981 const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); 981 const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1);
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1095 // be used and destroyed() must return false. The surface must have a factory. 1095 // be used and destroyed() must return false. The surface must have a factory.
1096 child_support->SubmitCompositorFrame( 1096 child_support->SubmitCompositorFrame(
1097 child_id.local_surface_id(), MakeCompositorFrame(empty_surface_ids())); 1097 child_id.local_surface_id(), MakeCompositorFrame(empty_surface_ids()));
1098 EXPECT_EQ(surface, surface_manager().GetSurfaceForId(child_id)); 1098 EXPECT_EQ(surface, surface_manager().GetSurfaceForId(child_id));
1099 EXPECT_TRUE(surface->factory()); 1099 EXPECT_TRUE(surface->factory());
1100 EXPECT_FALSE(surface->destroyed()); 1100 EXPECT_FALSE(surface->destroyed());
1101 } 1101 }
1102 1102
1103 } // namespace test 1103 } // namespace test
1104 } // namespace cc 1104 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/compositor_frame_sink_support.cc ('k') | cc/surfaces/direct_compositor_frame_sink_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698