| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/surface_factory.h" | 5 #include "cc/surfaces/surface_factory.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 frame.resource_list.push_back(resource); | 484 frame.resource_list.push_back(resource); |
| 485 uint32_t execute_count = 0; | 485 uint32_t execute_count = 0; |
| 486 factory_->SubmitCompositorFrame(id, std::move(frame), | 486 factory_->SubmitCompositorFrame(id, std::move(frame), |
| 487 base::Bind(&DrawCallback, &execute_count)); | 487 base::Bind(&DrawCallback, &execute_count)); |
| 488 EXPECT_EQ(last_created_surface_id().local_frame_id(), id); | 488 EXPECT_EQ(last_created_surface_id().local_frame_id(), id); |
| 489 local_frame_id_ = LocalFrameId(); | 489 local_frame_id_ = LocalFrameId(); |
| 490 factory_->DestroyAll(); | 490 factory_->DestroyAll(); |
| 491 EXPECT_EQ(1u, execute_count); | 491 EXPECT_EQ(1u, execute_count); |
| 492 } | 492 } |
| 493 | 493 |
| 494 // Tests that SurfaceFactory doesn't return resources after Reset(). |
| 495 TEST_F(SurfaceFactoryTest, Reset) { |
| 496 LocalFrameId id(7, 0); |
| 497 factory_->Create(id); |
| 498 |
| 499 TransferableResource resource; |
| 500 resource.id = 1; |
| 501 resource.mailbox_holder.texture_target = GL_TEXTURE_2D; |
| 502 CompositorFrame frame; |
| 503 frame.resource_list.push_back(resource); |
| 504 uint32_t execute_count = 0; |
| 505 factory_->SubmitCompositorFrame(id, std::move(frame), |
| 506 base::Bind(&DrawCallback, &execute_count)); |
| 507 EXPECT_EQ(last_created_surface_id().local_frame_id(), id); |
| 508 |
| 509 SurfaceId surface_id(kArbitraryFrameSinkId, id); |
| 510 manager_.AddSurfaceReference(SurfaceManager::kRootSurfaceId, surface_id); |
| 511 factory_->Reset(); |
| 512 EXPECT_TRUE(client_.returned_resources().empty()); |
| 513 manager_.RemoveSurfaceReference(SurfaceManager::kRootSurfaceId, surface_id); |
| 514 EXPECT_TRUE(client_.returned_resources().empty()); |
| 515 local_frame_id_ = LocalFrameId(); |
| 516 } |
| 517 |
| 494 TEST_F(SurfaceFactoryTest, DestroySequence) { | 518 TEST_F(SurfaceFactoryTest, DestroySequence) { |
| 495 LocalFrameId local_frame_id2(5, 0); | 519 LocalFrameId local_frame_id2(5, 0); |
| 496 SurfaceId id2(kArbitraryFrameSinkId, local_frame_id2); | 520 SurfaceId id2(kArbitraryFrameSinkId, local_frame_id2); |
| 497 factory_->Create(local_frame_id2); | 521 factory_->Create(local_frame_id2); |
| 498 | 522 |
| 499 manager_.RegisterFrameSinkId(kArbitraryFrameSinkId); | 523 manager_.RegisterFrameSinkId(kArbitraryFrameSinkId); |
| 500 | 524 |
| 501 // Check that waiting before the sequence is satisfied works. | 525 // Check that waiting before the sequence is satisfied works. |
| 502 manager_.GetSurfaceForId(id2)->AddDestructionDependency( | 526 manager_.GetSurfaceForId(id2)->AddDestructionDependency( |
| 503 SurfaceSequence(kArbitraryFrameSinkId, 4)); | 527 SurfaceSequence(kArbitraryFrameSinkId, 4)); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 | 673 |
| 650 factory_->Destroy(local_frame_id_); | 674 factory_->Destroy(local_frame_id_); |
| 651 local_frame_id_ = LocalFrameId(); | 675 local_frame_id_ = LocalFrameId(); |
| 652 EXPECT_TRUE(called1); | 676 EXPECT_TRUE(called1); |
| 653 EXPECT_TRUE(called2); | 677 EXPECT_TRUE(called2); |
| 654 EXPECT_TRUE(called3); | 678 EXPECT_TRUE(called3); |
| 655 } | 679 } |
| 656 | 680 |
| 657 } // namespace | 681 } // namespace |
| 658 } // namespace cc | 682 } // namespace cc |
| OLD | NEW |