| Index: cc/surfaces/surface_factory_unittest.cc
|
| diff --git a/cc/surfaces/surface_factory_unittest.cc b/cc/surfaces/surface_factory_unittest.cc
|
| index c5e6a76d9b2c904315d2fb8ceea0315fee49bc73..73ccf751d70cee6cae4dc04584f1d78b77604840 100644
|
| --- a/cc/surfaces/surface_factory_unittest.cc
|
| +++ b/cc/surfaces/surface_factory_unittest.cc
|
| @@ -26,7 +26,7 @@
|
| namespace cc {
|
| namespace {
|
|
|
| -static constexpr uint32_t kArbitraryClientId = 0;
|
| +static constexpr FrameSinkId kArbitraryFrameSinkId(1, 1);
|
|
|
| class TestSurfaceFactoryClient : public SurfaceFactoryClient {
|
| public:
|
| @@ -68,7 +68,7 @@ class SurfaceFactoryTest : public testing::Test, public SurfaceDamageObserver {
|
| public:
|
| SurfaceFactoryTest()
|
| : factory_(new SurfaceFactory(&manager_, &client_)),
|
| - surface_id_(kArbitraryClientId, 3, 0),
|
| + surface_id_(kArbitraryFrameSinkId, 3, 0),
|
| frame_sync_token_(GenTestSyncToken(4)),
|
| consumer_sync_token_(GenTestSyncToken(5)) {
|
| manager_.AddObserver(this);
|
| @@ -421,7 +421,7 @@ TEST_F(SurfaceFactoryTest, ResourceLifetime) {
|
| }
|
|
|
| TEST_F(SurfaceFactoryTest, BlankNoIndexIncrement) {
|
| - SurfaceId surface_id(kArbitraryClientId, 6, 0);
|
| + SurfaceId surface_id(kArbitraryFrameSinkId, 6, 0);
|
| factory_->Create(surface_id);
|
| Surface* surface = manager_.GetSurfaceForId(surface_id);
|
| ASSERT_NE(nullptr, surface);
|
| @@ -437,14 +437,14 @@ TEST_F(SurfaceFactoryTest, BlankNoIndexIncrement) {
|
|
|
| void CreateSurfaceDrawCallback(SurfaceFactory* factory,
|
| uint32_t* execute_count) {
|
| - SurfaceId new_id(kArbitraryClientId, 7, 0);
|
| + SurfaceId new_id(kArbitraryFrameSinkId, 7, 0);
|
| factory->Create(new_id);
|
| factory->Destroy(new_id);
|
| *execute_count += 1;
|
| }
|
|
|
| TEST_F(SurfaceFactoryTest, AddDuringDestroy) {
|
| - SurfaceId surface_id(kArbitraryClientId, 6, 0);
|
| + SurfaceId surface_id(kArbitraryFrameSinkId, 6, 0);
|
| factory_->Create(surface_id);
|
| CompositorFrame frame;
|
| frame.delegated_frame_data.reset(new DelegatedFrameData);
|
| @@ -465,7 +465,7 @@ void DrawCallback(uint32_t* execute_count) {
|
|
|
| // Tests doing a DestroyAll before shutting down the factory;
|
| TEST_F(SurfaceFactoryTest, DestroyAll) {
|
| - SurfaceId id(kArbitraryClientId, 7, 0);
|
| + SurfaceId id(kArbitraryFrameSinkId, 7, 0);
|
| factory_->Create(id);
|
|
|
| std::unique_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData);
|
| @@ -485,14 +485,14 @@ TEST_F(SurfaceFactoryTest, DestroyAll) {
|
| }
|
|
|
| TEST_F(SurfaceFactoryTest, DestroySequence) {
|
| - SurfaceId id2(kArbitraryClientId, 5, 0);
|
| + SurfaceId id2(kArbitraryFrameSinkId, 5, 0);
|
| factory_->Create(id2);
|
|
|
| - manager_.RegisterSurfaceClientId(0);
|
| + manager_.RegisterFrameSinkId(kArbitraryFrameSinkId);
|
|
|
| // Check that waiting before the sequence is satisfied works.
|
| - manager_.GetSurfaceForId(id2)
|
| - ->AddDestructionDependency(SurfaceSequence(0, 4));
|
| + manager_.GetSurfaceForId(id2)->AddDestructionDependency(
|
| + SurfaceSequence(kArbitraryFrameSinkId, 4));
|
| factory_->Destroy(id2);
|
|
|
| std::unique_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData);
|
| @@ -508,8 +508,8 @@ TEST_F(SurfaceFactoryTest, DestroySequence) {
|
| // Check that waiting after the sequence is satisfied works.
|
| factory_->Create(id2);
|
| DCHECK(manager_.GetSurfaceForId(id2));
|
| - manager_.GetSurfaceForId(id2)
|
| - ->AddDestructionDependency(SurfaceSequence(0, 6));
|
| + manager_.GetSurfaceForId(id2)->AddDestructionDependency(
|
| + SurfaceSequence(FrameSinkId(0, 0), 6));
|
| factory_->Destroy(id2);
|
| DCHECK(!manager_.GetSurfaceForId(id2));
|
| }
|
| @@ -517,19 +517,19 @@ TEST_F(SurfaceFactoryTest, DestroySequence) {
|
| // Tests that Surface ID namespace invalidation correctly allows
|
| // Sequences to be ignored.
|
| TEST_F(SurfaceFactoryTest, InvalidClientId) {
|
| - uint32_t id_namespace = 9u;
|
| - SurfaceId id(id_namespace, 5, 0);
|
| + FrameSinkId frame_sink_id(9, 9);
|
| + SurfaceId id(frame_sink_id, 5, 0);
|
| factory_->Create(id);
|
|
|
| - manager_.RegisterSurfaceClientId(id_namespace);
|
| - manager_.GetSurfaceForId(id)
|
| - ->AddDestructionDependency(SurfaceSequence(id_namespace, 4));
|
| + manager_.RegisterFrameSinkId(frame_sink_id);
|
| + manager_.GetSurfaceForId(id)->AddDestructionDependency(
|
| + SurfaceSequence(frame_sink_id, 4));
|
| factory_->Destroy(id);
|
|
|
| // Verify the dependency has prevented the surface from getting destroyed.
|
| EXPECT_TRUE(manager_.GetSurfaceForId(id));
|
|
|
| - manager_.InvalidateSurfaceClientId(id_namespace);
|
| + manager_.InvalidateFrameSinkId(frame_sink_id);
|
|
|
| // Verify that the invalidated namespace caused the unsatisfied sequence
|
| // to be ignored.
|
| @@ -537,13 +537,13 @@ TEST_F(SurfaceFactoryTest, InvalidClientId) {
|
| }
|
|
|
| TEST_F(SurfaceFactoryTest, DestroyCycle) {
|
| - SurfaceId id2(kArbitraryClientId, 5, 0);
|
| + SurfaceId id2(kArbitraryFrameSinkId, 5, 0);
|
| factory_->Create(id2);
|
|
|
| - manager_.RegisterSurfaceClientId(0);
|
| + manager_.RegisterFrameSinkId(FrameSinkId(0, 0));
|
|
|
| - manager_.GetSurfaceForId(id2)
|
| - ->AddDestructionDependency(SurfaceSequence(0, 4));
|
| + manager_.GetSurfaceForId(id2)->AddDestructionDependency(
|
| + SurfaceSequence(FrameSinkId(0, 0), 4));
|
|
|
| // Give id2 a frame that references surface_id_.
|
| {
|
| @@ -577,7 +577,7 @@ TEST_F(SurfaceFactoryTest, DestroyCycle) {
|
| // Satisfy last destruction dependency for id2.
|
| std::vector<uint32_t> to_satisfy;
|
| to_satisfy.push_back(4);
|
| - manager_.DidSatisfySequences(0, &to_satisfy);
|
| + manager_.DidSatisfySequences(FrameSinkId(0, 0), &to_satisfy);
|
|
|
| // id2 and surface_id_ are in a reference cycle that has no surface
|
| // sequences holding on to it, so they should be destroyed.
|
|
|