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 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 | 519 |
520 manager_.RegisterFrameSinkId(kArbitraryFrameSinkId); | 520 manager_.RegisterFrameSinkId(kArbitraryFrameSinkId); |
521 | 521 |
522 // Check that waiting before the sequence is satisfied works. | 522 // Check that waiting before the sequence is satisfied works. |
523 manager_.GetSurfaceForId(id2)->AddDestructionDependency( | 523 manager_.GetSurfaceForId(id2)->AddDestructionDependency( |
524 SurfaceSequence(kArbitraryFrameSinkId, 4)); | 524 SurfaceSequence(kArbitraryFrameSinkId, 4)); |
525 factory2->EvictSurface(); | 525 factory2->EvictSurface(); |
526 | 526 |
527 CompositorFrame frame; | 527 CompositorFrame frame; |
528 DCHECK(manager_.GetSurfaceForId(id2)); | 528 DCHECK(manager_.GetSurfaceForId(id2)); |
529 std::vector<uint32_t> sequences = {4, 6}; | 529 manager_.SatisfySequence(SurfaceSequence(kArbitraryFrameSinkId, 4)); |
530 manager_.DidSatisfySequences(kArbitraryFrameSinkId, &sequences); | 530 manager_.SatisfySequence(SurfaceSequence(kArbitraryFrameSinkId, 6)); |
531 DCHECK(!manager_.GetSurfaceForId(id2)); | 531 DCHECK(!manager_.GetSurfaceForId(id2)); |
532 | 532 |
533 // Check that waiting after the sequence is satisfied works. | 533 // Check that waiting after the sequence is satisfied works. |
534 factory2->SubmitCompositorFrame(local_frame_id2, CompositorFrame(), | 534 factory2->SubmitCompositorFrame(local_frame_id2, CompositorFrame(), |
535 SurfaceFactory::DrawCallback()); | 535 SurfaceFactory::DrawCallback()); |
536 DCHECK(manager_.GetSurfaceForId(id2)); | 536 DCHECK(manager_.GetSurfaceForId(id2)); |
537 manager_.GetSurfaceForId(id2)->AddDestructionDependency( | 537 manager_.GetSurfaceForId(id2)->AddDestructionDependency( |
538 SurfaceSequence(kAnotherArbitraryFrameSinkId, 6)); | 538 SurfaceSequence(kAnotherArbitraryFrameSinkId, 6)); |
539 factory2->EvictSurface(); | 539 factory2->EvictSurface(); |
540 DCHECK(!manager_.GetSurfaceForId(id2)); | 540 DCHECK(!manager_.GetSurfaceForId(id2)); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 factory_->SubmitCompositorFrame(local_frame_id_, std::move(frame), | 595 factory_->SubmitCompositorFrame(local_frame_id_, std::move(frame), |
596 SurfaceFactory::DrawCallback()); | 596 SurfaceFactory::DrawCallback()); |
597 } | 597 } |
598 factory_->EvictSurface(); | 598 factory_->EvictSurface(); |
599 EXPECT_TRUE(manager_.GetSurfaceForId(id2)); | 599 EXPECT_TRUE(manager_.GetSurfaceForId(id2)); |
600 // local_frame_id_ should be retained by reference from id2. | 600 // local_frame_id_ should be retained by reference from id2. |
601 EXPECT_TRUE(manager_.GetSurfaceForId( | 601 EXPECT_TRUE(manager_.GetSurfaceForId( |
602 SurfaceId(factory_->frame_sink_id(), local_frame_id_))); | 602 SurfaceId(factory_->frame_sink_id(), local_frame_id_))); |
603 | 603 |
604 // Satisfy last destruction dependency for id2. | 604 // Satisfy last destruction dependency for id2. |
605 std::vector<uint32_t> to_satisfy; | 605 manager_.SatisfySequence(SurfaceSequence(kAnotherArbitraryFrameSinkId, 4)); |
606 to_satisfy.push_back(4); | |
607 manager_.DidSatisfySequences(kAnotherArbitraryFrameSinkId, &to_satisfy); | |
608 | 606 |
609 // id2 and local_frame_id_ are in a reference cycle that has no surface | 607 // id2 and local_frame_id_ are in a reference cycle that has no surface |
610 // sequences holding on to it, so they should be destroyed. | 608 // sequences holding on to it, so they should be destroyed. |
611 EXPECT_TRUE(!manager_.GetSurfaceForId(id2)); | 609 EXPECT_TRUE(!manager_.GetSurfaceForId(id2)); |
612 EXPECT_TRUE(!manager_.GetSurfaceForId( | 610 EXPECT_TRUE(!manager_.GetSurfaceForId( |
613 SurfaceId(factory_->frame_sink_id(), local_frame_id_))); | 611 SurfaceId(factory_->frame_sink_id(), local_frame_id_))); |
614 | 612 |
615 local_frame_id_ = LocalFrameId(); | 613 local_frame_id_ = LocalFrameId(); |
616 } | 614 } |
617 | 615 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 | 664 |
667 factory_->EvictSurface(); | 665 factory_->EvictSurface(); |
668 local_frame_id_ = LocalFrameId(); | 666 local_frame_id_ = LocalFrameId(); |
669 EXPECT_TRUE(called1); | 667 EXPECT_TRUE(called1); |
670 EXPECT_TRUE(called2); | 668 EXPECT_TRUE(called2); |
671 EXPECT_TRUE(called3); | 669 EXPECT_TRUE(called3); |
672 } | 670 } |
673 | 671 |
674 } // namespace | 672 } // namespace |
675 } // namespace cc | 673 } // namespace cc |
OLD | NEW |