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

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

Issue 2802023002: Remove SurfaceFactory And SurfaceFactoryClient (Closed)
Patch Set: Rebase SurfaceSynchronizationTest 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
« no previous file with comments | « cc/surfaces/surface_resource_holder.cc ('k') | cc/test/compositor_frame_helpers.h » ('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
7 #include "base/macros.h"
8 #include "cc/output/compositor_frame.h"
9 #include "cc/surfaces/compositor_frame_sink_support_client.h"
10 #include "cc/surfaces/frame_sink_id.h"
11 #include "cc/surfaces/surface_id.h" 6 #include "cc/surfaces/surface_id.h"
12 #include "cc/surfaces/surface_manager.h" 7 #include "cc/surfaces/surface_manager.h"
8 #include "cc/surfaces/surface_observer.h"
13 #include "cc/test/begin_frame_args_test.h" 9 #include "cc/test/begin_frame_args_test.h"
14 #include "cc/test/compositor_frame_helpers.h" 10 #include "cc/test/compositor_frame_helpers.h"
15 #include "cc/test/fake_external_begin_frame_source.h" 11 #include "cc/test/fake_external_begin_frame_source.h"
12 #include "cc/test/mock_compositor_frame_sink_support_client.h"
16 #include "testing/gmock/include/gmock/gmock.h" 13 #include "testing/gmock/include/gmock/gmock.h"
17 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
18 15
19 using testing::UnorderedElementsAre;
20 using testing::IsEmpty;
21 using testing::SizeIs;
22 using testing::Invoke;
23 using testing::_; 16 using testing::_;
24 using testing::Eq; 17 using testing::Eq;
18 using testing::IsEmpty;
19 using testing::UnorderedElementsAre;
25 20
26 namespace cc { 21 namespace cc {
22 namespace test {
27 namespace { 23 namespace {
28 24
25 constexpr bool kIsRoot = true;
26 constexpr bool kIsChildRoot = false;
27 constexpr bool kHandlesFrameSinkIdInvalidation = true;
28 constexpr bool kNeedsSyncPoints = true;
29 constexpr FrameSinkId kDisplayFrameSink(2, 0); 29 constexpr FrameSinkId kDisplayFrameSink(2, 0);
30 constexpr FrameSinkId kParentFrameSink(3, 0); 30 constexpr FrameSinkId kParentFrameSink(3, 0);
31 constexpr FrameSinkId kChildFrameSink1(65563, 0); 31 constexpr FrameSinkId kChildFrameSink1(65563, 0);
32 constexpr FrameSinkId kChildFrameSink2(65564, 0); 32 constexpr FrameSinkId kChildFrameSink2(65564, 0);
33 constexpr FrameSinkId kArbitraryFrameSink(1337, 7331); 33 constexpr FrameSinkId kArbitraryFrameSink(1337, 7331);
34 34
35 class MockCompositorFrameSinkSupportClient
36 : public CompositorFrameSinkSupportClient {
37 public:
38 MockCompositorFrameSinkSupportClient() {
39 ON_CALL(*this, ReclaimResources(_))
40 .WillByDefault(Invoke(
41 this,
42 &MockCompositorFrameSinkSupportClient::ReclaimResourcesInternal));
43 ON_CALL(*this, DidReceiveCompositorFrameAck(_))
44 .WillByDefault(Invoke(
45 this,
46 &MockCompositorFrameSinkSupportClient::ReclaimResourcesInternal));
47 }
48
49 ReturnedResourceArray& last_returned_resources() {
50 return last_returned_resources_;
51 }
52
53 // CompositorFrameSinkSupportClient implementation.
54 MOCK_METHOD1(DidReceiveCompositorFrameAck,
55 void(const ReturnedResourceArray&));
56 MOCK_METHOD1(OnBeginFrame, void(const BeginFrameArgs&));
57 MOCK_METHOD1(ReclaimResources, void(const ReturnedResourceArray&));
58 MOCK_METHOD2(WillDrawSurface, void(const LocalSurfaceId&, const gfx::Rect&));
59
60 private:
61 void ReclaimResourcesInternal(const ReturnedResourceArray& resources) {
62 last_returned_resources_ = resources;
63 }
64
65 ReturnedResourceArray last_returned_resources_;
66 };
67
68 std::vector<SurfaceId> empty_surface_ids() { 35 std::vector<SurfaceId> empty_surface_ids() {
69 return std::vector<SurfaceId>(); 36 return std::vector<SurfaceId>();
70 } 37 }
71 38
72 SurfaceId MakeSurfaceId(const FrameSinkId& frame_sink_id, uint32_t local_id) { 39 SurfaceId MakeSurfaceId(const FrameSinkId& frame_sink_id, uint32_t local_id) {
73 return SurfaceId( 40 return SurfaceId(
74 frame_sink_id, 41 frame_sink_id,
75 LocalSurfaceId(local_id, base::UnguessableToken::Deserialize(0, 1u))); 42 LocalSurfaceId(local_id, base::UnguessableToken::Deserialize(0, 1u)));
76 } 43 }
77 44
78 CompositorFrame MakeCompositorFrame(
79 std::vector<SurfaceId> activation_dependencies,
80 std::vector<SurfaceId> referenced_surfaces,
81 TransferableResourceArray resource_list) {
82 CompositorFrame compositor_frame = test::MakeCompositorFrame();
83 compositor_frame.metadata.begin_frame_ack = BeginFrameAck(0, 1, 1, true);
84 compositor_frame.metadata.activation_dependencies =
85 std::move(activation_dependencies);
86 compositor_frame.metadata.referenced_surfaces =
87 std::move(referenced_surfaces);
88 compositor_frame.resource_list = std::move(resource_list);
89 return compositor_frame;
90 }
91
92 CompositorFrame MakeCompositorFrame() {
93 return MakeCompositorFrame(empty_surface_ids(), empty_surface_ids(),
94 TransferableResourceArray());
95 }
96
97 CompositorFrame MakeCompositorFrame(
98 std::vector<SurfaceId> activation_dependencies) {
99 return MakeCompositorFrame(activation_dependencies, activation_dependencies,
100 TransferableResourceArray());
101 }
102
103 CompositorFrame MakeCompositorFrame(
104 std::vector<SurfaceId> activation_dependencies,
105 std::vector<SurfaceId> referenced_surfaces) {
106 return MakeCompositorFrame(std::move(activation_dependencies),
107 std::move(referenced_surfaces),
108 TransferableResourceArray());
109 }
110
111 CompositorFrame MakeCompositorFrameWithResources(
112 std::vector<SurfaceId> activation_dependencies,
113 TransferableResourceArray resource_list) {
114 return MakeCompositorFrame(activation_dependencies, empty_surface_ids(),
115 std::move(resource_list));
116 }
117
118 TransferableResource MakeResource(ResourceId id,
119 ResourceFormat format,
120 uint32_t filter,
121 const gfx::Size& size) {
122 TransferableResource resource;
123 resource.id = id;
124 resource.format = format;
125 resource.filter = filter;
126 resource.size = size;
127 return resource;
128 }
129
130 } // namespace 45 } // namespace
131 46
132 class CompositorFrameSinkSupportTest : public testing::Test, 47 class SurfaceSynchronizationTest : public testing::Test,
133 public SurfaceObserver { 48 public SurfaceObserver {
134 public: 49 public:
135 CompositorFrameSinkSupportTest() 50 SurfaceSynchronizationTest()
136 : surface_manager_(SurfaceManager::LifetimeType::REFERENCES) {} 51 : surface_manager_(SurfaceManager::LifetimeType::REFERENCES) {}
137 ~CompositorFrameSinkSupportTest() override {} 52 ~SurfaceSynchronizationTest() override {}
138 53
139 CompositorFrameSinkSupport& display_support() { return *supports_[0]; } 54 CompositorFrameSinkSupport& display_support() { return *supports_[0]; }
140 Surface* display_surface() { 55 Surface* display_surface() {
141 return display_support().current_surface_for_testing(); 56 return display_support().current_surface_for_testing();
142 } 57 }
143 58
144 CompositorFrameSinkSupport& parent_support() { return *supports_[1]; } 59 CompositorFrameSinkSupport& parent_support() { return *supports_[1]; }
145 Surface* parent_surface() { 60 Surface* parent_surface() {
146 return parent_support().current_surface_for_testing(); 61 return parent_support().current_surface_for_testing();
147 } 62 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 return *surface_manager_.dependency_tracker(); 96 return *surface_manager_.dependency_tracker();
182 } 97 }
183 98
184 FakeExternalBeginFrameSource* begin_frame_source() { 99 FakeExternalBeginFrameSource* begin_frame_source() {
185 return begin_frame_source_.get(); 100 return begin_frame_source_.get();
186 } 101 }
187 102
188 // testing::Test: 103 // testing::Test:
189 void SetUp() override { 104 void SetUp() override {
190 testing::Test::SetUp(); 105 testing::Test::SetUp();
191 constexpr bool is_root = true; 106
192 constexpr bool is_child_root = false;
193 constexpr bool handles_frame_sink_id_invalidation = true;
194 constexpr bool needs_sync_points = true;
195 begin_frame_source_ = 107 begin_frame_source_ =
196 base::MakeUnique<FakeExternalBeginFrameSource>(0.f, false); 108 base::MakeUnique<FakeExternalBeginFrameSource>(0.f, false);
197 surface_manager_.SetDependencyTracker( 109 surface_manager_.SetDependencyTracker(
198 base::MakeUnique<SurfaceDependencyTracker>(&surface_manager_, 110 base::MakeUnique<SurfaceDependencyTracker>(&surface_manager_,
199 begin_frame_source_.get())); 111 begin_frame_source_.get()));
200 surface_manager_.AddObserver(this); 112 surface_manager_.AddObserver(this);
201 supports_.push_back(CompositorFrameSinkSupport::Create( 113 supports_.push_back(CompositorFrameSinkSupport::Create(
202 &support_client_, &surface_manager_, kDisplayFrameSink, is_root, 114 &support_client_, &surface_manager_, kDisplayFrameSink, kIsRoot,
203 handles_frame_sink_id_invalidation, needs_sync_points)); 115 kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints));
204 supports_.push_back(CompositorFrameSinkSupport::Create( 116 supports_.push_back(CompositorFrameSinkSupport::Create(
205 &support_client_, &surface_manager_, kParentFrameSink, is_child_root, 117 &support_client_, &surface_manager_, kParentFrameSink, kIsChildRoot,
206 handles_frame_sink_id_invalidation, needs_sync_points)); 118 kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints));
207 supports_.push_back(CompositorFrameSinkSupport::Create( 119 supports_.push_back(CompositorFrameSinkSupport::Create(
208 &support_client_, &surface_manager_, kChildFrameSink1, is_child_root, 120 &support_client_, &surface_manager_, kChildFrameSink1, kIsChildRoot,
209 handles_frame_sink_id_invalidation, needs_sync_points)); 121 kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints));
210 supports_.push_back(CompositorFrameSinkSupport::Create( 122 supports_.push_back(CompositorFrameSinkSupport::Create(
211 &support_client_, &surface_manager_, kChildFrameSink2, is_child_root, 123 &support_client_, &surface_manager_, kChildFrameSink2, kIsChildRoot,
212 handles_frame_sink_id_invalidation, needs_sync_points)); 124 kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints));
213 125
214 // Normally, the BeginFrameSource would be registered by the Display. We 126 // Normally, the BeginFrameSource would be registered by the Display. We
215 // register it here so that BeginFrames are received by the display support, 127 // register it here so that BeginFrames are received by the display support,
216 // for use in the PassesOnBeginFrameAcks test. Other supports do not receive 128 // for use in the PassesOnBeginFrameAcks test. Other supports do not receive
217 // BeginFrames, since the frame sink hierarchy is not set up in this test. 129 // BeginFrames, since the frame sink hierarchy is not set up in this test.
218 surface_manager_.RegisterBeginFrameSource(begin_frame_source_.get(), 130 surface_manager_.RegisterBeginFrameSource(begin_frame_source_.get(),
219 kDisplayFrameSink); 131 kDisplayFrameSink);
220 } 132 }
221 133
222 void TearDown() override { 134 void TearDown() override {
(...skipping 22 matching lines...) Expand all
245 157
246 protected: 158 protected:
247 testing::NiceMock<MockCompositorFrameSinkSupportClient> support_client_; 159 testing::NiceMock<MockCompositorFrameSinkSupportClient> support_client_;
248 160
249 private: 161 private:
250 base::flat_set<SurfaceId> damaged_surfaces_; 162 base::flat_set<SurfaceId> damaged_surfaces_;
251 SurfaceManager surface_manager_; 163 SurfaceManager surface_manager_;
252 std::unique_ptr<FakeExternalBeginFrameSource> begin_frame_source_; 164 std::unique_ptr<FakeExternalBeginFrameSource> begin_frame_source_;
253 std::vector<std::unique_ptr<CompositorFrameSinkSupport>> supports_; 165 std::vector<std::unique_ptr<CompositorFrameSinkSupport>> supports_;
254 166
255 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkSupportTest); 167 DISALLOW_COPY_AND_ASSIGN(SurfaceSynchronizationTest);
256 }; 168 };
257 169
258 // The display root surface should have a surface reference from the top-level 170 // The display root surface should have a surface reference from the top-level
259 // root added/removed when a CompositorFrame is submitted with a new SurfaceId. 171 // root added/removed when a CompositorFrame is submitted with a new SurfaceId.
260 TEST_F(CompositorFrameSinkSupportTest, RootSurfaceReceivesReferences) { 172 TEST_F(SurfaceSynchronizationTest, RootSurfaceReceivesReferences) {
261 const SurfaceId display_id_first = MakeSurfaceId(kDisplayFrameSink, 1); 173 const SurfaceId display_id_first = MakeSurfaceId(kDisplayFrameSink, 1);
262 const SurfaceId display_id_second = MakeSurfaceId(kDisplayFrameSink, 2); 174 const SurfaceId display_id_second = MakeSurfaceId(kDisplayFrameSink, 2);
263 175
264 // Submit a CompositorFrame for the first display root surface. 176 // Submit a CompositorFrame for the first display root surface.
265 display_support().SubmitCompositorFrame(display_id_first.local_surface_id(), 177 display_support().SubmitCompositorFrame(display_id_first.local_surface_id(),
266 MakeCompositorFrame()); 178 MakeCompositorFrame());
267 179
268 // A surface reference from the top-level root is added and there shouldn't be 180 // A surface reference from the top-level root is added and there shouldn't be
269 // a temporary reference. 181 // a temporary reference.
270 EXPECT_FALSE(HasTemporaryReference(display_id_first)); 182 EXPECT_FALSE(HasTemporaryReference(display_id_first));
271 EXPECT_THAT(GetChildReferences(surface_manager().GetRootSurfaceId()), 183 EXPECT_THAT(GetChildReferences(surface_manager().GetRootSurfaceId()),
272 UnorderedElementsAre(display_id_first)); 184 UnorderedElementsAre(display_id_first));
273 185
274 // Submit a CompositorFrame for the second display root surface. 186 // Submit a CompositorFrame for the second display root surface.
275 display_support().SubmitCompositorFrame(display_id_second.local_surface_id(), 187 display_support().SubmitCompositorFrame(display_id_second.local_surface_id(),
276 MakeCompositorFrame()); 188 MakeCompositorFrame());
277 189
278 // A surface reference from the top-level root to |display_id_second| should 190 // A surface reference from the top-level root to |display_id_second| should
279 // be added and the reference to |display_root_first| removed. 191 // be added and the reference to |display_root_first| removed.
280 EXPECT_FALSE(HasTemporaryReference(display_id_second)); 192 EXPECT_FALSE(HasTemporaryReference(display_id_second));
281 EXPECT_THAT(GetChildReferences(surface_manager().GetRootSurfaceId()), 193 EXPECT_THAT(GetChildReferences(surface_manager().GetRootSurfaceId()),
282 UnorderedElementsAre(display_id_second)); 194 UnorderedElementsAre(display_id_second));
283 195
284 // Surface |display_id_first| is unreachable and should get deleted. 196 // Surface |display_id_first| is unreachable and should get deleted.
285 EXPECT_EQ(nullptr, surface_manager().GetSurfaceForId(display_id_first)); 197 EXPECT_EQ(nullptr, surface_manager().GetSurfaceForId(display_id_first));
286 } 198 }
287 199
288 // The parent Surface is blocked on |child_id1| and |child_id2|. 200 // The parent Surface is blocked on |child_id1| and |child_id2|.
289 TEST_F(CompositorFrameSinkSupportTest, DisplayCompositorLockingBlockedOnTwo) { 201 TEST_F(SurfaceSynchronizationTest, BlockedOnTwo) {
290 const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); 202 const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1);
291 const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); 203 const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1);
292 const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1); 204 const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1);
293 205
294 parent_support().SubmitCompositorFrame( 206 parent_support().SubmitCompositorFrame(
295 parent_id.local_surface_id(), 207 parent_id.local_surface_id(),
296 MakeCompositorFrame({child_id1, child_id2}, empty_surface_ids())); 208 MakeCompositorFrame({child_id1, child_id2}, empty_surface_ids(),
209 TransferableResourceArray()));
297 210
298 // parent_support is blocked on |child_id1| and |child_id2|. 211 // parent_support is blocked on |child_id1| and |child_id2|.
299 EXPECT_TRUE(dependency_tracker().has_deadline()); 212 EXPECT_TRUE(dependency_tracker().has_deadline());
300 EXPECT_FALSE(parent_surface()->HasActiveFrame()); 213 EXPECT_FALSE(parent_surface()->HasActiveFrame());
301 EXPECT_TRUE(parent_surface()->HasPendingFrame()); 214 EXPECT_TRUE(parent_surface()->HasPendingFrame());
302 EXPECT_THAT(parent_surface()->blocking_surfaces(), 215 EXPECT_THAT(parent_surface()->blocking_surfaces(),
303 UnorderedElementsAre(child_id1, child_id2)); 216 UnorderedElementsAre(child_id1, child_id2));
304 217
305 // Submit a CompositorFrame without any dependencies to |child_id1|. 218 // Submit a CompositorFrame without any dependencies to |child_id1|.
306 // parent_support should now only be blocked on |child_id2|. 219 // parent_support should now only be blocked on |child_id2|.
(...skipping 11 matching lines...) Expand all
318 child_support2().SubmitCompositorFrame(child_id2.local_surface_id(), 231 child_support2().SubmitCompositorFrame(child_id2.local_surface_id(),
319 MakeCompositorFrame()); 232 MakeCompositorFrame());
320 233
321 EXPECT_FALSE(dependency_tracker().has_deadline()); 234 EXPECT_FALSE(dependency_tracker().has_deadline());
322 EXPECT_TRUE(parent_surface()->HasActiveFrame()); 235 EXPECT_TRUE(parent_surface()->HasActiveFrame());
323 EXPECT_FALSE(parent_surface()->HasPendingFrame()); 236 EXPECT_FALSE(parent_surface()->HasPendingFrame());
324 EXPECT_THAT(parent_surface()->blocking_surfaces(), IsEmpty()); 237 EXPECT_THAT(parent_surface()->blocking_surfaces(), IsEmpty());
325 } 238 }
326 239
327 // The parent Surface is blocked on |child_id2| which is blocked on |child_id3|. 240 // The parent Surface is blocked on |child_id2| which is blocked on |child_id3|.
328 TEST_F(CompositorFrameSinkSupportTest, DisplayCompositorLockingBlockedChain) { 241 TEST_F(SurfaceSynchronizationTest, BlockedChain) {
329 const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); 242 const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1);
330 const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); 243 const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1);
331 const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1); 244 const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1);
332 245
333 parent_support().SubmitCompositorFrame( 246 parent_support().SubmitCompositorFrame(
334 parent_id.local_surface_id(), 247 parent_id.local_surface_id(),
335 MakeCompositorFrame({child_id1}, empty_surface_ids())); 248 MakeCompositorFrame({child_id1}, empty_surface_ids(),
249 TransferableResourceArray()));
336 250
337 // parent_support is blocked on |child_id1|. 251 // parent_support is blocked on |child_id1|.
338 EXPECT_TRUE(dependency_tracker().has_deadline()); 252 EXPECT_TRUE(dependency_tracker().has_deadline());
339 EXPECT_FALSE(parent_surface()->HasActiveFrame()); 253 EXPECT_FALSE(parent_surface()->HasActiveFrame());
340 EXPECT_TRUE(parent_surface()->HasPendingFrame()); 254 EXPECT_TRUE(parent_surface()->HasPendingFrame());
341 EXPECT_THAT(parent_surface()->blocking_surfaces(), 255 EXPECT_THAT(parent_surface()->blocking_surfaces(),
342 UnorderedElementsAre(child_id1)); 256 UnorderedElementsAre(child_id1));
343 // The parent should not report damage until it activates. 257 // The parent should not report damage until it activates.
344 EXPECT_FALSE(IsSurfaceDamaged(parent_id)); 258 EXPECT_FALSE(IsSurfaceDamaged(parent_id));
345 259
346 child_support1().SubmitCompositorFrame( 260 child_support1().SubmitCompositorFrame(
347 child_id1.local_surface_id(), 261 child_id1.local_surface_id(),
348 MakeCompositorFrame({child_id2}, empty_surface_ids())); 262 MakeCompositorFrame({child_id2}, empty_surface_ids(),
263 TransferableResourceArray()));
349 264
350 // child_support1 should now be blocked on |child_id2|. 265 // child_support1 should now be blocked on |child_id2|.
351 EXPECT_TRUE(dependency_tracker().has_deadline()); 266 EXPECT_TRUE(dependency_tracker().has_deadline());
352 EXPECT_FALSE(child_surface1()->HasActiveFrame()); 267 EXPECT_FALSE(child_surface1()->HasActiveFrame());
353 EXPECT_TRUE(child_surface1()->HasPendingFrame()); 268 EXPECT_TRUE(child_surface1()->HasPendingFrame());
354 EXPECT_THAT(child_surface1()->blocking_surfaces(), 269 EXPECT_THAT(child_surface1()->blocking_surfaces(),
355 UnorderedElementsAre(child_id2)); 270 UnorderedElementsAre(child_id2));
356 // The parent and child should not report damage until they activate. 271 // The parent and child should not report damage until they activate.
357 EXPECT_FALSE(IsSurfaceDamaged(parent_id)); 272 EXPECT_FALSE(IsSurfaceDamaged(parent_id));
358 EXPECT_FALSE(IsSurfaceDamaged(child_id1)); 273 EXPECT_FALSE(IsSurfaceDamaged(child_id1));
359 274
360 // The parent should still be blocked on |child_id1| because it's pending. 275 // The parent should still be blocked on |child_id1| because it's pending.
361 EXPECT_THAT(parent_surface()->blocking_surfaces(), 276 EXPECT_THAT(parent_surface()->blocking_surfaces(),
362 UnorderedElementsAre(child_id1)); 277 UnorderedElementsAre(child_id1));
363 278
364 // Submit a CompositorFrame without any dependencies to |child_id2|. 279 // Submit a CompositorFrame without any dependencies to |child_id2|.
365 // parent_support should be activated. 280 // parent_support should be activated.
366 child_support2().SubmitCompositorFrame( 281 child_support2().SubmitCompositorFrame(
367 child_id2.local_surface_id(), MakeCompositorFrame(empty_surface_ids())); 282 child_id2.local_surface_id(),
283 MakeCompositorFrame(empty_surface_ids(), empty_surface_ids(),
284 TransferableResourceArray()));
368 285
369 EXPECT_FALSE(dependency_tracker().has_deadline()); 286 EXPECT_FALSE(dependency_tracker().has_deadline());
370 287
371 // child_surface1 should now be active. 288 // child_surface1 should now be active.
372 EXPECT_TRUE(child_surface1()->HasActiveFrame()); 289 EXPECT_TRUE(child_surface1()->HasActiveFrame());
373 EXPECT_FALSE(child_surface1()->HasPendingFrame()); 290 EXPECT_FALSE(child_surface1()->HasPendingFrame());
374 EXPECT_THAT(child_surface1()->blocking_surfaces(), IsEmpty()); 291 EXPECT_THAT(child_surface1()->blocking_surfaces(), IsEmpty());
375 292
376 // parent_surface should now be active. 293 // parent_surface should now be active.
377 EXPECT_TRUE(parent_surface()->HasActiveFrame()); 294 EXPECT_TRUE(parent_surface()->HasActiveFrame());
378 EXPECT_FALSE(parent_surface()->HasPendingFrame()); 295 EXPECT_FALSE(parent_surface()->HasPendingFrame());
379 EXPECT_THAT(parent_surface()->blocking_surfaces(), IsEmpty()); 296 EXPECT_THAT(parent_surface()->blocking_surfaces(), IsEmpty());
380 297
381 // All three surfaces |parent_id|, |child_id1|, and |child_id2| should 298 // All three surfaces |parent_id|, |child_id1|, and |child_id2| should
382 // now report damage. This would trigger a new display frame. 299 // now report damage. This would trigger a new display frame.
383 EXPECT_TRUE(IsSurfaceDamaged(parent_id)); 300 EXPECT_TRUE(IsSurfaceDamaged(parent_id));
384 EXPECT_TRUE(IsSurfaceDamaged(child_id1)); 301 EXPECT_TRUE(IsSurfaceDamaged(child_id1));
385 EXPECT_TRUE(IsSurfaceDamaged(child_id2)); 302 EXPECT_TRUE(IsSurfaceDamaged(child_id2));
386 } 303 }
387 304
388 // parent_surface and child_surface1 are blocked on |child_id2|. 305 // parent_surface and child_surface1 are blocked on |child_id2|.
389 TEST_F(CompositorFrameSinkSupportTest, 306 TEST_F(SurfaceSynchronizationTest, TwoBlockedOnOne) {
390 DisplayCompositorLockingTwoBlockedOnOne) {
391 const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); 307 const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1);
392 const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); 308 const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1);
393 const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1); 309 const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1);
394 310
395 parent_support().SubmitCompositorFrame( 311 parent_support().SubmitCompositorFrame(
396 parent_id.local_surface_id(), 312 parent_id.local_surface_id(),
397 MakeCompositorFrame({child_id2}, empty_surface_ids())); 313 MakeCompositorFrame({child_id2}, empty_surface_ids(),
314 TransferableResourceArray()));
398 315
399 // parent_support is blocked on |child_id2|. 316 // parent_support is blocked on |child_id2|.
400 EXPECT_TRUE(dependency_tracker().has_deadline()); 317 EXPECT_TRUE(dependency_tracker().has_deadline());
401 EXPECT_FALSE(parent_surface()->HasActiveFrame()); 318 EXPECT_FALSE(parent_surface()->HasActiveFrame());
402 EXPECT_TRUE(parent_surface()->HasPendingFrame()); 319 EXPECT_TRUE(parent_surface()->HasPendingFrame());
403 EXPECT_THAT(parent_surface()->blocking_surfaces(), 320 EXPECT_THAT(parent_surface()->blocking_surfaces(),
404 UnorderedElementsAre(child_id2)); 321 UnorderedElementsAre(child_id2));
405 322
406 // child_support1 should now be blocked on |child_id2|. 323 // child_support1 should now be blocked on |child_id2|.
407 child_support1().SubmitCompositorFrame( 324 child_support1().SubmitCompositorFrame(
408 child_id1.local_surface_id(), 325 child_id1.local_surface_id(),
409 MakeCompositorFrame({child_id2}, empty_surface_ids())); 326 MakeCompositorFrame({child_id2}, empty_surface_ids(),
327 TransferableResourceArray()));
410 328
411 EXPECT_TRUE(dependency_tracker().has_deadline()); 329 EXPECT_TRUE(dependency_tracker().has_deadline());
412 EXPECT_FALSE(child_surface1()->HasActiveFrame()); 330 EXPECT_FALSE(child_surface1()->HasActiveFrame());
413 EXPECT_TRUE(child_surface1()->HasPendingFrame()); 331 EXPECT_TRUE(child_surface1()->HasPendingFrame());
414 EXPECT_THAT(child_surface1()->blocking_surfaces(), 332 EXPECT_THAT(child_surface1()->blocking_surfaces(),
415 UnorderedElementsAre(child_id2)); 333 UnorderedElementsAre(child_id2));
416 334
417 // The parent should still be blocked on |child_id2|. 335 // The parent should still be blocked on |child_id2|.
418 EXPECT_THAT(parent_surface()->blocking_surfaces(), 336 EXPECT_THAT(parent_surface()->blocking_surfaces(),
419 UnorderedElementsAre(child_id2)); 337 UnorderedElementsAre(child_id2));
(...skipping 11 matching lines...) Expand all
431 EXPECT_THAT(child_surface1()->blocking_surfaces(), IsEmpty()); 349 EXPECT_THAT(child_surface1()->blocking_surfaces(), IsEmpty());
432 350
433 // parent_surface should now be active. 351 // parent_surface should now be active.
434 EXPECT_TRUE(parent_surface()->HasActiveFrame()); 352 EXPECT_TRUE(parent_surface()->HasActiveFrame());
435 EXPECT_FALSE(parent_surface()->HasPendingFrame()); 353 EXPECT_FALSE(parent_surface()->HasPendingFrame());
436 EXPECT_THAT(parent_surface()->blocking_surfaces(), IsEmpty()); 354 EXPECT_THAT(parent_surface()->blocking_surfaces(), IsEmpty());
437 } 355 }
438 356
439 // parent_surface is blocked on |child_id1|, and child_surface2 is blocked on 357 // parent_surface is blocked on |child_id1|, and child_surface2 is blocked on
440 // |child_id2| until the deadline hits. 358 // |child_id2| until the deadline hits.
441 TEST_F(CompositorFrameSinkSupportTest, DisplayCompositorLockingDeadlineHits) { 359 TEST_F(SurfaceSynchronizationTest, DeadlineHits) {
442 const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); 360 const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1);
443 const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); 361 const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1);
444 const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1); 362 const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1);
445 363
446 parent_support().SubmitCompositorFrame( 364 parent_support().SubmitCompositorFrame(
447 parent_id.local_surface_id(), 365 parent_id.local_surface_id(),
448 MakeCompositorFrame({child_id1}, empty_surface_ids())); 366 MakeCompositorFrame({child_id1}, empty_surface_ids(),
367 TransferableResourceArray()));
449 368
450 // parent_support is blocked on |child_id1|. 369 // parent_support is blocked on |child_id1|.
451 EXPECT_TRUE(dependency_tracker().has_deadline()); 370 EXPECT_TRUE(dependency_tracker().has_deadline());
452 EXPECT_FALSE(parent_surface()->HasActiveFrame()); 371 EXPECT_FALSE(parent_surface()->HasActiveFrame());
453 EXPECT_TRUE(parent_surface()->HasPendingFrame()); 372 EXPECT_TRUE(parent_surface()->HasPendingFrame());
454 EXPECT_THAT(parent_surface()->blocking_surfaces(), 373 EXPECT_THAT(parent_surface()->blocking_surfaces(),
455 UnorderedElementsAre(child_id1)); 374 UnorderedElementsAre(child_id1));
456 375
457 child_support1().SubmitCompositorFrame( 376 child_support1().SubmitCompositorFrame(
458 child_id1.local_surface_id(), 377 child_id1.local_surface_id(),
459 MakeCompositorFrame({child_id2}, empty_surface_ids())); 378 MakeCompositorFrame({child_id2}, empty_surface_ids(),
379 TransferableResourceArray()));
460 380
461 // child_support1 should now be blocked on |child_id2|. 381 // child_support1 should now be blocked on |child_id2|.
462 EXPECT_TRUE(dependency_tracker().has_deadline()); 382 EXPECT_TRUE(dependency_tracker().has_deadline());
463 EXPECT_FALSE(child_surface1()->HasActiveFrame()); 383 EXPECT_FALSE(child_surface1()->HasActiveFrame());
464 EXPECT_TRUE(child_surface1()->HasPendingFrame()); 384 EXPECT_TRUE(child_surface1()->HasPendingFrame());
465 EXPECT_THAT(child_surface1()->blocking_surfaces(), 385 EXPECT_THAT(child_surface1()->blocking_surfaces(),
466 UnorderedElementsAre(child_id2)); 386 UnorderedElementsAre(child_id2));
467 387
468 // The parent should still be blocked on |child_id1| because it's pending. 388 // The parent should still be blocked on |child_id1| because it's pending.
469 EXPECT_THAT(parent_surface()->blocking_surfaces(), 389 EXPECT_THAT(parent_surface()->blocking_surfaces(),
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 EXPECT_THAT(parent_surface()->blocking_surfaces(), IsEmpty()); 421 EXPECT_THAT(parent_surface()->blocking_surfaces(), IsEmpty());
502 422
503 // child_surface1 has been activated. 423 // child_surface1 has been activated.
504 EXPECT_TRUE(child_surface1()->HasActiveFrame()); 424 EXPECT_TRUE(child_surface1()->HasActiveFrame());
505 EXPECT_FALSE(child_surface1()->HasPendingFrame()); 425 EXPECT_FALSE(child_surface1()->HasPendingFrame());
506 EXPECT_THAT(child_surface1()->blocking_surfaces(), IsEmpty()); 426 EXPECT_THAT(child_surface1()->blocking_surfaces(), IsEmpty());
507 } 427 }
508 428
509 // Verifies that the deadline does not reset if we submit CompositorFrames 429 // Verifies that the deadline does not reset if we submit CompositorFrames
510 // to new Surfaces with unresolved dependencies. 430 // to new Surfaces with unresolved dependencies.
511 TEST_F(CompositorFrameSinkSupportTest, 431 TEST_F(SurfaceSynchronizationTest, FramesSubmittedAfterDeadlineSet) {
512 DisplayCompositorLockingFramesSubmittedAfterDeadlineSet) {
513 const SurfaceId arbitrary_id = MakeSurfaceId(kArbitraryFrameSink, 1); 432 const SurfaceId arbitrary_id = MakeSurfaceId(kArbitraryFrameSink, 1);
514 BeginFrameArgs args = 433 BeginFrameArgs args =
515 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 0, 1); 434 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 0, 1);
516 for (int i = 0; i < 3; ++i) { 435 for (int i = 0; i < 3; ++i) {
517 LocalSurfaceId local_surface_id(1, base::UnguessableToken::Create()); 436 LocalSurfaceId local_surface_id(1, base::UnguessableToken::Create());
518 support(i).SubmitCompositorFrame( 437 support(i).SubmitCompositorFrame(
519 local_surface_id, 438 local_surface_id,
520 MakeCompositorFrame({arbitrary_id}, empty_surface_ids())); 439 MakeCompositorFrame({arbitrary_id}, empty_surface_ids(),
440 TransferableResourceArray()));
521 // The deadline has been set. 441 // The deadline has been set.
522 EXPECT_TRUE(dependency_tracker().has_deadline()); 442 EXPECT_TRUE(dependency_tracker().has_deadline());
523 443
524 // support(i) should be blocked on arbitrary_id. 444 // support(i) should be blocked on arbitrary_id.
525 EXPECT_FALSE(surface(i)->HasActiveFrame()); 445 EXPECT_FALSE(surface(i)->HasActiveFrame());
526 EXPECT_TRUE(surface(i)->HasPendingFrame()); 446 EXPECT_TRUE(surface(i)->HasPendingFrame());
527 EXPECT_THAT(surface(i)->blocking_surfaces(), 447 EXPECT_THAT(surface(i)->blocking_surfaces(),
528 UnorderedElementsAre(arbitrary_id)); 448 UnorderedElementsAre(arbitrary_id));
529 449
530 // Issue a BeginFrame to get closer to the deadline. 450 // Issue a BeginFrame to get closer to the deadline.
531 begin_frame_source()->TestOnBeginFrame(args); 451 begin_frame_source()->TestOnBeginFrame(args);
532 } 452 }
533 453
534 // The deadline hits and all the Surfaces should activate. 454 // The deadline hits and all the Surfaces should activate.
535 begin_frame_source()->TestOnBeginFrame(args); 455 begin_frame_source()->TestOnBeginFrame(args);
536 for (int i = 0; i < 3; ++i) { 456 for (int i = 0; i < 3; ++i) {
537 EXPECT_TRUE(surface(i)->HasActiveFrame()); 457 EXPECT_TRUE(surface(i)->HasActiveFrame());
538 EXPECT_FALSE(surface(i)->HasPendingFrame()); 458 EXPECT_FALSE(surface(i)->HasPendingFrame());
539 EXPECT_THAT(surface(i)->blocking_surfaces(), IsEmpty()); 459 EXPECT_THAT(surface(i)->blocking_surfaces(), IsEmpty());
540 } 460 }
541 } 461 }
542 462
543 // This test verifies at the Surface activates once a CompositorFrame is 463 // This test verifies at the Surface activates once a CompositorFrame is
544 // submitted that has no unresolved dependencies. 464 // submitted that has no unresolved dependencies.
545 TEST_F(CompositorFrameSinkSupportTest, 465 TEST_F(SurfaceSynchronizationTest, NewFrameOverridesOldDependencies) {
546 DisplayCompositorLockingNewFrameOverridesOldDependencies) {
547 const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); 466 const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1);
548 const SurfaceId arbitrary_id = MakeSurfaceId(kArbitraryFrameSink, 1); 467 const SurfaceId arbitrary_id = MakeSurfaceId(kArbitraryFrameSink, 1);
549 468
550 // Submit a CompositorFrame that depends on |arbitrary_id|. 469 // Submit a CompositorFrame that depends on |arbitrary_id|.
551 parent_support().SubmitCompositorFrame( 470 parent_support().SubmitCompositorFrame(
552 parent_id.local_surface_id(), 471 parent_id.local_surface_id(),
553 MakeCompositorFrame({arbitrary_id}, empty_surface_ids())); 472 MakeCompositorFrame({arbitrary_id}, empty_surface_ids(),
473 TransferableResourceArray()));
554 474
555 // Verify that the CompositorFrame is blocked on |arbitrary_id|. 475 // Verify that the CompositorFrame is blocked on |arbitrary_id|.
556 EXPECT_FALSE(parent_surface()->HasActiveFrame()); 476 EXPECT_FALSE(parent_surface()->HasActiveFrame());
557 EXPECT_TRUE(parent_surface()->HasPendingFrame()); 477 EXPECT_TRUE(parent_surface()->HasPendingFrame());
558 EXPECT_THAT(parent_surface()->blocking_surfaces(), 478 EXPECT_THAT(parent_surface()->blocking_surfaces(),
559 UnorderedElementsAre(arbitrary_id)); 479 UnorderedElementsAre(arbitrary_id));
560 480
561 // Submit a CompositorFrame that has no dependencies. 481 // Submit a CompositorFrame that has no dependencies.
562 parent_support().SubmitCompositorFrame(parent_id.local_surface_id(), 482 parent_support().SubmitCompositorFrame(parent_id.local_surface_id(),
563 MakeCompositorFrame()); 483 MakeCompositorFrame());
564 484
565 // Verify that the CompositorFrame has been activated. 485 // Verify that the CompositorFrame has been activated.
566 EXPECT_TRUE(parent_surface()->HasActiveFrame()); 486 EXPECT_TRUE(parent_surface()->HasActiveFrame());
567 EXPECT_FALSE(parent_surface()->HasPendingFrame()); 487 EXPECT_FALSE(parent_surface()->HasPendingFrame());
568 EXPECT_THAT(parent_surface()->blocking_surfaces(), IsEmpty()); 488 EXPECT_THAT(parent_surface()->blocking_surfaces(), IsEmpty());
569 } 489 }
570 490
571 // This test verifies that a pending CompositorFrame does not affect surface 491 // This test verifies that a pending CompositorFrame does not affect surface
572 // references. A new surface from a child will continue to exist as a temporary 492 // references. A new surface from a child will continue to exist as a temporary
573 // reference until the parent's frame activates. 493 // reference until the parent's frame activates.
574 TEST_F(CompositorFrameSinkSupportTest, 494 TEST_F(SurfaceSynchronizationTest, OnlyActiveFramesAffectSurfaceReferences) {
575 OnlyActiveFramesAffectSurfaceReferences) {
576 const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); 495 const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1);
577 const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); 496 const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1);
578 const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1); 497 const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1);
579 498
580 // child_support1 submits a CompositorFrame without any dependencies. 499 // child_support1 submits a CompositorFrame without any dependencies.
581 // DidReceiveCompositorFrameAck should call on immediate activation. 500 // DidReceiveCompositorFrameAck should call on immediate activation.
582 EXPECT_CALL(support_client_, DidReceiveCompositorFrameAck(_)).Times(1); 501 EXPECT_CALL(support_client_, DidReceiveCompositorFrameAck(_)).Times(1);
583 child_support1().SubmitCompositorFrame(child_id1.local_surface_id(), 502 child_support1().SubmitCompositorFrame(child_id1.local_surface_id(),
584 MakeCompositorFrame()); 503 MakeCompositorFrame());
585 testing::Mock::VerifyAndClearExpectations(&support_client_); 504 testing::Mock::VerifyAndClearExpectations(&support_client_);
586 505
587 // Verify that the child surface is not blocked. 506 // Verify that the child surface is not blocked.
588 EXPECT_TRUE(child_surface1()->HasActiveFrame()); 507 EXPECT_TRUE(child_surface1()->HasActiveFrame());
589 EXPECT_FALSE(child_surface1()->HasPendingFrame()); 508 EXPECT_FALSE(child_surface1()->HasPendingFrame());
590 EXPECT_THAT(child_surface1()->blocking_surfaces(), IsEmpty()); 509 EXPECT_THAT(child_surface1()->blocking_surfaces(), IsEmpty());
591 510
592 // Verify that there's a temporary reference for |child_id1|. 511 // Verify that there's a temporary reference for |child_id1|.
593 EXPECT_TRUE(HasTemporaryReference(child_id1)); 512 EXPECT_TRUE(HasTemporaryReference(child_id1));
594 513
595 // parent_support submits a CompositorFrame that depends on |child_id1| 514 // parent_support submits a CompositorFrame that depends on |child_id1|
596 // (which is already active) and |child_id2|. Thus, the parent should not 515 // (which is already active) and |child_id2|. Thus, the parent should not
597 // activate immediately. DidReceiveCompositorFrameAck should not be called 516 // activate immediately. DidReceiveCompositorFrameAck should not be called
598 // immediately because the parent CompositorFrame is also blocked on 517 // immediately because the parent CompositorFrame is also blocked on
599 // |child_id2|. 518 // |child_id2|.
600 EXPECT_CALL(support_client_, DidReceiveCompositorFrameAck(_)).Times(0); 519 EXPECT_CALL(support_client_, DidReceiveCompositorFrameAck(_)).Times(0);
601 parent_support().SubmitCompositorFrame( 520 parent_support().SubmitCompositorFrame(
602 parent_id.local_surface_id(), 521 parent_id.local_surface_id(),
603 MakeCompositorFrame({child_id2}, {child_id1})); 522 MakeCompositorFrame({child_id2}, {child_id1},
523 TransferableResourceArray()));
604 EXPECT_FALSE(parent_surface()->HasActiveFrame()); 524 EXPECT_FALSE(parent_surface()->HasActiveFrame());
605 EXPECT_TRUE(parent_surface()->HasPendingFrame()); 525 EXPECT_TRUE(parent_surface()->HasPendingFrame());
606 EXPECT_THAT(parent_surface()->blocking_surfaces(), 526 EXPECT_THAT(parent_surface()->blocking_surfaces(),
607 UnorderedElementsAre(child_id2)); 527 UnorderedElementsAre(child_id2));
608 EXPECT_THAT(GetChildReferences(parent_id), IsEmpty()); 528 EXPECT_THAT(GetChildReferences(parent_id), IsEmpty());
609 testing::Mock::VerifyAndClearExpectations(&support_client_); 529 testing::Mock::VerifyAndClearExpectations(&support_client_);
610 530
611 // Verify that there's a temporary reference for |child_id1| that still 531 // Verify that there's a temporary reference for |child_id1| that still
612 // exists. 532 // exists.
613 EXPECT_TRUE(HasTemporaryReference(child_id1)); 533 EXPECT_TRUE(HasTemporaryReference(child_id1));
(...skipping 16 matching lines...) Expand all
630 EXPECT_TRUE(parent_surface()->HasActiveFrame()); 550 EXPECT_TRUE(parent_surface()->HasActiveFrame());
631 EXPECT_FALSE(parent_surface()->HasPendingFrame()); 551 EXPECT_FALSE(parent_surface()->HasPendingFrame());
632 EXPECT_THAT(parent_surface()->blocking_surfaces(), IsEmpty()); 552 EXPECT_THAT(parent_surface()->blocking_surfaces(), IsEmpty());
633 EXPECT_FALSE(HasTemporaryReference(child_id1)); 553 EXPECT_FALSE(HasTemporaryReference(child_id1));
634 EXPECT_THAT(GetChildReferences(parent_id), UnorderedElementsAre(child_id1)); 554 EXPECT_THAT(GetChildReferences(parent_id), UnorderedElementsAre(child_id1));
635 } 555 }
636 556
637 // This test verifies that we do not double count returned resources when a 557 // This test verifies that we do not double count returned resources when a
638 // CompositorFrame starts out as pending, then becomes active, and then is 558 // CompositorFrame starts out as pending, then becomes active, and then is
639 // replaced with another active CompositorFrame. 559 // replaced with another active CompositorFrame.
640 TEST_F(CompositorFrameSinkSupportTest, 560 TEST_F(SurfaceSynchronizationTest, ResourcesOnlyReturnedOnce) {
641 DisplayCompositorLockingResourcesOnlyReturnedOnce) {
642 const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); 561 const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1);
643 const SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 1); 562 const SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 1);
644 563
645 // The parent submits a CompositorFrame that depends on |child_id| before the 564 // The parent submits a CompositorFrame that depends on |child_id| before the
646 // child submits a CompositorFrame. The CompositorFrame also has resources in 565 // child submits a CompositorFrame. The CompositorFrame also has resources in
647 // its resource list. 566 // its resource list.
648 TransferableResource resource = 567 TransferableResource resource;
649 MakeResource(1337 /* id */, ALPHA_8 /* format */, 1234 /* filter */, 568 resource.id = 1337;
650 gfx::Size(1234, 5678)); 569 resource.format = ALPHA_8;
570 resource.filter = 1234;
571 resource.size = gfx::Size(1234, 5678);
651 TransferableResourceArray resource_list = {resource}; 572 TransferableResourceArray resource_list = {resource};
652 parent_support().SubmitCompositorFrame( 573 parent_support().SubmitCompositorFrame(
653 parent_id.local_surface_id(), 574 parent_id.local_surface_id(),
654 MakeCompositorFrameWithResources({child_id}, resource_list)); 575 MakeCompositorFrame({child_id}, empty_surface_ids(), resource_list));
655 576
656 // Verify that the CompositorFrame is blocked on |child_id|. 577 // Verify that the CompositorFrame is blocked on |child_id|.
657 EXPECT_FALSE(parent_surface()->HasActiveFrame()); 578 EXPECT_FALSE(parent_surface()->HasActiveFrame());
658 EXPECT_TRUE(parent_surface()->HasPendingFrame()); 579 EXPECT_TRUE(parent_surface()->HasPendingFrame());
659 EXPECT_THAT(parent_surface()->blocking_surfaces(), 580 EXPECT_THAT(parent_surface()->blocking_surfaces(),
660 UnorderedElementsAre(child_id)); 581 UnorderedElementsAre(child_id));
661 582
662 child_support1().SubmitCompositorFrame( 583 child_support1().SubmitCompositorFrame(
663 child_id.local_surface_id(), MakeCompositorFrame(empty_surface_ids())); 584 child_id.local_surface_id(),
585 MakeCompositorFrame(empty_surface_ids(), empty_surface_ids(),
586 TransferableResourceArray()));
664 587
665 // Verify that the child CompositorFrame activates immediately. 588 // Verify that the child CompositorFrame activates immediately.
666 EXPECT_TRUE(child_surface1()->HasActiveFrame()); 589 EXPECT_TRUE(child_surface1()->HasActiveFrame());
667 EXPECT_FALSE(child_surface1()->HasPendingFrame()); 590 EXPECT_FALSE(child_surface1()->HasPendingFrame());
668 EXPECT_THAT(child_surface1()->blocking_surfaces(), IsEmpty()); 591 EXPECT_THAT(child_surface1()->blocking_surfaces(), IsEmpty());
669 592
670 // Verify that the parent has activated. 593 // Verify that the parent has activated.
671 EXPECT_TRUE(parent_surface()->HasActiveFrame()); 594 EXPECT_TRUE(parent_surface()->HasActiveFrame());
672 EXPECT_FALSE(parent_surface()->HasPendingFrame()); 595 EXPECT_FALSE(parent_surface()->HasPendingFrame());
673 EXPECT_THAT(parent_surface()->blocking_surfaces(), IsEmpty()); 596 EXPECT_THAT(parent_surface()->blocking_surfaces(), IsEmpty());
674 597
598 ReturnedResourceArray returned_resources = {resource.ToReturnedResource()};
599 EXPECT_CALL(support_client_,
600 DidReceiveCompositorFrameAck(returned_resources));
601
675 // The parent submits a CompositorFrame without any dependencies. That frame 602 // The parent submits a CompositorFrame without any dependencies. That frame
676 // should activate immediately, replacing the earlier frame. The resource from 603 // should activate immediately, replacing the earlier frame. The resource from
677 // the earlier frame should be returned to the client. 604 // the earlier frame should be returned to the client.
678 parent_support().SubmitCompositorFrame( 605 parent_support().SubmitCompositorFrame(
679 parent_id.local_surface_id(), MakeCompositorFrame({empty_surface_ids()})); 606 parent_id.local_surface_id(),
607 MakeCompositorFrame({empty_surface_ids()}, {empty_surface_ids()},
608 TransferableResourceArray()));
680 EXPECT_TRUE(parent_surface()->HasActiveFrame()); 609 EXPECT_TRUE(parent_surface()->HasActiveFrame());
681 EXPECT_FALSE(parent_surface()->HasPendingFrame()); 610 EXPECT_FALSE(parent_surface()->HasPendingFrame());
682 EXPECT_THAT(parent_surface()->blocking_surfaces(), IsEmpty()); 611 EXPECT_THAT(parent_surface()->blocking_surfaces(), IsEmpty());
683 ReturnedResource returned_resource = resource.ToReturnedResource();
684 EXPECT_THAT(support_client_.last_returned_resources(),
685 UnorderedElementsAre(returned_resource));
686 } 612 }
687 613
688 // The parent Surface is blocked on |child_id2| which is blocked on |child_id3|. 614 // The parent Surface is blocked on |child_id2| which is blocked on |child_id3|.
689 // child_support1 evicts its blocked Surface. The parent surface should 615 // child_support1 evicts its blocked Surface. The parent surface should
690 // activate. 616 // activate.
691 TEST_F(CompositorFrameSinkSupportTest, EvictSurfaceWithPendingFrame) { 617 TEST_F(SurfaceSynchronizationTest, EvictSurfaceWithPendingFrame) {
692 const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1); 618 const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1);
693 const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); 619 const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1);
694 const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1); 620 const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1);
695 621
696 // Submit a CompositorFrame that depends on |child_id1|. 622 // Submit a CompositorFrame that depends on |child_id1|.
697 parent_support().SubmitCompositorFrame( 623 parent_support().SubmitCompositorFrame(
698 parent_id1.local_surface_id(), 624 parent_id1.local_surface_id(),
699 MakeCompositorFrame({child_id1}, empty_surface_ids())); 625 MakeCompositorFrame({child_id1}, empty_surface_ids(),
626 TransferableResourceArray()));
700 627
701 // Verify that the CompositorFrame is blocked on |child_id1|. 628 // Verify that the CompositorFrame is blocked on |child_id1|.
702 EXPECT_FALSE(parent_surface()->HasActiveFrame()); 629 EXPECT_FALSE(parent_surface()->HasActiveFrame());
703 EXPECT_TRUE(parent_surface()->HasPendingFrame()); 630 EXPECT_TRUE(parent_surface()->HasPendingFrame());
704 EXPECT_THAT(parent_surface()->blocking_surfaces(), 631 EXPECT_THAT(parent_surface()->blocking_surfaces(),
705 UnorderedElementsAre(child_id1)); 632 UnorderedElementsAre(child_id1));
706 633
707 // Submit a CompositorFrame that depends on |child_id2|. 634 // Submit a CompositorFrame that depends on |child_id2|.
708 child_support1().SubmitCompositorFrame( 635 child_support1().SubmitCompositorFrame(
709 child_id1.local_surface_id(), 636 child_id1.local_surface_id(),
710 MakeCompositorFrame({child_id2}, empty_surface_ids())); 637 MakeCompositorFrame({child_id2}, empty_surface_ids(),
638 TransferableResourceArray()));
711 639
712 // Verify that the CompositorFrame is blocked on |child_id2|. 640 // Verify that the CompositorFrame is blocked on |child_id2|.
713 EXPECT_FALSE(child_surface1()->HasActiveFrame()); 641 EXPECT_FALSE(child_surface1()->HasActiveFrame());
714 EXPECT_TRUE(child_surface1()->HasPendingFrame()); 642 EXPECT_TRUE(child_surface1()->HasPendingFrame());
715 EXPECT_THAT(child_surface1()->blocking_surfaces(), 643 EXPECT_THAT(child_surface1()->blocking_surfaces(),
716 UnorderedElementsAre(child_id2)); 644 UnorderedElementsAre(child_id2));
717 645
718 // Evict child_support1's current Surface. 646 // Evict child_support1's current Surface.
719 // TODO(fsamuel): EvictFrame => EvictCurrentSurface. 647 // TODO(fsamuel): EvictFrame => EvictCurrentSurface.
720 child_support1().EvictFrame(); 648 child_support1().EvictFrame();
721 649
722 // The parent Surface should immediately activate. 650 // The parent Surface should immediately activate.
723 EXPECT_TRUE(parent_surface()->HasActiveFrame()); 651 EXPECT_TRUE(parent_surface()->HasActiveFrame());
724 EXPECT_FALSE(parent_surface()->HasPendingFrame()); 652 EXPECT_FALSE(parent_surface()->HasPendingFrame());
725 EXPECT_THAT(parent_surface()->blocking_surfaces(), IsEmpty()); 653 EXPECT_THAT(parent_surface()->blocking_surfaces(), IsEmpty());
726 EXPECT_FALSE(dependency_tracker().has_deadline()); 654 EXPECT_FALSE(dependency_tracker().has_deadline());
727 } 655 }
728 656
729 // This test verifies that if a surface has both a pending and active 657 // This test verifies that if a surface has both a pending and active
730 // CompositorFrame and the pending CompositorFrame activates, replacing the 658 // CompositorFrame and the pending CompositorFrame activates, replacing the
731 // existing active CompositorFrame, then the surface reference hierarchy will be 659 // existing active CompositorFrame, then the surface reference hierarchy will be
732 // updated allowing garbage collection of surfaces that are no longer 660 // updated allowing garbage collection of surfaces that are no longer
733 // referenced. 661 // referenced.
734 TEST_F(CompositorFrameSinkSupportTest, DropStaleReferencesAfterActivation) { 662 TEST_F(SurfaceSynchronizationTest, DropStaleReferencesAfterActivation) {
735 const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); 663 const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1);
736 const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); 664 const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1);
737 const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1); 665 const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink2, 1);
738 666
739 // The parent submits a CompositorFrame that depends on |child_id1| before the 667 // The parent submits a CompositorFrame that depends on |child_id1| before the
740 // child submits a CompositorFrame. 668 // child submits a CompositorFrame.
741 EXPECT_CALL(support_client_, DidReceiveCompositorFrameAck(_)).Times(0); 669 EXPECT_CALL(support_client_, DidReceiveCompositorFrameAck(_)).Times(0);
742 parent_support().SubmitCompositorFrame( 670 parent_support().SubmitCompositorFrame(
743 parent_id.local_surface_id(), 671 parent_id.local_surface_id(),
744 MakeCompositorFrame({child_id1}, empty_surface_ids())); 672 MakeCompositorFrame({child_id1}, empty_surface_ids(),
673 TransferableResourceArray()));
745 674
746 // Verify that the CompositorFrame is blocked on |child_id|. 675 // Verify that the CompositorFrame is blocked on |child_id|.
747 EXPECT_FALSE(parent_surface()->HasActiveFrame()); 676 EXPECT_FALSE(parent_surface()->HasActiveFrame());
748 EXPECT_TRUE(parent_surface()->HasPendingFrame()); 677 EXPECT_TRUE(parent_surface()->HasPendingFrame());
749 EXPECT_THAT(parent_surface()->blocking_surfaces(), 678 EXPECT_THAT(parent_surface()->blocking_surfaces(),
750 UnorderedElementsAre(child_id1)); 679 UnorderedElementsAre(child_id1));
751 testing::Mock::VerifyAndClearExpectations(&support_client_); 680 testing::Mock::VerifyAndClearExpectations(&support_client_);
752 681
753 // Verify that no references are added while the CompositorFrame is pending. 682 // Verify that no references are added while the CompositorFrame is pending.
754 EXPECT_THAT(GetChildReferences(parent_id), IsEmpty()); 683 EXPECT_THAT(GetChildReferences(parent_id), IsEmpty());
(...skipping 11 matching lines...) Expand all
766 EXPECT_THAT(child_surface1()->blocking_surfaces(), IsEmpty()); 695 EXPECT_THAT(child_surface1()->blocking_surfaces(), IsEmpty());
767 696
768 // Verify that the parent Surface has activated. 697 // Verify that the parent Surface has activated.
769 EXPECT_TRUE(parent_surface()->HasActiveFrame()); 698 EXPECT_TRUE(parent_surface()->HasActiveFrame());
770 EXPECT_FALSE(parent_surface()->HasPendingFrame()); 699 EXPECT_FALSE(parent_surface()->HasPendingFrame());
771 EXPECT_THAT(parent_surface()->blocking_surfaces(), IsEmpty()); 700 EXPECT_THAT(parent_surface()->blocking_surfaces(), IsEmpty());
772 701
773 // Submit a new parent CompositorFrame to add a reference. 702 // Submit a new parent CompositorFrame to add a reference.
774 parent_support().SubmitCompositorFrame( 703 parent_support().SubmitCompositorFrame(
775 parent_id.local_surface_id(), 704 parent_id.local_surface_id(),
776 MakeCompositorFrame(empty_surface_ids(), {child_id1})); 705 MakeCompositorFrame(empty_surface_ids(), {child_id1},
706 TransferableResourceArray()));
777 707
778 // Verify that the parent Surface has activated. 708 // Verify that the parent Surface has activated.
779 EXPECT_TRUE(parent_surface()->HasActiveFrame()); 709 EXPECT_TRUE(parent_surface()->HasActiveFrame());
780 EXPECT_FALSE(parent_surface()->HasPendingFrame()); 710 EXPECT_FALSE(parent_surface()->HasPendingFrame());
781 EXPECT_THAT(parent_surface()->blocking_surfaces(), IsEmpty()); 711 EXPECT_THAT(parent_surface()->blocking_surfaces(), IsEmpty());
782 712
783 // Verify that there is no temporary reference for the child and that 713 // Verify that there is no temporary reference for the child and that
784 // the reference from the parent to the child still exists. 714 // the reference from the parent to the child still exists.
785 EXPECT_FALSE(HasTemporaryReference(child_id1)); 715 EXPECT_FALSE(HasTemporaryReference(child_id1));
786 EXPECT_THAT(GetChildReferences(parent_id), UnorderedElementsAre(child_id1)); 716 EXPECT_THAT(GetChildReferences(parent_id), UnorderedElementsAre(child_id1));
787 717
788 // The parent submits another CompositorFrame that depends on |child_id2|. 718 // The parent submits another CompositorFrame that depends on |child_id2|.
789 // Submitting a pending CompositorFrame will not trigger a CompositorFrameAck. 719 // Submitting a pending CompositorFrame will not trigger a CompositorFrameAck.
790 EXPECT_CALL(support_client_, DidReceiveCompositorFrameAck(_)).Times(0); 720 EXPECT_CALL(support_client_, DidReceiveCompositorFrameAck(_)).Times(0);
791 parent_support().SubmitCompositorFrame( 721 parent_support().SubmitCompositorFrame(
792 parent_id.local_surface_id(), 722 parent_id.local_surface_id(),
793 MakeCompositorFrame({child_id2}, empty_surface_ids())); 723 MakeCompositorFrame({child_id2}, empty_surface_ids(),
724 TransferableResourceArray()));
794 testing::Mock::VerifyAndClearExpectations(&support_client_); 725 testing::Mock::VerifyAndClearExpectations(&support_client_);
795 726
796 // The parent surface should now have both a pending and activate 727 // The parent surface should now have both a pending and activate
797 // CompositorFrame. Verify that the set of child references from 728 // CompositorFrame. Verify that the set of child references from
798 // |parent_id| are only from the active CompositorFrame. 729 // |parent_id| are only from the active CompositorFrame.
799 EXPECT_TRUE(parent_surface()->HasActiveFrame()); 730 EXPECT_TRUE(parent_surface()->HasActiveFrame());
800 EXPECT_TRUE(parent_surface()->HasPendingFrame()); 731 EXPECT_TRUE(parent_surface()->HasPendingFrame());
801 EXPECT_THAT(parent_surface()->blocking_surfaces(), 732 EXPECT_THAT(parent_surface()->blocking_surfaces(),
802 UnorderedElementsAre(child_id2)); 733 UnorderedElementsAre(child_id2));
803 EXPECT_THAT(GetChildReferences(parent_id), UnorderedElementsAre(child_id1)); 734 EXPECT_THAT(GetChildReferences(parent_id), UnorderedElementsAre(child_id1));
804 735
805 child_support2().SubmitCompositorFrame(child_id2.local_surface_id(), 736 child_support2().SubmitCompositorFrame(child_id2.local_surface_id(),
806 MakeCompositorFrame()); 737 MakeCompositorFrame());
807 738
808 // Verify that the parent Surface has activated and no longer has a pending 739 // Verify that the parent Surface has activated and no longer has a pending
809 // CompositorFrame. Also verify that |child_id1| is no longer a child 740 // CompositorFrame. Also verify that |child_id1| is no longer a child
810 // reference of |parent_id|. 741 // reference of |parent_id|.
811 EXPECT_TRUE(parent_surface()->HasActiveFrame()); 742 EXPECT_TRUE(parent_surface()->HasActiveFrame());
812 EXPECT_FALSE(parent_surface()->HasPendingFrame()); 743 EXPECT_FALSE(parent_surface()->HasPendingFrame());
813 EXPECT_THAT(parent_surface()->blocking_surfaces(), IsEmpty()); 744 EXPECT_THAT(parent_surface()->blocking_surfaces(), IsEmpty());
814 // The parent will not immediately refer to the child until it submits a new 745 // The parent will not immediately refer to the child until it submits a new
815 // CompositorFrame with the reference. 746 // CompositorFrame with the reference.
816 EXPECT_THAT(GetChildReferences(parent_id), IsEmpty()); 747 EXPECT_THAT(GetChildReferences(parent_id), IsEmpty());
817 } 748 }
818 749
819 // Checks whether the latency info are moved to the new surface from the old 750 // Checks whether the latency info are moved to the new surface from the old
820 // one when LocalSurfaceId changes. No frame has unresolved dependencies. 751 // one when LocalSurfaceId changes. No frame has unresolved dependencies.
821 TEST_F(CompositorFrameSinkSupportTest, 752 TEST_F(SurfaceSynchronizationTest,
822 LatencyInfoCarriedOverOnResize_NoUnresolvedDependencies) { 753 LatencyInfoCarriedOverOnResize_NoUnresolvedDependencies) {
823 const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1); 754 const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1);
824 const SurfaceId parent_id2 = MakeSurfaceId(kParentFrameSink, 2); 755 const SurfaceId parent_id2 = MakeSurfaceId(kParentFrameSink, 2);
825 const ui::LatencyComponentType latency_type1 = 756 const ui::LatencyComponentType latency_type1 =
826 ui::BROWSER_SNAPSHOT_FRAME_NUMBER_COMPONENT; 757 ui::BROWSER_SNAPSHOT_FRAME_NUMBER_COMPONENT;
827 const int64_t latency_id1 = 234; 758 const int64_t latency_id1 = 234;
828 const int64_t latency_sequence_number1 = 5645432; 759 const int64_t latency_sequence_number1 = 5645432;
829 const ui::LatencyComponentType latency_type2 = ui::TAB_SHOW_COMPONENT; 760 const ui::LatencyComponentType latency_type2 = ui::TAB_SHOW_COMPONENT;
830 const int64_t latency_id2 = 31434351; 761 const int64_t latency_id2 = 31434351;
831 const int64_t latency_sequence_number2 = 663788; 762 const int64_t latency_sequence_number2 = 663788;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 aggregated_latency_info.FindLatency(latency_type1, latency_id1, &comp1)); 812 aggregated_latency_info.FindLatency(latency_type1, latency_id1, &comp1));
882 EXPECT_EQ(latency_sequence_number1, comp1.sequence_number); 813 EXPECT_EQ(latency_sequence_number1, comp1.sequence_number);
883 EXPECT_TRUE( 814 EXPECT_TRUE(
884 aggregated_latency_info.FindLatency(latency_type2, latency_id2, nullptr)); 815 aggregated_latency_info.FindLatency(latency_type2, latency_id2, nullptr));
885 EXPECT_TRUE(aggregated_latency_info.FindLatency( 816 EXPECT_TRUE(aggregated_latency_info.FindLatency(
886 ui::DISPLAY_COMPOSITOR_RECEIVED_FRAME_COMPONENT, nullptr)); 817 ui::DISPLAY_COMPOSITOR_RECEIVED_FRAME_COMPONENT, nullptr));
887 } 818 }
888 819
889 // Checks whether the latency info are moved to the new surface from the old 820 // Checks whether the latency info are moved to the new surface from the old
890 // one when LocalSurfaceId changes. Old surface has unresolved dependencies. 821 // one when LocalSurfaceId changes. Old surface has unresolved dependencies.
891 TEST_F(CompositorFrameSinkSupportTest, 822 TEST_F(SurfaceSynchronizationTest,
892 LatencyInfoCarriedOverOnResize_OldSurfaceHasPendingAndActiveFrame) { 823 LatencyInfoCarriedOverOnResize_OldSurfaceHasPendingAndActiveFrame) {
893 const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1); 824 const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1);
894 const SurfaceId parent_id2 = MakeSurfaceId(kParentFrameSink, 2); 825 const SurfaceId parent_id2 = MakeSurfaceId(kParentFrameSink, 2);
895 const SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 1); 826 const SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 1);
896 827
897 const ui::LatencyComponentType latency_type1 = 828 const ui::LatencyComponentType latency_type1 =
898 ui::BROWSER_SNAPSHOT_FRAME_NUMBER_COMPONENT; 829 ui::BROWSER_SNAPSHOT_FRAME_NUMBER_COMPONENT;
899 const int64_t latency_id1 = 234; 830 const int64_t latency_id1 = 234;
900 const int64_t latency_sequence_number1 = 5645432; 831 const int64_t latency_sequence_number1 = 5645432;
901 const ui::LatencyComponentType latency_type2 = ui::TAB_SHOW_COMPONENT; 832 const ui::LatencyComponentType latency_type2 = ui::TAB_SHOW_COMPONENT;
902 const int64_t latency_id2 = 31434351; 833 const int64_t latency_id2 = 31434351;
903 const int64_t latency_sequence_number2 = 663788; 834 const int64_t latency_sequence_number2 = 663788;
904 835
905 // Submit a frame with no unresolved dependecy. 836 // Submit a frame with no unresolved dependecy.
906 ui::LatencyInfo info; 837 ui::LatencyInfo info;
907 info.AddLatencyNumber(latency_type1, latency_id1, latency_sequence_number1); 838 info.AddLatencyNumber(latency_type1, latency_id1, latency_sequence_number1);
908 839
909 CompositorFrame frame = MakeCompositorFrame(); 840 CompositorFrame frame = MakeCompositorFrame();
910 frame.metadata.latency_info.push_back(info); 841 frame.metadata.latency_info.push_back(info);
911 842
912 parent_support().SubmitCompositorFrame(parent_id1.local_surface_id(), 843 parent_support().SubmitCompositorFrame(parent_id1.local_surface_id(),
913 std::move(frame)); 844 std::move(frame));
914 845
915 // Submit a frame with unresolved dependencies. 846 // Submit a frame with unresolved dependencies.
916 ui::LatencyInfo info2; 847 ui::LatencyInfo info2;
917 info2.AddLatencyNumber(latency_type2, latency_id2, latency_sequence_number2); 848 info2.AddLatencyNumber(latency_type2, latency_id2, latency_sequence_number2);
918 849
919 CompositorFrame frame2 = MakeCompositorFrame({child_id}, empty_surface_ids()); 850 CompositorFrame frame2 = MakeCompositorFrame({child_id}, empty_surface_ids(),
851 TransferableResourceArray());
920 frame2.metadata.latency_info.push_back(info2); 852 frame2.metadata.latency_info.push_back(info2);
921 853
922 parent_support().SubmitCompositorFrame(parent_id1.local_surface_id(), 854 parent_support().SubmitCompositorFrame(parent_id1.local_surface_id(),
923 std::move(frame2)); 855 std::move(frame2));
924 856
925 // Verify that the old surface has both an active and a pending frame. 857 // Verify that the old surface has both an active and a pending frame.
926 Surface* old_surface = surface_manager().GetSurfaceForId(parent_id1); 858 Surface* old_surface = surface_manager().GetSurfaceForId(parent_id1);
927 ASSERT_NE(nullptr, old_surface); 859 ASSERT_NE(nullptr, old_surface);
928 EXPECT_TRUE(old_surface->HasActiveFrame()); 860 EXPECT_TRUE(old_surface->HasActiveFrame());
929 EXPECT_TRUE(old_surface->HasPendingFrame()); 861 EXPECT_TRUE(old_surface->HasPendingFrame());
(...skipping 27 matching lines...) Expand all
957 aggregated_latency_info.FindLatency(latency_type1, latency_id1, &comp1)); 889 aggregated_latency_info.FindLatency(latency_type1, latency_id1, &comp1));
958 EXPECT_EQ(latency_sequence_number1, comp1.sequence_number); 890 EXPECT_EQ(latency_sequence_number1, comp1.sequence_number);
959 EXPECT_TRUE( 891 EXPECT_TRUE(
960 aggregated_latency_info.FindLatency(latency_type2, latency_id2, nullptr)); 892 aggregated_latency_info.FindLatency(latency_type2, latency_id2, nullptr));
961 EXPECT_TRUE(aggregated_latency_info.FindLatency( 893 EXPECT_TRUE(aggregated_latency_info.FindLatency(
962 ui::DISPLAY_COMPOSITOR_RECEIVED_FRAME_COMPONENT, nullptr)); 894 ui::DISPLAY_COMPOSITOR_RECEIVED_FRAME_COMPONENT, nullptr));
963 } 895 }
964 896
965 // Checks whether the latency info are moved to the new surface from the old 897 // Checks whether the latency info are moved to the new surface from the old
966 // one when LocalSurfaceId changes. The new surface has unresolved dependencies. 898 // one when LocalSurfaceId changes. The new surface has unresolved dependencies.
967 TEST_F(CompositorFrameSinkSupportTest, 899 TEST_F(SurfaceSynchronizationTest,
968 LatencyInfoCarriedOverOnResize_NewSurfaceHasPendingFrame) { 900 LatencyInfoCarriedOverOnResize_NewSurfaceHasPendingFrame) {
969 const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1); 901 const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1);
970 const SurfaceId parent_id2 = MakeSurfaceId(kParentFrameSink, 2); 902 const SurfaceId parent_id2 = MakeSurfaceId(kParentFrameSink, 2);
971 const SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 1); 903 const SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 1);
972 904
973 const ui::LatencyComponentType latency_type1 = 905 const ui::LatencyComponentType latency_type1 =
974 ui::BROWSER_SNAPSHOT_FRAME_NUMBER_COMPONENT; 906 ui::BROWSER_SNAPSHOT_FRAME_NUMBER_COMPONENT;
975 const int64_t latency_id1 = 234; 907 const int64_t latency_id1 = 234;
976 const int64_t latency_sequence_number1 = 5645432; 908 const int64_t latency_sequence_number1 = 5645432;
977 const ui::LatencyComponentType latency_type2 = ui::TAB_SHOW_COMPONENT; 909 const ui::LatencyComponentType latency_type2 = ui::TAB_SHOW_COMPONENT;
(...skipping 14 matching lines...) Expand all
992 Surface* old_surface = surface_manager().GetSurfaceForId(parent_id1); 924 Surface* old_surface = surface_manager().GetSurfaceForId(parent_id1);
993 ASSERT_NE(nullptr, old_surface); 925 ASSERT_NE(nullptr, old_surface);
994 EXPECT_TRUE(old_surface->HasActiveFrame()); 926 EXPECT_TRUE(old_surface->HasActiveFrame());
995 EXPECT_FALSE(old_surface->HasPendingFrame()); 927 EXPECT_FALSE(old_surface->HasPendingFrame());
996 928
997 // Submit a frame with a new local surface id and with unresolved 929 // Submit a frame with a new local surface id and with unresolved
998 // dependencies. 930 // dependencies.
999 ui::LatencyInfo info2; 931 ui::LatencyInfo info2;
1000 info2.AddLatencyNumber(latency_type2, latency_id2, latency_sequence_number2); 932 info2.AddLatencyNumber(latency_type2, latency_id2, latency_sequence_number2);
1001 933
1002 CompositorFrame frame2 = MakeCompositorFrame({child_id}, empty_surface_ids()); 934 CompositorFrame frame2 = MakeCompositorFrame({child_id}, empty_surface_ids(),
935 TransferableResourceArray());
1003 frame2.metadata.latency_info.push_back(info2); 936 frame2.metadata.latency_info.push_back(info2);
1004 937
1005 parent_support().SubmitCompositorFrame(parent_id2.local_surface_id(), 938 parent_support().SubmitCompositorFrame(parent_id2.local_surface_id(),
1006 std::move(frame2)); 939 std::move(frame2));
1007 940
1008 // Verify that the new surface has a pending frame and no active frame. 941 // Verify that the new surface has a pending frame and no active frame.
1009 Surface* surface = surface_manager().GetSurfaceForId(parent_id2); 942 Surface* surface = surface_manager().GetSurfaceForId(parent_id2);
1010 ASSERT_NE(nullptr, surface); 943 ASSERT_NE(nullptr, surface);
1011 EXPECT_TRUE(surface->HasPendingFrame()); 944 EXPECT_TRUE(surface->HasPendingFrame());
1012 EXPECT_FALSE(surface->HasActiveFrame()); 945 EXPECT_FALSE(surface->HasActiveFrame());
(...skipping 21 matching lines...) Expand all
1034 ui::LatencyInfo::LatencyComponent comp1; 967 ui::LatencyInfo::LatencyComponent comp1;
1035 EXPECT_TRUE( 968 EXPECT_TRUE(
1036 aggregated_latency_info.FindLatency(latency_type1, latency_id1, &comp1)); 969 aggregated_latency_info.FindLatency(latency_type1, latency_id1, &comp1));
1037 EXPECT_EQ(latency_sequence_number1, comp1.sequence_number); 970 EXPECT_EQ(latency_sequence_number1, comp1.sequence_number);
1038 EXPECT_TRUE( 971 EXPECT_TRUE(
1039 aggregated_latency_info.FindLatency(latency_type2, latency_id2, nullptr)); 972 aggregated_latency_info.FindLatency(latency_type2, latency_id2, nullptr));
1040 EXPECT_TRUE(aggregated_latency_info.FindLatency( 973 EXPECT_TRUE(aggregated_latency_info.FindLatency(
1041 ui::DISPLAY_COMPOSITOR_RECEIVED_FRAME_COMPONENT, nullptr)); 974 ui::DISPLAY_COMPOSITOR_RECEIVED_FRAME_COMPONENT, nullptr));
1042 } 975 }
1043 976
1044 TEST_F(CompositorFrameSinkSupportTest, PassesOnBeginFrameAcks) { 977 TEST_F(SurfaceSynchronizationTest, PassesOnBeginFrameAcks) {
1045 const SurfaceId display_id = MakeSurfaceId(kDisplayFrameSink, 1); 978 const SurfaceId display_id = MakeSurfaceId(kDisplayFrameSink, 1);
1046 979
1047 // Request BeginFrames. 980 // Request BeginFrames.
1048 display_support().SetNeedsBeginFrame(true); 981 display_support().SetNeedsBeginFrame(true);
1049 982
1050 // Issue a BeginFrame. 983 // Issue a BeginFrame.
1051 BeginFrameArgs args = 984 BeginFrameArgs args =
1052 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 0, 1); 985 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 0, 1);
1053 begin_frame_source()->TestOnBeginFrame(args); 986 begin_frame_source()->TestOnBeginFrame(args);
1054 987
(...skipping 11 matching lines...) Expand all
1066 // to a CompositorFrame to the BeginFrameSource. 999 // to a CompositorFrame to the BeginFrameSource.
1067 BeginFrameAck ack2(0, 2, 2, true); 1000 BeginFrameAck ack2(0, 2, 2, true);
1068 CompositorFrame frame = MakeCompositorFrame(); 1001 CompositorFrame frame = MakeCompositorFrame();
1069 frame.metadata.begin_frame_ack = ack2; 1002 frame.metadata.begin_frame_ack = ack2;
1070 display_support().SubmitCompositorFrame(display_id.local_surface_id(), 1003 display_support().SubmitCompositorFrame(display_id.local_surface_id(),
1071 std::move(frame)); 1004 std::move(frame));
1072 EXPECT_EQ(ack2, begin_frame_source()->LastAckForObserver(&display_support())); 1005 EXPECT_EQ(ack2, begin_frame_source()->LastAckForObserver(&display_support()));
1073 } 1006 }
1074 1007
1075 // Checks that resources and ack are sent together if possible. 1008 // Checks that resources and ack are sent together if possible.
1076 TEST_F(CompositorFrameSinkSupportTest, ReturnResourcesWithAck) { 1009 TEST_F(SurfaceSynchronizationTest, ReturnResourcesWithAck) {
1077 const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); 1010 const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1);
1078 TransferableResource resource; 1011 TransferableResource resource;
1079 resource.id = 1234; 1012 resource.id = 1234;
1080 parent_support().SubmitCompositorFrame( 1013 parent_support().SubmitCompositorFrame(
1081 parent_id.local_surface_id(), 1014 parent_id.local_surface_id(),
1082 MakeCompositorFrameWithResources(empty_surface_ids(), {resource})); 1015 MakeCompositorFrame(empty_surface_ids(), empty_surface_ids(),
1016 {resource}));
1083 ReturnedResourceArray returned_resources; 1017 ReturnedResourceArray returned_resources;
1084 TransferableResource::ReturnResources({resource}, &returned_resources); 1018 TransferableResource::ReturnResources({resource}, &returned_resources);
1085 EXPECT_CALL(support_client_, ReclaimResources(_)).Times(0); 1019 EXPECT_CALL(support_client_, ReclaimResources(_)).Times(0);
1086 EXPECT_CALL(support_client_, 1020 EXPECT_CALL(support_client_,
1087 DidReceiveCompositorFrameAck(Eq(returned_resources))); 1021 DidReceiveCompositorFrameAck(Eq(returned_resources)));
1088 parent_support().SubmitCompositorFrame(parent_id.local_surface_id(), 1022 parent_support().SubmitCompositorFrame(parent_id.local_surface_id(),
1089 MakeCompositorFrame()); 1023 MakeCompositorFrame());
1090 } 1024 }
1091 1025
1092 // Verifies that if a surface is marked destroyed and a new frame arrives for 1026 // Verifies that if a surface is marked destroyed and a new frame arrives for
1093 // it, it will be recovered. 1027 // it, it will be recovered.
1094 TEST_F(CompositorFrameSinkSupportTest, SurfaceResurrection) { 1028 TEST_F(SurfaceSynchronizationTest, SurfaceResurrection) {
1095 const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); 1029 const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1);
1096 const SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 3); 1030 const SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 3);
1097 1031
1098 // Create the child surface by submitting a frame to it. 1032 // Create the child surface by submitting a frame to it.
1099 EXPECT_EQ(nullptr, surface_manager().GetSurfaceForId(child_id)); 1033 EXPECT_EQ(nullptr, surface_manager().GetSurfaceForId(child_id));
1100 child_support1().SubmitCompositorFrame(child_id.local_surface_id(), 1034 child_support1().SubmitCompositorFrame(child_id.local_surface_id(),
1101 MakeCompositorFrame()); 1035 MakeCompositorFrame());
1102 1036
1103 // Verify that the child surface is created. 1037 // Verify that the child surface is created.
1104 Surface* surface = surface_manager().GetSurfaceForId(child_id); 1038 Surface* surface = surface_manager().GetSurfaceForId(child_id);
1105 EXPECT_NE(nullptr, surface); 1039 EXPECT_NE(nullptr, surface);
1106 1040
1107 // Add a reference from the parent to the child. 1041 // Add a reference from the parent to the child.
1108 parent_support().SubmitCompositorFrame(parent_id.local_surface_id(), 1042 parent_support().SubmitCompositorFrame(
1109 MakeCompositorFrame({child_id})); 1043 parent_id.local_surface_id(),
1044 MakeCompositorFrame({child_id}, {child_id}, TransferableResourceArray()));
1110 1045
1111 // Attempt to destroy the child surface. The surface must still exist since 1046 // Attempt to destroy the child surface. The surface must still exist since
1112 // the parent needs it but it will be marked as destroyed. 1047 // the parent needs it but it will be marked as destroyed.
1113 child_support1().EvictFrame(); 1048 child_support1().EvictFrame();
1114 surface = surface_manager().GetSurfaceForId(child_id); 1049 surface = surface_manager().GetSurfaceForId(child_id);
1115 EXPECT_NE(nullptr, surface); 1050 EXPECT_NE(nullptr, surface);
1116 EXPECT_TRUE(surface->destroyed()); 1051 EXPECT_TRUE(surface->destroyed());
1117 1052
1118 // Child submits another frame to the same local surface id that is marked 1053 // Child submits another frame to the same local surface id that is marked
1119 // destroyed. 1054 // destroyed.
1120 child_support1().SubmitCompositorFrame(child_id.local_surface_id(), 1055 child_support1().SubmitCompositorFrame(child_id.local_surface_id(),
1121 MakeCompositorFrame()); 1056 MakeCompositorFrame());
1122 1057
1123 // Verify that the surface that was marked destroyed is recovered and is being 1058 // Verify that the surface that was marked destroyed is recovered and is being
1124 // used again. 1059 // used again.
1125 Surface* surface2 = surface_manager().GetSurfaceForId(child_id); 1060 Surface* surface2 = surface_manager().GetSurfaceForId(child_id);
1126 EXPECT_EQ(surface, surface2); 1061 EXPECT_EQ(surface, surface2);
1127 EXPECT_FALSE(surface2->destroyed()); 1062 EXPECT_FALSE(surface2->destroyed());
1128 } 1063 }
1129 1064
1130 // Verifies that if a LocalSurfaceId belonged to a surface that doesn't exist 1065 // Verifies that if a LocalSurfaceId belonged to a surface that doesn't exist
1131 // anymore, it can still be reused for new surfaces. 1066 // anymore, it can still be reused for new surfaces.
1132 TEST_F(CompositorFrameSinkSupportTest, LocalSurfaceIdIsReusable) { 1067 TEST_F(SurfaceSynchronizationTest, LocalSurfaceIdIsReusable) {
1133 const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); 1068 const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1);
1134 const SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 3); 1069 const SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 3);
1135 1070
1136 // Submit the first frame. Creates the surface. 1071 // Submit the first frame. Creates the surface.
1137 child_support1().SubmitCompositorFrame(child_id.local_surface_id(), 1072 child_support1().SubmitCompositorFrame(child_id.local_surface_id(),
1138 MakeCompositorFrame()); 1073 MakeCompositorFrame());
1139 EXPECT_NE(nullptr, surface_manager().GetSurfaceForId(child_id)); 1074 EXPECT_NE(nullptr, surface_manager().GetSurfaceForId(child_id));
1140 1075
1141 // Add a reference from parent. 1076 // Add a reference from parent.
1142 parent_support().SubmitCompositorFrame(parent_id.local_surface_id(), 1077 parent_support().SubmitCompositorFrame(
1143 MakeCompositorFrame({child_id})); 1078 parent_id.local_surface_id(),
1079 MakeCompositorFrame({child_id}, {child_id}, TransferableResourceArray()));
1144 1080
1145 // Remove the reference from parant. This allows us to destroy the surface. 1081 // Remove the reference from parant. This allows us to destroy the surface.
1146 parent_support().SubmitCompositorFrame(parent_id.local_surface_id(), 1082 parent_support().SubmitCompositorFrame(parent_id.local_surface_id(),
1147 MakeCompositorFrame()); 1083 MakeCompositorFrame());
1148 1084
1149 // Destroy the surface. 1085 // Destroy the surface.
1150 child_support1().EvictFrame(); 1086 child_support1().EvictFrame();
1151 EXPECT_EQ(nullptr, surface_manager().GetSurfaceForId(child_id)); 1087 EXPECT_EQ(nullptr, surface_manager().GetSurfaceForId(child_id));
1152 1088
1153 // Submit another frame with the same local surface id. This should work fine 1089 // Submit another frame with the same local surface id. This should work fine
1154 // and a new surface must be created. 1090 // and a new surface must be created.
1155 child_support1().SubmitCompositorFrame(child_id.local_surface_id(), 1091 child_support1().SubmitCompositorFrame(child_id.local_surface_id(),
1156 MakeCompositorFrame()); 1092 MakeCompositorFrame());
1157 EXPECT_NE(nullptr, surface_manager().GetSurfaceForId(child_id)); 1093 EXPECT_NE(nullptr, surface_manager().GetSurfaceForId(child_id));
1158 } 1094 }
1159 1095
1160 // This test verifies that a crash does not occur if garbage collection is 1096 // This test verifies that a crash does not occur if garbage collection is
1161 // triggered during surface dependency resolution. This test triggers garbage 1097 // triggered during surface dependency resolution. This test triggers garbage
1162 // collection during surface resolution, by causing an activation to remove 1098 // collection during surface resolution, by causing an activation to remove
1163 // a surface subtree from the root. Both the old subtree and the new 1099 // a surface subtree from the root. Both the old subtree and the new
1164 // activated subtree refer to the same dependency. The old subtree was activated 1100 // activated subtree refer to the same dependency. The old subtree was activated
1165 // by deadline, and the new subtree was activated by a dependency finally 1101 // by deadline, and the new subtree was activated by a dependency finally
1166 // resolving. 1102 // resolving.
1167 TEST_F(CompositorFrameSinkSupportTest, DependencyTrackingGarbageCollection) { 1103 TEST_F(SurfaceSynchronizationTest, DependencyTrackingGarbageCollection) {
1168 const SurfaceId display_id = MakeSurfaceId(kDisplayFrameSink, 1); 1104 const SurfaceId display_id = MakeSurfaceId(kDisplayFrameSink, 1);
1169 const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1); 1105 const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1);
1170 const SurfaceId parent_id2 = MakeSurfaceId(kParentFrameSink, 2); 1106 const SurfaceId parent_id2 = MakeSurfaceId(kParentFrameSink, 2);
1171 const SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 1); 1107 const SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 1);
1172 1108
1173 parent_support().SubmitCompositorFrame( 1109 parent_support().SubmitCompositorFrame(
1174 parent_id1.local_surface_id(), 1110 parent_id1.local_surface_id(),
1175 MakeCompositorFrame({child_id}, empty_surface_ids())); 1111 MakeCompositorFrame({child_id}, empty_surface_ids(),
1112 TransferableResourceArray()));
1176 display_support().SubmitCompositorFrame( 1113 display_support().SubmitCompositorFrame(
1177 display_id.local_surface_id(), 1114 display_id.local_surface_id(),
1178 MakeCompositorFrame({parent_id1}, empty_surface_ids())); 1115 MakeCompositorFrame({parent_id1}, empty_surface_ids(),
1116 TransferableResourceArray()));
1179 1117
1180 EXPECT_TRUE(dependency_tracker().has_deadline()); 1118 EXPECT_TRUE(dependency_tracker().has_deadline());
1181 1119
1182 BeginFrameArgs args = 1120 BeginFrameArgs args =
1183 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 0, 1); 1121 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 0, 1);
1184 1122
1185 // Advance BeginFrames to trigger a deadline. 1123 // Advance BeginFrames to trigger a deadline.
1186 for (int i = 0; i < 3; ++i) { 1124 for (int i = 0; i < 3; ++i) {
1187 begin_frame_source()->TestOnBeginFrame(args); 1125 begin_frame_source()->TestOnBeginFrame(args);
1188 EXPECT_TRUE(dependency_tracker().has_deadline()); 1126 EXPECT_TRUE(dependency_tracker().has_deadline());
1189 } 1127 }
1190 begin_frame_source()->TestOnBeginFrame(args); 1128 begin_frame_source()->TestOnBeginFrame(args);
1191 EXPECT_FALSE(dependency_tracker().has_deadline()); 1129 EXPECT_FALSE(dependency_tracker().has_deadline());
1192 1130
1193 EXPECT_TRUE(display_surface()->HasActiveFrame()); 1131 EXPECT_TRUE(display_surface()->HasActiveFrame());
1194 EXPECT_FALSE(display_surface()->HasPendingFrame()); 1132 EXPECT_FALSE(display_surface()->HasPendingFrame());
1195 EXPECT_TRUE(parent_surface()->HasActiveFrame()); 1133 EXPECT_TRUE(parent_surface()->HasActiveFrame());
1196 EXPECT_FALSE(parent_surface()->HasPendingFrame()); 1134 EXPECT_FALSE(parent_surface()->HasPendingFrame());
1197 1135
1198 parent_support().SubmitCompositorFrame( 1136 parent_support().SubmitCompositorFrame(
1199 parent_id2.local_surface_id(), 1137 parent_id2.local_surface_id(),
1200 MakeCompositorFrame({child_id}, empty_surface_ids())); 1138 MakeCompositorFrame({child_id}, empty_surface_ids(),
1139 TransferableResourceArray()));
1201 display_support().SubmitCompositorFrame( 1140 display_support().SubmitCompositorFrame(
1202 display_id.local_surface_id(), 1141 display_id.local_surface_id(),
1203 MakeCompositorFrame({parent_id2}, empty_surface_ids())); 1142 MakeCompositorFrame({parent_id2}, empty_surface_ids(),
1143 TransferableResourceArray()));
1204 1144
1205 // The display surface now has two CompositorFrames. One that is pending, 1145 // The display surface now has two CompositorFrames. One that is pending,
1206 // indirectly blocked on child_id and one that is active, also indirectly 1146 // indirectly blocked on child_id and one that is active, also indirectly
1207 // referring to child_id, but activated due to the deadline above. 1147 // referring to child_id, but activated due to the deadline above.
1208 EXPECT_TRUE(display_surface()->HasActiveFrame()); 1148 EXPECT_TRUE(display_surface()->HasActiveFrame());
1209 EXPECT_TRUE(display_surface()->HasPendingFrame()); 1149 EXPECT_TRUE(display_surface()->HasPendingFrame());
1210 1150
1211 // Submitting a CompositorFrame will trigger garbage collection of the 1151 // Submitting a CompositorFrame will trigger garbage collection of the
1212 // |parent_id1| subtree. This should not crash. 1152 // |parent_id1| subtree. This should not crash.
1213 child_support1().SubmitCompositorFrame(child_id.local_surface_id(), 1153 child_support1().SubmitCompositorFrame(child_id.local_surface_id(),
1214 MakeCompositorFrame()); 1154 MakeCompositorFrame());
1215 } 1155 }
1216 1156
1217 // This test verifies that a crash does not occur if garbage collection is 1157 // This test verifies that a crash does not occur if garbage collection is
1218 // triggered when a deadline forces frame activation. This test triggers garbage 1158 // triggered when a deadline forces frame activation. This test triggers garbage
1219 // collection during deadline activation by causing the activation of a display 1159 // collection during deadline activation by causing the activation of a display
1220 // frame to replace a previously activated display frame that was referring to 1160 // frame to replace a previously activated display frame that was referring to
1221 // a now-unreachable surface subtree. That subtree gets garbage collected during 1161 // a now-unreachable surface subtree. That subtree gets garbage collected during
1222 // deadline activation. SurfaceDependencyTracker is also tracking a surface 1162 // deadline activation. SurfaceDependencyTracker is also tracking a surface
1223 // from that subtree due to an unresolved dependency. This test verifies that 1163 // from that subtree due to an unresolved dependency. This test verifies that
1224 // this dependency resolution does not crash. 1164 // this dependency resolution does not crash.
1225 TEST_F(CompositorFrameSinkSupportTest, GarbageCollectionOnDeadline) { 1165 TEST_F(SurfaceSynchronizationTest, GarbageCollectionOnDeadline) {
1226 const SurfaceId display_id = MakeSurfaceId(kDisplayFrameSink, 1); 1166 const SurfaceId display_id = MakeSurfaceId(kDisplayFrameSink, 1);
1227 const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1); 1167 const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1);
1228 const SurfaceId parent_id2 = MakeSurfaceId(kParentFrameSink, 2); 1168 const SurfaceId parent_id2 = MakeSurfaceId(kParentFrameSink, 2);
1229 const SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 1); 1169 const SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 1);
1230 1170
1231 // |parent_id1| is blocked on |child_id|. 1171 // |parent_id1| is blocked on |child_id|.
1232 parent_support().SubmitCompositorFrame( 1172 parent_support().SubmitCompositorFrame(
1233 parent_id1.local_surface_id(), 1173 parent_id1.local_surface_id(),
1234 MakeCompositorFrame({child_id}, empty_surface_ids())); 1174 MakeCompositorFrame({child_id}, empty_surface_ids(),
1175 TransferableResourceArray()));
1235 1176
1236 display_support().SubmitCompositorFrame(display_id.local_surface_id(), 1177 display_support().SubmitCompositorFrame(
1237 MakeCompositorFrame({parent_id1})); 1178 display_id.local_surface_id(),
1179 MakeCompositorFrame({parent_id1}, {parent_id1},
1180 TransferableResourceArray()));
1238 1181
1239 EXPECT_TRUE(dependency_tracker().has_deadline()); 1182 EXPECT_TRUE(dependency_tracker().has_deadline());
1240 EXPECT_TRUE(display_surface()->HasPendingFrame()); 1183 EXPECT_TRUE(display_surface()->HasPendingFrame());
1241 EXPECT_FALSE(display_surface()->HasActiveFrame()); 1184 EXPECT_FALSE(display_surface()->HasActiveFrame());
1242 1185
1243 // Advance BeginFrames to trigger a deadline. This activates the 1186 // Advance BeginFrames to trigger a deadline. This activates the
1244 // CompositorFrame submitted above. 1187 // CompositorFrame submitted above.
1245 BeginFrameArgs args = 1188 BeginFrameArgs args =
1246 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 0, 1); 1189 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 0, 1);
1247 for (int i = 0; i < 3; ++i) { 1190 for (int i = 0; i < 3; ++i) {
1248 begin_frame_source()->TestOnBeginFrame(args); 1191 begin_frame_source()->TestOnBeginFrame(args);
1249 EXPECT_TRUE(dependency_tracker().has_deadline()); 1192 EXPECT_TRUE(dependency_tracker().has_deadline());
1250 } 1193 }
1251 begin_frame_source()->TestOnBeginFrame(args); 1194 begin_frame_source()->TestOnBeginFrame(args);
1252 EXPECT_FALSE(dependency_tracker().has_deadline()); 1195 EXPECT_FALSE(dependency_tracker().has_deadline());
1253 EXPECT_FALSE(display_surface()->HasPendingFrame()); 1196 EXPECT_FALSE(display_surface()->HasPendingFrame());
1254 EXPECT_TRUE(display_surface()->HasActiveFrame()); 1197 EXPECT_TRUE(display_surface()->HasActiveFrame());
1255 1198
1256 // By submitting a display CompositorFrame, and replacing the parent's 1199 // By submitting a display CompositorFrame, and replacing the parent's
1257 // CompositorFrame with another surface ID, parent_id1 becomes unreachable and 1200 // CompositorFrame with another surface ID, parent_id1 becomes unreachable and
1258 // a candidate for garbage collection. 1201 // a candidate for garbage collection.
1259 display_support().SubmitCompositorFrame( 1202 display_support().SubmitCompositorFrame(
1260 display_id.local_surface_id(), 1203 display_id.local_surface_id(),
1261 MakeCompositorFrame({parent_id2}, empty_surface_ids())); 1204 MakeCompositorFrame({parent_id2}, empty_surface_ids(),
1205 TransferableResourceArray()));
1262 1206
1263 // Now |parent_id1| is only kept alive by the active |display_id| frame. 1207 // Now |parent_id1| is only kept alive by the active |display_id| frame.
1264 parent_support().SubmitCompositorFrame( 1208 parent_support().SubmitCompositorFrame(
1265 parent_id2.local_surface_id(), 1209 parent_id2.local_surface_id(),
1266 MakeCompositorFrame({child_id}, empty_surface_ids())); 1210 MakeCompositorFrame({child_id}, empty_surface_ids(),
1211 TransferableResourceArray()));
1267 1212
1268 // SurfaceDependencyTracker should now be tracking |display_id|, |parent_id1| 1213 // SurfaceDependencyTracker should now be tracking |display_id|, |parent_id1|
1269 // and |parent_id2|. By activating the pending |display_id| frame by deadline, 1214 // and |parent_id2|. By activating the pending |display_id| frame by deadline,
1270 // |parent_id1| becomes unreachable and is garbage collected while 1215 // |parent_id1| becomes unreachable and is garbage collected while
1271 // SurfaceDependencyTracker is in the process of activating surfaces. This 1216 // SurfaceDependencyTracker is in the process of activating surfaces. This
1272 // should not cause a crash or use-after-free. 1217 // should not cause a crash or use-after-free.
1273 for (int i = 0; i < 3; ++i) { 1218 for (int i = 0; i < 3; ++i) {
1274 begin_frame_source()->TestOnBeginFrame(args); 1219 begin_frame_source()->TestOnBeginFrame(args);
1275 EXPECT_TRUE(dependency_tracker().has_deadline()); 1220 EXPECT_TRUE(dependency_tracker().has_deadline());
1276 } 1221 }
1277 begin_frame_source()->TestOnBeginFrame(args); 1222 begin_frame_source()->TestOnBeginFrame(args);
1278 EXPECT_FALSE(dependency_tracker().has_deadline()); 1223 EXPECT_FALSE(dependency_tracker().has_deadline());
1279 } 1224 }
1280 1225
1281 // This test verifies that a CompositorFrame will only blocked on embedded 1226 // This test verifies that a CompositorFrame will only blocked on embedded
1282 // surfaces but not on other retained surface IDs in the CompositorFrame. 1227 // surfaces but not on other retained surface IDs in the CompositorFrame.
1283 TEST_F(CompositorFrameSinkSupportTest, OnlyBlockOnEmbeddedSurfaces) { 1228 TEST_F(SurfaceSynchronizationTest, OnlyBlockOnEmbeddedSurfaces) {
1284 const SurfaceId display_id = MakeSurfaceId(kDisplayFrameSink, 1); 1229 const SurfaceId display_id = MakeSurfaceId(kDisplayFrameSink, 1);
1285 const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1); 1230 const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1);
1286 const SurfaceId parent_id2 = MakeSurfaceId(kParentFrameSink, 2); 1231 const SurfaceId parent_id2 = MakeSurfaceId(kParentFrameSink, 2);
1287 1232
1288 // Submitting a CompositorFrame with |parent_id2| so that the display 1233 // Submitting a CompositorFrame with |parent_id2| so that the display
1289 // CompositorFrame can hold a reference to it. 1234 // CompositorFrame can hold a reference to it.
1290 parent_support().SubmitCompositorFrame(parent_id2.local_surface_id(), 1235 parent_support().SubmitCompositorFrame(parent_id2.local_surface_id(),
1291 MakeCompositorFrame()); 1236 MakeCompositorFrame());
1292 1237
1293 display_support().SubmitCompositorFrame( 1238 display_support().SubmitCompositorFrame(
1294 display_id.local_surface_id(), 1239 display_id.local_surface_id(),
1295 MakeCompositorFrame({parent_id1}, {parent_id2})); 1240 MakeCompositorFrame({parent_id1}, {parent_id2},
1241 TransferableResourceArray()));
1296 1242
1297 EXPECT_TRUE(display_surface()->HasPendingFrame()); 1243 EXPECT_TRUE(display_surface()->HasPendingFrame());
1298 EXPECT_FALSE(display_surface()->HasActiveFrame()); 1244 EXPECT_FALSE(display_surface()->HasActiveFrame());
1299 EXPECT_TRUE(dependency_tracker().has_deadline()); 1245 EXPECT_TRUE(dependency_tracker().has_deadline());
1300 1246
1301 // Verify that the display CompositorFrame will only block on |parent_id1| but 1247 // Verify that the display CompositorFrame will only block on |parent_id1| but
1302 // not |parent_id2|. 1248 // not |parent_id2|.
1303 EXPECT_THAT(display_surface()->blocking_surfaces(), 1249 EXPECT_THAT(display_surface()->blocking_surfaces(),
1304 UnorderedElementsAre(parent_id1)); 1250 UnorderedElementsAre(parent_id1));
1305 // Verify that the display surface holds no references while its 1251 // Verify that the display surface holds no references while its
1306 // CompositorFrame is pending. 1252 // CompositorFrame is pending.
1307 EXPECT_THAT(GetChildReferences(display_id), IsEmpty()); 1253 EXPECT_THAT(GetChildReferences(display_id), IsEmpty());
1308 1254
1309 // Submitting a CompositorFrame with |parent_id1| should unblock the display 1255 // Submitting a CompositorFrame with |parent_id1| should unblock the display
1310 // CompositorFrame. 1256 // CompositorFrame.
1311 parent_support().SubmitCompositorFrame(parent_id1.local_surface_id(), 1257 parent_support().SubmitCompositorFrame(parent_id1.local_surface_id(),
1312 MakeCompositorFrame()); 1258 MakeCompositorFrame());
1313 1259
1314 EXPECT_FALSE(dependency_tracker().has_deadline()); 1260 EXPECT_FALSE(dependency_tracker().has_deadline());
1315 EXPECT_FALSE(display_surface()->HasPendingFrame()); 1261 EXPECT_FALSE(display_surface()->HasPendingFrame());
1316 EXPECT_TRUE(display_surface()->HasActiveFrame()); 1262 EXPECT_TRUE(display_surface()->HasActiveFrame());
1317 EXPECT_THAT(display_surface()->blocking_surfaces(), IsEmpty()); 1263 EXPECT_THAT(display_surface()->blocking_surfaces(), IsEmpty());
1318 } 1264 }
1319 1265
1320 // This test verifies that a late arriving CompositorFrame activates immediately 1266 // This test verifies that a late arriving CompositorFrame activates immediately
1321 // and does not trigger a new deadline. 1267 // and does not trigger a new deadline.
1322 TEST_F(CompositorFrameSinkSupportTest, LateArrivingDependency) { 1268 TEST_F(SurfaceSynchronizationTest, LateArrivingDependency) {
1323 const SurfaceId display_id = MakeSurfaceId(kDisplayFrameSink, 1); 1269 const SurfaceId display_id = MakeSurfaceId(kDisplayFrameSink, 1);
1324 const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1); 1270 const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1);
1325 const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); 1271 const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1);
1326 1272
1327 display_support().SubmitCompositorFrame( 1273 display_support().SubmitCompositorFrame(
1328 display_id.local_surface_id(), 1274 display_id.local_surface_id(),
1329 MakeCompositorFrame({parent_id1}, empty_surface_ids())); 1275 MakeCompositorFrame({parent_id1}, empty_surface_ids(),
1276 TransferableResourceArray()));
1330 1277
1331 EXPECT_TRUE(display_surface()->HasPendingFrame()); 1278 EXPECT_TRUE(display_surface()->HasPendingFrame());
1332 EXPECT_FALSE(display_surface()->HasActiveFrame()); 1279 EXPECT_FALSE(display_surface()->HasActiveFrame());
1333 EXPECT_TRUE(dependency_tracker().has_deadline()); 1280 EXPECT_TRUE(dependency_tracker().has_deadline());
1334 1281
1335 // Advance BeginFrames to trigger a deadline. This activates the 1282 // Advance BeginFrames to trigger a deadline. This activates the
1336 // CompositorFrame submitted above. 1283 // CompositorFrame submitted above.
1337 BeginFrameArgs args = 1284 BeginFrameArgs args =
1338 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 0, 1); 1285 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 0, 1);
1339 for (int i = 0; i < 3; ++i) { 1286 for (int i = 0; i < 3; ++i) {
1340 begin_frame_source()->TestOnBeginFrame(args); 1287 begin_frame_source()->TestOnBeginFrame(args);
1341 EXPECT_TRUE(dependency_tracker().has_deadline()); 1288 EXPECT_TRUE(dependency_tracker().has_deadline());
1342 } 1289 }
1343 begin_frame_source()->TestOnBeginFrame(args); 1290 begin_frame_source()->TestOnBeginFrame(args);
1344 EXPECT_FALSE(dependency_tracker().has_deadline()); 1291 EXPECT_FALSE(dependency_tracker().has_deadline());
1345 EXPECT_FALSE(display_surface()->HasPendingFrame()); 1292 EXPECT_FALSE(display_surface()->HasPendingFrame());
1346 EXPECT_TRUE(display_surface()->HasActiveFrame()); 1293 EXPECT_TRUE(display_surface()->HasActiveFrame());
1347 1294
1348 // A late arriving CompositorFrame should activate immediately without 1295 // A late arriving CompositorFrame should activate immediately without
1349 // scheduling a deadline and without waiting for dependencies to resolve. 1296 // scheduling a deadline and without waiting for dependencies to resolve.
1350 parent_support().SubmitCompositorFrame( 1297 parent_support().SubmitCompositorFrame(
1351 parent_id1.local_surface_id(), 1298 parent_id1.local_surface_id(),
1352 MakeCompositorFrame({child_id1}, empty_surface_ids())); 1299 MakeCompositorFrame({child_id1}, empty_surface_ids(),
1300 TransferableResourceArray()));
1353 EXPECT_FALSE(dependency_tracker().has_deadline()); 1301 EXPECT_FALSE(dependency_tracker().has_deadline());
1354 EXPECT_FALSE(parent_surface()->HasPendingFrame()); 1302 EXPECT_FALSE(parent_surface()->HasPendingFrame());
1355 EXPECT_TRUE(parent_surface()->HasActiveFrame()); 1303 EXPECT_TRUE(parent_surface()->HasActiveFrame());
1356 } 1304 }
1357 1305
1358 // This test verifies that CompositorFrames submitted to a surface referenced 1306 // This test verifies that CompositorFrames submitted to a surface referenced
1359 // by a parent CompositorFrame as a fallback will be rejected and ACK'ed 1307 // by a parent CompositorFrame as a fallback will be rejected and ACK'ed
1360 // immediately. 1308 // immediately.
1361 TEST_F(CompositorFrameSinkSupportTest, FallbackSurfacesClosed) { 1309 TEST_F(SurfaceSynchronizationTest, FallbackSurfacesClosed) {
1362 const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1); 1310 const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1);
1363 // This is the fallback child surface that the parent holds a reference to. 1311 // This is the fallback child surface that the parent holds a reference to.
1364 const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); 1312 const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1);
1365 // This is the primary child surface that the parent wants to block on. 1313 // This is the primary child surface that the parent wants to block on.
1366 const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink1, 2); 1314 const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink1, 2);
1367 1315
1368 // child_support1 submits a CompositorFrame without any dependencies. 1316 // child_support1 submits a CompositorFrame without any dependencies.
1369 // DidReceiveCompositorFrameAck should call on immediate activation. 1317 // DidReceiveCompositorFrameAck should call on immediate activation.
1370 // However, resources will not be returned because this frame is a candidate 1318 // However, resources will not be returned because this frame is a candidate
1371 // for display. 1319 // for display.
1372 TransferableResource resource = 1320 TransferableResource resource;
1373 MakeResource(1337 /* id */, ALPHA_8 /* format */, 1234 /* filter */, 1321 resource.id = 1337;
1374 gfx::Size(1234, 5678)); 1322 resource.format = ALPHA_8;
1323 resource.filter = 1234;
1324 resource.size = gfx::Size(1234, 5678);
1375 ReturnedResourceArray returned_resources; 1325 ReturnedResourceArray returned_resources;
1376 TransferableResource::ReturnResources({resource}, &returned_resources); 1326 TransferableResource::ReturnResources({resource}, &returned_resources);
1377 1327
1378 EXPECT_CALL(support_client_, 1328 EXPECT_CALL(support_client_,
1379 DidReceiveCompositorFrameAck(Eq(ReturnedResourceArray()))); 1329 DidReceiveCompositorFrameAck(Eq(ReturnedResourceArray())));
1380 child_support1().SubmitCompositorFrame( 1330 child_support1().SubmitCompositorFrame(
1381 child_id1.local_surface_id(), 1331 child_id1.local_surface_id(),
1382 MakeCompositorFrameWithResources(empty_surface_ids(), {resource})); 1332 MakeCompositorFrame(empty_surface_ids(), empty_surface_ids(),
1333 {resource}));
1383 testing::Mock::VerifyAndClearExpectations(&support_client_); 1334 testing::Mock::VerifyAndClearExpectations(&support_client_);
1384 1335
1385 // The parent is blocked on |child_id2| and references |child_id1|. The 1336 // The parent is blocked on |child_id2| and references |child_id1|. The
1386 // surface corresponding to |child_id1| will not accept new CompositorFrames 1337 // surface corresponding to |child_id1| will not accept new CompositorFrames
1387 // while the parent CompositorFrame is blocked. 1338 // while the parent CompositorFrame is blocked.
1388 parent_support().SubmitCompositorFrame( 1339 parent_support().SubmitCompositorFrame(
1389 parent_id1.local_surface_id(), 1340 parent_id1.local_surface_id(),
1390 MakeCompositorFrame({child_id2}, {child_id1})); 1341 MakeCompositorFrame({child_id2}, {child_id1},
1342 TransferableResourceArray()));
1391 EXPECT_TRUE(dependency_tracker().has_deadline()); 1343 EXPECT_TRUE(dependency_tracker().has_deadline());
1392 EXPECT_TRUE(parent_surface()->HasPendingFrame()); 1344 EXPECT_TRUE(parent_surface()->HasPendingFrame());
1393 EXPECT_FALSE(parent_surface()->HasActiveFrame()); 1345 EXPECT_FALSE(parent_surface()->HasActiveFrame());
1394 1346
1395 // Resources will be returned immediately because |child_id1|'s surface is 1347 // Resources will be returned immediately because |child_id1|'s surface is
1396 // closed. 1348 // closed.
1397 TransferableResource resource2 = 1349 TransferableResource resource2;
1398 MakeResource(1246 /* id */, ALPHA_8 /* format */, 1357 /* filter */, 1350 resource2.id = 1246;
1399 gfx::Size(8765, 4321)); 1351 resource2.format = ALPHA_8;
1352 resource2.filter = 1357;
1353 resource2.size = gfx::Size(8765, 4321);
1400 ReturnedResourceArray returned_resources2; 1354 ReturnedResourceArray returned_resources2;
1401 TransferableResource::ReturnResources({resource2}, &returned_resources2); 1355 TransferableResource::ReturnResources({resource2}, &returned_resources2);
1402 EXPECT_CALL(support_client_, 1356 EXPECT_CALL(support_client_,
1403 DidReceiveCompositorFrameAck(Eq(returned_resources2))); 1357 DidReceiveCompositorFrameAck(Eq(returned_resources2)));
1404 child_support1().SubmitCompositorFrame( 1358 child_support1().SubmitCompositorFrame(
1405 child_id1.local_surface_id(), 1359 child_id1.local_surface_id(),
1406 MakeCompositorFrameWithResources(empty_surface_ids(), {resource2})); 1360 MakeCompositorFrame(empty_surface_ids(), empty_surface_ids(),
1361 {resource2}));
1407 testing::Mock::VerifyAndClearExpectations(&support_client_); 1362 testing::Mock::VerifyAndClearExpectations(&support_client_);
1408 1363
1409 // Advance BeginFrames to trigger a deadline. This activates the 1364 // Advance BeginFrames to trigger a deadline. This activates the
1410 // CompositorFrame submitted to the parent. 1365 // CompositorFrame submitted to the parent.
1411 BeginFrameArgs args = 1366 BeginFrameArgs args =
1412 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 0, 1); 1367 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 0, 1);
1413 for (int i = 0; i < 3; ++i) { 1368 for (int i = 0; i < 3; ++i) {
1414 begin_frame_source()->TestOnBeginFrame(args); 1369 begin_frame_source()->TestOnBeginFrame(args);
1415 EXPECT_TRUE(dependency_tracker().has_deadline()); 1370 EXPECT_TRUE(dependency_tracker().has_deadline());
1416 } 1371 }
1417 begin_frame_source()->TestOnBeginFrame(args); 1372 begin_frame_source()->TestOnBeginFrame(args);
1418 EXPECT_FALSE(dependency_tracker().has_deadline()); 1373 EXPECT_FALSE(dependency_tracker().has_deadline());
1419 EXPECT_FALSE(parent_surface()->HasPendingFrame()); 1374 EXPECT_FALSE(parent_surface()->HasPendingFrame());
1420 EXPECT_TRUE(parent_surface()->HasActiveFrame()); 1375 EXPECT_TRUE(parent_surface()->HasActiveFrame());
1421 1376
1422 // Resources will be returned immediately because |child_id1|'s surface is 1377 // Resources will be returned immediately because |child_id1|'s surface is
1423 // closed forever. 1378 // closed forever.
1424 EXPECT_CALL(support_client_, 1379 EXPECT_CALL(support_client_,
1425 DidReceiveCompositorFrameAck(Eq(returned_resources2))); 1380 DidReceiveCompositorFrameAck(Eq(returned_resources2)));
1426 child_support1().SubmitCompositorFrame( 1381 child_support1().SubmitCompositorFrame(
1427 child_id1.local_surface_id(), 1382 child_id1.local_surface_id(),
1428 MakeCompositorFrameWithResources(empty_surface_ids(), {resource2})); 1383 MakeCompositorFrame(empty_surface_ids(), empty_surface_ids(),
1384 {resource2}));
1429 testing::Mock::VerifyAndClearExpectations(&support_client_); 1385 testing::Mock::VerifyAndClearExpectations(&support_client_);
1430 } 1386 }
1431 1387
1388 } // namespace test
1432 } // namespace cc 1389 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/surface_resource_holder.cc ('k') | cc/test/compositor_frame_helpers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698