| Index: cc/surfaces/surface_factory_unittest.cc
|
| diff --git a/cc/surfaces/surface_factory_unittest.cc b/cc/surfaces/surface_factory_unittest.cc
|
| index b462046595fe7f4293edec8ae71e5caffed17568..ed8d078015f625f5528b5b71a2e8ca1eb67fee07 100644
|
| --- a/cc/surfaces/surface_factory_unittest.cc
|
| +++ b/cc/surfaces/surface_factory_unittest.cc
|
| @@ -26,6 +26,9 @@
|
| namespace cc {
|
| namespace {
|
|
|
| +static constexpr uint32_t kArbitraryGpuId = 0;
|
| +static constexpr uint32_t kArbitraryClientId = 0;
|
| +
|
| class TestSurfaceFactoryClient : public SurfaceFactoryClient {
|
| public:
|
| TestSurfaceFactoryClient() : begin_frame_source_(nullptr) {}
|
| @@ -66,7 +69,7 @@ class SurfaceFactoryTest : public testing::Test, public SurfaceDamageObserver {
|
| public:
|
| SurfaceFactoryTest()
|
| : factory_(new SurfaceFactory(&manager_, &client_)),
|
| - surface_id_(0, 3, 0),
|
| + surface_id_(kArbitraryGpuId, kArbitraryClientId, 3, 0),
|
| frame_sync_token_(GenTestSyncToken(4)),
|
| consumer_sync_token_(GenTestSyncToken(5)) {
|
| manager_.AddObserver(this);
|
| @@ -74,7 +77,7 @@ class SurfaceFactoryTest : public testing::Test, public SurfaceDamageObserver {
|
| }
|
|
|
| // SurfaceDamageObserver implementation.
|
| - void OnSurfaceDamaged(SurfaceId id, bool* changed) override {
|
| + void OnSurfaceDamaged(const SurfaceId& id, bool* changed) override {
|
| *changed = true;
|
| }
|
|
|
| @@ -419,7 +422,7 @@ TEST_F(SurfaceFactoryTest, ResourceLifetime) {
|
| }
|
|
|
| TEST_F(SurfaceFactoryTest, BlankNoIndexIncrement) {
|
| - SurfaceId surface_id(0, 6, 0);
|
| + SurfaceId surface_id(kArbitraryGpuId, kArbitraryClientId, 6, 0);
|
| factory_->Create(surface_id);
|
| Surface* surface = manager_.GetSurfaceForId(surface_id);
|
| ASSERT_NE(nullptr, surface);
|
| @@ -437,7 +440,7 @@ void CreateSurfaceDrawCallback(SurfaceFactory* factory,
|
| uint32_t* execute_count,
|
| SurfaceDrawStatus* result,
|
| SurfaceDrawStatus drawn) {
|
| - SurfaceId new_id(0, 7, 0);
|
| + SurfaceId new_id(kArbitraryGpuId, kArbitraryClientId, 7, 0);
|
| factory->Create(new_id);
|
| factory->Destroy(new_id);
|
| *execute_count += 1;
|
| @@ -445,7 +448,7 @@ void CreateSurfaceDrawCallback(SurfaceFactory* factory,
|
| }
|
|
|
| TEST_F(SurfaceFactoryTest, AddDuringDestroy) {
|
| - SurfaceId surface_id(0, 6, 0);
|
| + SurfaceId surface_id(kArbitraryGpuId, kArbitraryClientId, 6, 0);
|
| factory_->Create(surface_id);
|
| CompositorFrame frame;
|
| frame.delegated_frame_data.reset(new DelegatedFrameData);
|
| @@ -471,7 +474,7 @@ void DrawCallback(uint32_t* execute_count,
|
|
|
| // Tests doing a DestroyAll before shutting down the factory;
|
| TEST_F(SurfaceFactoryTest, DestroyAll) {
|
| - SurfaceId id(0, 7, 0);
|
| + SurfaceId id(kArbitraryGpuId, kArbitraryClientId, 7, 0);
|
| factory_->Create(id);
|
|
|
| std::unique_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData);
|
| @@ -494,10 +497,10 @@ TEST_F(SurfaceFactoryTest, DestroyAll) {
|
| }
|
|
|
| TEST_F(SurfaceFactoryTest, DestroySequence) {
|
| - SurfaceId id2(0, 5, 0);
|
| + SurfaceId id2(kArbitraryGpuId, kArbitraryClientId, 5, 0);
|
| factory_->Create(id2);
|
|
|
| - manager_.RegisterSurfaceIdNamespace(0);
|
| + manager_.RegisterSurfaceClientId(0);
|
|
|
| // Check that waiting before the sequence is satisfied works.
|
| manager_.GetSurfaceForId(id2)
|
| @@ -525,12 +528,12 @@ TEST_F(SurfaceFactoryTest, DestroySequence) {
|
|
|
| // Tests that Surface ID namespace invalidation correctly allows
|
| // Sequences to be ignored.
|
| -TEST_F(SurfaceFactoryTest, InvalidIdNamespace) {
|
| +TEST_F(SurfaceFactoryTest, InvalidClientId) {
|
| uint32_t id_namespace = 9u;
|
| - SurfaceId id(id_namespace, 5, 0);
|
| + SurfaceId id(kArbitraryGpuId, id_namespace, 5, 0);
|
| factory_->Create(id);
|
|
|
| - manager_.RegisterSurfaceIdNamespace(id_namespace);
|
| + manager_.RegisterSurfaceClientId(id_namespace);
|
| manager_.GetSurfaceForId(id)
|
| ->AddDestructionDependency(SurfaceSequence(id_namespace, 4));
|
| factory_->Destroy(id);
|
| @@ -538,7 +541,7 @@ TEST_F(SurfaceFactoryTest, InvalidIdNamespace) {
|
| // Verify the dependency has prevented the surface from getting destroyed.
|
| EXPECT_TRUE(manager_.GetSurfaceForId(id));
|
|
|
| - manager_.InvalidateSurfaceIdNamespace(id_namespace);
|
| + manager_.InvalidateSurfaceClientId(id_namespace);
|
|
|
| // Verify that the invalidated namespace caused the unsatisfied sequence
|
| // to be ignored.
|
| @@ -546,10 +549,10 @@ TEST_F(SurfaceFactoryTest, InvalidIdNamespace) {
|
| }
|
|
|
| TEST_F(SurfaceFactoryTest, DestroyCycle) {
|
| - SurfaceId id2(0, 5, 0);
|
| + SurfaceId id2(kArbitraryGpuId, kArbitraryClientId, 5, 0);
|
| factory_->Create(id2);
|
|
|
| - manager_.RegisterSurfaceIdNamespace(0);
|
| + manager_.RegisterSurfaceClientId(0);
|
|
|
| manager_.GetSurfaceForId(id2)
|
| ->AddDestructionDependency(SurfaceSequence(0, 4));
|
|
|