OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/surfaces/compositor_frame_sink_support.h" | 5 #include "cc/surfaces/compositor_frame_sink_support.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "cc/output/compositor_frame.h" | 8 #include "cc/output/compositor_frame.h" |
9 #include "cc/output/copy_output_request.h" | 9 #include "cc/output/copy_output_request.h" |
10 #include "cc/output/copy_output_result.h" | 10 #include "cc/output/copy_output_result.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 kIsRoot, | 101 kIsRoot, |
102 kHandlesFrameSinkIdInvalidation, | 102 kHandlesFrameSinkIdInvalidation, |
103 kNeedsSyncPoints)), | 103 kNeedsSyncPoints)), |
104 local_surface_id_(3, kArbitraryToken), | 104 local_surface_id_(3, kArbitraryToken), |
105 frame_sync_token_(GenTestSyncToken(4)), | 105 frame_sync_token_(GenTestSyncToken(4)), |
106 consumer_sync_token_(GenTestSyncToken(5)) { | 106 consumer_sync_token_(GenTestSyncToken(5)) { |
107 manager_.AddObserver(this); | 107 manager_.AddObserver(this); |
108 } | 108 } |
109 ~CompositorFrameSinkSupportTest() override { | 109 ~CompositorFrameSinkSupportTest() override { |
110 manager_.RemoveObserver(this); | 110 manager_.RemoveObserver(this); |
111 support_->EvictFrame(); | 111 support_->EvictCurrentSurface(); |
112 } | 112 } |
113 | 113 |
114 const SurfaceId& last_created_surface_id() const { | 114 const SurfaceId& last_created_surface_id() const { |
115 return last_created_surface_id_; | 115 return last_created_surface_id_; |
116 } | 116 } |
117 | 117 |
118 // SurfaceObserver implementation. | 118 // SurfaceObserver implementation. |
119 void OnSurfaceCreated(const SurfaceInfo& surface_info) override { | 119 void OnSurfaceCreated(const SurfaceInfo& surface_info) override { |
120 last_created_surface_id_ = surface_info.id(); | 120 last_created_surface_id_ = surface_info.id(); |
121 last_surface_info_ = surface_info; | 121 last_surface_info_ = surface_info; |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); | 499 kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); |
500 LocalSurfaceId local_surface_id(6, kArbitraryToken); | 500 LocalSurfaceId local_surface_id(6, kArbitraryToken); |
501 support->SubmitCompositorFrame(local_surface_id, MakeCompositorFrame()); | 501 support->SubmitCompositorFrame(local_surface_id, MakeCompositorFrame()); |
502 | 502 |
503 EXPECT_CALL(mock_client, DidReceiveCompositorFrameAck(_)) | 503 EXPECT_CALL(mock_client, DidReceiveCompositorFrameAck(_)) |
504 .WillOnce(testing::InvokeWithoutArgs([&support, &mock_client]() { | 504 .WillOnce(testing::InvokeWithoutArgs([&support, &mock_client]() { |
505 LocalSurfaceId new_id(7, base::UnguessableToken::Create()); | 505 LocalSurfaceId new_id(7, base::UnguessableToken::Create()); |
506 support->SubmitCompositorFrame(new_id, MakeCompositorFrame()); | 506 support->SubmitCompositorFrame(new_id, MakeCompositorFrame()); |
507 })) | 507 })) |
508 .WillRepeatedly(testing::Return()); | 508 .WillRepeatedly(testing::Return()); |
509 support->EvictFrame(); | 509 support->EvictCurrentSurface(); |
510 } | 510 } |
511 | 511 |
512 // Tests doing an EvictFrame before shutting down the factory. | 512 // Tests doing an EvictCurrentSurface before shutting down the factory. |
513 TEST_F(CompositorFrameSinkSupportTest, EvictFrame) { | 513 TEST_F(CompositorFrameSinkSupportTest, EvictCurrentSurface) { |
514 MockCompositorFrameSinkSupportClient mock_client; | 514 MockCompositorFrameSinkSupportClient mock_client; |
515 std::unique_ptr<CompositorFrameSinkSupport> support = | 515 std::unique_ptr<CompositorFrameSinkSupport> support = |
516 CompositorFrameSinkSupport::Create( | 516 CompositorFrameSinkSupport::Create( |
517 &mock_client, &manager_, kAnotherArbitraryFrameSinkId, kIsRoot, | 517 &mock_client, &manager_, kAnotherArbitraryFrameSinkId, kIsRoot, |
518 kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); | 518 kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); |
519 LocalSurfaceId local_surface_id(7, kArbitraryToken); | 519 LocalSurfaceId local_surface_id(7, kArbitraryToken); |
520 SurfaceId id(kAnotherArbitraryFrameSinkId, local_surface_id); | 520 SurfaceId id(kAnotherArbitraryFrameSinkId, local_surface_id); |
521 | 521 |
522 TransferableResource resource; | 522 TransferableResource resource; |
523 resource.id = 1; | 523 resource.id = 1; |
524 resource.mailbox_holder.texture_target = GL_TEXTURE_2D; | 524 resource.mailbox_holder.texture_target = GL_TEXTURE_2D; |
525 CompositorFrame frame = MakeCompositorFrame(); | 525 CompositorFrame frame = MakeCompositorFrame(); |
526 frame.resource_list.push_back(resource); | 526 frame.resource_list.push_back(resource); |
527 support->SubmitCompositorFrame(local_surface_id, std::move(frame)); | 527 support->SubmitCompositorFrame(local_surface_id, std::move(frame)); |
528 EXPECT_EQ(last_created_surface_id().local_surface_id(), local_surface_id); | 528 EXPECT_EQ(last_created_surface_id().local_surface_id(), local_surface_id); |
529 local_surface_id_ = LocalSurfaceId(); | 529 local_surface_id_ = LocalSurfaceId(); |
530 | 530 |
531 ReturnedResourceArray returned_resources = {resource.ToReturnedResource()}; | 531 ReturnedResourceArray returned_resources = {resource.ToReturnedResource()}; |
532 EXPECT_TRUE(manager_.GetSurfaceForId(id)); | 532 EXPECT_TRUE(manager_.GetSurfaceForId(id)); |
533 EXPECT_CALL(mock_client, DidReceiveCompositorFrameAck(returned_resources)) | 533 EXPECT_CALL(mock_client, DidReceiveCompositorFrameAck(returned_resources)) |
534 .Times(1); | 534 .Times(1); |
535 support->EvictFrame(); | 535 support->EvictCurrentSurface(); |
536 EXPECT_FALSE(manager_.GetSurfaceForId(id)); | 536 EXPECT_FALSE(manager_.GetSurfaceForId(id)); |
537 } | 537 } |
538 | 538 |
539 // Tests doing an EvictSurface which has unregistered dependency. | 539 // Tests doing an EvictCurrentSurface which has unregistered dependency. |
540 TEST_F(CompositorFrameSinkSupportTest, EvictSurfaceDependencyUnRegistered) { | 540 TEST_F(CompositorFrameSinkSupportTest, |
| 541 EvictCurrentSurfaceDependencyUnRegistered) { |
541 MockCompositorFrameSinkSupportClient mock_client; | 542 MockCompositorFrameSinkSupportClient mock_client; |
542 std::unique_ptr<CompositorFrameSinkSupport> support = | 543 std::unique_ptr<CompositorFrameSinkSupport> support = |
543 CompositorFrameSinkSupport::Create( | 544 CompositorFrameSinkSupport::Create( |
544 &mock_client, &manager_, kAnotherArbitraryFrameSinkId, kIsRoot, | 545 &mock_client, &manager_, kAnotherArbitraryFrameSinkId, kIsRoot, |
545 kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); | 546 kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); |
546 LocalSurfaceId local_surface_id(7, kArbitraryToken); | 547 LocalSurfaceId local_surface_id(7, kArbitraryToken); |
547 | 548 |
548 TransferableResource resource; | 549 TransferableResource resource; |
549 resource.id = 1; | 550 resource.id = 1; |
550 resource.mailbox_holder.texture_target = GL_TEXTURE_2D; | 551 resource.mailbox_holder.texture_target = GL_TEXTURE_2D; |
551 CompositorFrame frame = MakeCompositorFrame(); | 552 CompositorFrame frame = MakeCompositorFrame(); |
552 frame.resource_list.push_back(resource); | 553 frame.resource_list.push_back(resource); |
553 support->SubmitCompositorFrame(local_surface_id, std::move(frame)); | 554 support->SubmitCompositorFrame(local_surface_id, std::move(frame)); |
554 EXPECT_EQ(last_created_surface_id().local_surface_id(), local_surface_id); | 555 EXPECT_EQ(last_created_surface_id().local_surface_id(), local_surface_id); |
555 local_surface_id_ = LocalSurfaceId(); | 556 local_surface_id_ = LocalSurfaceId(); |
556 | 557 |
557 SurfaceId surface_id(kAnotherArbitraryFrameSinkId, local_surface_id); | 558 SurfaceId surface_id(kAnotherArbitraryFrameSinkId, local_surface_id); |
558 Surface* surface = manager_.GetSurfaceForId(surface_id); | 559 Surface* surface = manager_.GetSurfaceForId(surface_id); |
559 surface->AddDestructionDependency( | 560 surface->AddDestructionDependency( |
560 SurfaceSequence(kYetAnotherArbitraryFrameSinkId, 4)); | 561 SurfaceSequence(kYetAnotherArbitraryFrameSinkId, 4)); |
561 | 562 |
562 ReturnedResourceArray returned_resource = {resource.ToReturnedResource()}; | 563 ReturnedResourceArray returned_resource = {resource.ToReturnedResource()}; |
563 | 564 |
564 EXPECT_TRUE(manager_.GetSurfaceForId(surface_id)); | 565 EXPECT_TRUE(manager_.GetSurfaceForId(surface_id)); |
565 EXPECT_CALL(mock_client, DidReceiveCompositorFrameAck(returned_resource)) | 566 EXPECT_CALL(mock_client, DidReceiveCompositorFrameAck(returned_resource)) |
566 .Times(1); | 567 .Times(1); |
567 support->EvictFrame(); | 568 support->EvictCurrentSurface(); |
568 EXPECT_FALSE(manager_.GetSurfaceForId(surface_id)); | 569 EXPECT_FALSE(manager_.GetSurfaceForId(surface_id)); |
569 } | 570 } |
570 | 571 |
571 // Tests doing an EvictSurface which has registered dependency. | 572 // Tests doing an EvictCurrentSurface which has registered dependency. |
572 TEST_F(CompositorFrameSinkSupportTest, EvictSurfaceDependencyRegistered) { | 573 TEST_F(CompositorFrameSinkSupportTest, |
| 574 EvictCurrentSurfaceDependencyRegistered) { |
573 MockCompositorFrameSinkSupportClient mock_client; | 575 MockCompositorFrameSinkSupportClient mock_client; |
574 std::unique_ptr<CompositorFrameSinkSupport> support = | 576 std::unique_ptr<CompositorFrameSinkSupport> support = |
575 CompositorFrameSinkSupport::Create( | 577 CompositorFrameSinkSupport::Create( |
576 &mock_client, &manager_, kAnotherArbitraryFrameSinkId, kIsRoot, | 578 &mock_client, &manager_, kAnotherArbitraryFrameSinkId, kIsRoot, |
577 kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); | 579 kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); |
578 LocalSurfaceId local_surface_id(7, kArbitraryToken); | 580 LocalSurfaceId local_surface_id(7, kArbitraryToken); |
579 | 581 |
580 TransferableResource resource; | 582 TransferableResource resource; |
581 resource.id = 1; | 583 resource.id = 1; |
582 resource.mailbox_holder.texture_target = GL_TEXTURE_2D; | 584 resource.mailbox_holder.texture_target = GL_TEXTURE_2D; |
583 CompositorFrame frame = MakeCompositorFrame(); | 585 CompositorFrame frame = MakeCompositorFrame(); |
584 frame.resource_list.push_back(resource); | 586 frame.resource_list.push_back(resource); |
585 uint32_t execute_count = 0; | 587 uint32_t execute_count = 0; |
586 support->SubmitCompositorFrame(local_surface_id, std::move(frame)); | 588 support->SubmitCompositorFrame(local_surface_id, std::move(frame)); |
587 EXPECT_EQ(last_created_surface_id().local_surface_id(), local_surface_id); | 589 EXPECT_EQ(last_created_surface_id().local_surface_id(), local_surface_id); |
588 local_surface_id_ = LocalSurfaceId(); | 590 local_surface_id_ = LocalSurfaceId(); |
589 | 591 |
590 manager_.RegisterFrameSinkId(kYetAnotherArbitraryFrameSinkId); | 592 manager_.RegisterFrameSinkId(kYetAnotherArbitraryFrameSinkId); |
591 | 593 |
592 SurfaceId surface_id(kAnotherArbitraryFrameSinkId, local_surface_id); | 594 SurfaceId surface_id(kAnotherArbitraryFrameSinkId, local_surface_id); |
593 Surface* surface = manager_.GetSurfaceForId(surface_id); | 595 Surface* surface = manager_.GetSurfaceForId(surface_id); |
594 surface->AddDestructionDependency( | 596 surface->AddDestructionDependency( |
595 SurfaceSequence(kYetAnotherArbitraryFrameSinkId, 4)); | 597 SurfaceSequence(kYetAnotherArbitraryFrameSinkId, 4)); |
596 | 598 |
597 ReturnedResourceArray returned_resources; | 599 ReturnedResourceArray returned_resources; |
598 EXPECT_TRUE(manager_.GetSurfaceForId(surface_id)); | 600 EXPECT_TRUE(manager_.GetSurfaceForId(surface_id)); |
599 support->EvictFrame(); | 601 support->EvictCurrentSurface(); |
600 EXPECT_TRUE(manager_.GetSurfaceForId(surface_id)); | 602 EXPECT_TRUE(manager_.GetSurfaceForId(surface_id)); |
601 EXPECT_EQ(0u, execute_count); | 603 EXPECT_EQ(0u, execute_count); |
602 | 604 |
603 returned_resources.push_back(resource.ToReturnedResource()); | 605 returned_resources.push_back(resource.ToReturnedResource()); |
604 EXPECT_CALL(mock_client, DidReceiveCompositorFrameAck(returned_resources)) | 606 EXPECT_CALL(mock_client, DidReceiveCompositorFrameAck(returned_resources)) |
605 .Times(1); | 607 .Times(1); |
606 manager_.SatisfySequence(SurfaceSequence(kYetAnotherArbitraryFrameSinkId, 4)); | 608 manager_.SatisfySequence(SurfaceSequence(kYetAnotherArbitraryFrameSinkId, 4)); |
607 EXPECT_FALSE(manager_.GetSurfaceForId(surface_id)); | 609 EXPECT_FALSE(manager_.GetSurfaceForId(surface_id)); |
608 } | 610 } |
609 | 611 |
610 TEST_F(CompositorFrameSinkSupportTest, DestroySequence) { | 612 TEST_F(CompositorFrameSinkSupportTest, DestroySequence) { |
611 LocalSurfaceId local_surface_id2(5, kArbitraryToken); | 613 LocalSurfaceId local_surface_id2(5, kArbitraryToken); |
612 std::unique_ptr<CompositorFrameSinkSupport> support2 = | 614 std::unique_ptr<CompositorFrameSinkSupport> support2 = |
613 CompositorFrameSinkSupport::Create( | 615 CompositorFrameSinkSupport::Create( |
614 &fake_support_client_, &manager_, kYetAnotherArbitraryFrameSinkId, | 616 &fake_support_client_, &manager_, kYetAnotherArbitraryFrameSinkId, |
615 kIsChildRoot, kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); | 617 kIsChildRoot, kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); |
616 SurfaceId id2(kYetAnotherArbitraryFrameSinkId, local_surface_id2); | 618 SurfaceId id2(kYetAnotherArbitraryFrameSinkId, local_surface_id2); |
617 support2->SubmitCompositorFrame(local_surface_id2, MakeCompositorFrame()); | 619 support2->SubmitCompositorFrame(local_surface_id2, MakeCompositorFrame()); |
618 | 620 |
619 // Check that waiting before the sequence is satisfied works. | 621 // Check that waiting before the sequence is satisfied works. |
620 manager_.GetSurfaceForId(id2)->AddDestructionDependency( | 622 manager_.GetSurfaceForId(id2)->AddDestructionDependency( |
621 SurfaceSequence(kYetAnotherArbitraryFrameSinkId, 4)); | 623 SurfaceSequence(kYetAnotherArbitraryFrameSinkId, 4)); |
622 support2->EvictFrame(); | 624 support2->EvictCurrentSurface(); |
623 | 625 |
624 DCHECK(manager_.GetSurfaceForId(id2)); | 626 DCHECK(manager_.GetSurfaceForId(id2)); |
625 manager_.SatisfySequence(SurfaceSequence(kYetAnotherArbitraryFrameSinkId, 4)); | 627 manager_.SatisfySequence(SurfaceSequence(kYetAnotherArbitraryFrameSinkId, 4)); |
626 manager_.SatisfySequence(SurfaceSequence(kYetAnotherArbitraryFrameSinkId, 6)); | 628 manager_.SatisfySequence(SurfaceSequence(kYetAnotherArbitraryFrameSinkId, 6)); |
627 DCHECK(!manager_.GetSurfaceForId(id2)); | 629 DCHECK(!manager_.GetSurfaceForId(id2)); |
628 | 630 |
629 // Check that waiting after the sequence is satisfied works. | 631 // Check that waiting after the sequence is satisfied works. |
630 support2->SubmitCompositorFrame(local_surface_id2, MakeCompositorFrame()); | 632 support2->SubmitCompositorFrame(local_surface_id2, MakeCompositorFrame()); |
631 DCHECK(manager_.GetSurfaceForId(id2)); | 633 DCHECK(manager_.GetSurfaceForId(id2)); |
632 manager_.GetSurfaceForId(id2)->AddDestructionDependency( | 634 manager_.GetSurfaceForId(id2)->AddDestructionDependency( |
633 SurfaceSequence(kAnotherArbitraryFrameSinkId, 6)); | 635 SurfaceSequence(kAnotherArbitraryFrameSinkId, 6)); |
634 support2->EvictFrame(); | 636 support2->EvictCurrentSurface(); |
635 DCHECK(!manager_.GetSurfaceForId(id2)); | 637 DCHECK(!manager_.GetSurfaceForId(id2)); |
636 } | 638 } |
637 | 639 |
638 // Tests that Surface ID namespace invalidation correctly allows | 640 // Tests that Surface ID namespace invalidation correctly allows |
639 // Sequences to be ignored. | 641 // Sequences to be ignored. |
640 TEST_F(CompositorFrameSinkSupportTest, InvalidFrameSinkId) { | 642 TEST_F(CompositorFrameSinkSupportTest, InvalidFrameSinkId) { |
641 FrameSinkId frame_sink_id(1234, 5678); | 643 FrameSinkId frame_sink_id(1234, 5678); |
642 | 644 |
643 LocalSurfaceId local_surface_id(5, kArbitraryToken); | 645 LocalSurfaceId local_surface_id(5, kArbitraryToken); |
644 SurfaceId id(support_->frame_sink_id(), local_surface_id); | 646 SurfaceId id(support_->frame_sink_id(), local_surface_id); |
645 support_->SubmitCompositorFrame(local_surface_id, MakeCompositorFrame()); | 647 support_->SubmitCompositorFrame(local_surface_id, MakeCompositorFrame()); |
646 | 648 |
647 manager_.RegisterFrameSinkId(frame_sink_id); | 649 manager_.RegisterFrameSinkId(frame_sink_id); |
648 manager_.GetSurfaceForId(id)->AddDestructionDependency( | 650 manager_.GetSurfaceForId(id)->AddDestructionDependency( |
649 SurfaceSequence(frame_sink_id, 4)); | 651 SurfaceSequence(frame_sink_id, 4)); |
650 | 652 |
651 support_->EvictFrame(); | 653 support_->EvictCurrentSurface(); |
652 | 654 |
653 // Verify the dependency has prevented the surface from getting destroyed. | 655 // Verify the dependency has prevented the surface from getting destroyed. |
654 EXPECT_TRUE(manager_.GetSurfaceForId(id)); | 656 EXPECT_TRUE(manager_.GetSurfaceForId(id)); |
655 | 657 |
656 manager_.InvalidateFrameSinkId(frame_sink_id); | 658 manager_.InvalidateFrameSinkId(frame_sink_id); |
657 | 659 |
658 // Verify that the invalidated namespace caused the unsatisfied sequence | 660 // Verify that the invalidated namespace caused the unsatisfied sequence |
659 // to be ignored. | 661 // to be ignored. |
660 EXPECT_FALSE(manager_.GetSurfaceForId(id)); | 662 EXPECT_FALSE(manager_.GetSurfaceForId(id)); |
661 } | 663 } |
(...skipping 11 matching lines...) Expand all Loading... |
673 std::unique_ptr<RenderPass> render_pass(RenderPass::Create()); | 675 std::unique_ptr<RenderPass> render_pass(RenderPass::Create()); |
674 CompositorFrame frame = MakeCompositorFrame(); | 676 CompositorFrame frame = MakeCompositorFrame(); |
675 frame.render_pass_list.push_back(std::move(render_pass)); | 677 frame.render_pass_list.push_back(std::move(render_pass)); |
676 frame.metadata.referenced_surfaces.push_back( | 678 frame.metadata.referenced_surfaces.push_back( |
677 SurfaceId(support_->frame_sink_id(), local_surface_id_)); | 679 SurfaceId(support_->frame_sink_id(), local_surface_id_)); |
678 support2->SubmitCompositorFrame(local_surface_id2, std::move(frame)); | 680 support2->SubmitCompositorFrame(local_surface_id2, std::move(frame)); |
679 EXPECT_EQ(last_created_surface_id().local_surface_id(), local_surface_id2); | 681 EXPECT_EQ(last_created_surface_id().local_surface_id(), local_surface_id2); |
680 } | 682 } |
681 manager_.GetSurfaceForId(id2)->AddDestructionDependency( | 683 manager_.GetSurfaceForId(id2)->AddDestructionDependency( |
682 SurfaceSequence(kAnotherArbitraryFrameSinkId, 4)); | 684 SurfaceSequence(kAnotherArbitraryFrameSinkId, 4)); |
683 support2->EvictFrame(); | 685 support2->EvictCurrentSurface(); |
684 // Give local_surface_id_ a frame that references id2. | 686 // Give local_surface_id_ a frame that references id2. |
685 { | 687 { |
686 std::unique_ptr<RenderPass> render_pass(RenderPass::Create()); | 688 std::unique_ptr<RenderPass> render_pass(RenderPass::Create()); |
687 CompositorFrame frame = MakeCompositorFrame(); | 689 CompositorFrame frame = MakeCompositorFrame(); |
688 frame.render_pass_list.push_back(std::move(render_pass)); | 690 frame.render_pass_list.push_back(std::move(render_pass)); |
689 frame.metadata.referenced_surfaces.push_back(id2); | 691 frame.metadata.referenced_surfaces.push_back(id2); |
690 support_->SubmitCompositorFrame(local_surface_id_, std::move(frame)); | 692 support_->SubmitCompositorFrame(local_surface_id_, std::move(frame)); |
691 } | 693 } |
692 support_->EvictFrame(); | 694 support_->EvictCurrentSurface(); |
693 EXPECT_TRUE(manager_.GetSurfaceForId(id2)); | 695 EXPECT_TRUE(manager_.GetSurfaceForId(id2)); |
694 // local_surface_id_ should be retained by reference from id2. | 696 // local_surface_id_ should be retained by reference from id2. |
695 EXPECT_TRUE(manager_.GetSurfaceForId( | 697 EXPECT_TRUE(manager_.GetSurfaceForId( |
696 SurfaceId(support_->frame_sink_id(), local_surface_id_))); | 698 SurfaceId(support_->frame_sink_id(), local_surface_id_))); |
697 | 699 |
698 // Satisfy last destruction dependency for id2. | 700 // Satisfy last destruction dependency for id2. |
699 manager_.SatisfySequence(SurfaceSequence(kAnotherArbitraryFrameSinkId, 4)); | 701 manager_.SatisfySequence(SurfaceSequence(kAnotherArbitraryFrameSinkId, 4)); |
700 | 702 |
701 // id2 and local_surface_id_ are in a reference cycle that has no surface | 703 // id2 and local_surface_id_ are in a reference cycle that has no surface |
702 // sequences holding on to it, so they should be destroyed. | 704 // sequences holding on to it, so they should be destroyed. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 request = CopyOutputRequest::CreateRequest( | 748 request = CopyOutputRequest::CreateRequest( |
747 base::Bind(&CopyRequestTestCallback, &called3)); | 749 base::Bind(&CopyRequestTestCallback, &called3)); |
748 request->set_source(kArbitrarySourceId1); | 750 request->set_source(kArbitrarySourceId1); |
749 | 751 |
750 support_->RequestCopyOfSurface(std::move(request)); | 752 support_->RequestCopyOfSurface(std::move(request)); |
751 // Two callbacks are from source1, so the first should be called. | 753 // Two callbacks are from source1, so the first should be called. |
752 EXPECT_TRUE(called1); | 754 EXPECT_TRUE(called1); |
753 EXPECT_FALSE(called2); | 755 EXPECT_FALSE(called2); |
754 EXPECT_FALSE(called3); | 756 EXPECT_FALSE(called3); |
755 | 757 |
756 support_->EvictFrame(); | 758 support_->EvictCurrentSurface(); |
757 local_surface_id_ = LocalSurfaceId(); | 759 local_surface_id_ = LocalSurfaceId(); |
758 EXPECT_TRUE(called1); | 760 EXPECT_TRUE(called1); |
759 EXPECT_TRUE(called2); | 761 EXPECT_TRUE(called2); |
760 EXPECT_TRUE(called3); | 762 EXPECT_TRUE(called3); |
761 } | 763 } |
762 | 764 |
763 // Check whether the SurfaceInfo object is created and populated correctly | 765 // Check whether the SurfaceInfo object is created and populated correctly |
764 // after the frame submission. | 766 // after the frame submission. |
765 TEST_F(CompositorFrameSinkSupportTest, SurfaceInfo) { | 767 TEST_F(CompositorFrameSinkSupportTest, SurfaceInfo) { |
766 CompositorFrame frame = MakeCompositorFrame(); | 768 CompositorFrame frame = MakeCompositorFrame(); |
(...skipping 13 matching lines...) Expand all Loading... |
780 EXPECT_EQ(expected_surface_id, last_surface_info_.id()); | 782 EXPECT_EQ(expected_surface_id, last_surface_info_.id()); |
781 EXPECT_EQ(2.5f, last_surface_info_.device_scale_factor()); | 783 EXPECT_EQ(2.5f, last_surface_info_.device_scale_factor()); |
782 EXPECT_EQ(gfx::Size(7, 8), last_surface_info_.size_in_pixels()); | 784 EXPECT_EQ(gfx::Size(7, 8), last_surface_info_.size_in_pixels()); |
783 } | 785 } |
784 | 786 |
785 } // namespace | 787 } // namespace |
786 | 788 |
787 } // namespace test | 789 } // namespace test |
788 | 790 |
789 } // namespace cc | 791 } // namespace cc |
OLD | NEW |