| 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/output/compositor_frame.h" | 5 #include "cc/output/compositor_frame.h" |
| 6 #include "cc/output/delegated_frame_data.h" | 6 #include "cc/output/delegated_frame_data.h" |
| 7 #include "cc/quads/render_pass.h" | 7 #include "cc/quads/render_pass.h" |
| 8 #include "cc/quads/render_pass_draw_quad.h" | 8 #include "cc/quads/render_pass_draw_quad.h" |
| 9 #include "cc/quads/solid_color_draw_quad.h" | 9 #include "cc/quads/solid_color_draw_quad.h" |
| 10 #include "cc/quads/surface_draw_quad.h" | 10 #include "cc/quads/surface_draw_quad.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 SurfaceId surface_id) { | 111 SurfaceId surface_id) { |
| 112 RenderPassList pass_list; | 112 RenderPassList pass_list; |
| 113 AddPasses(&pass_list, gfx::Rect(SurfaceSize()), passes, pass_count); | 113 AddPasses(&pass_list, gfx::Rect(SurfaceSize()), passes, pass_count); |
| 114 | 114 |
| 115 scoped_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData); | 115 scoped_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData); |
| 116 pass_list.swap(frame_data->render_pass_list); | 116 pass_list.swap(frame_data->render_pass_list); |
| 117 | 117 |
| 118 scoped_ptr<CompositorFrame> frame(new CompositorFrame); | 118 scoped_ptr<CompositorFrame> frame(new CompositorFrame); |
| 119 frame->delegated_frame_data = frame_data.Pass(); | 119 frame->delegated_frame_data = frame_data.Pass(); |
| 120 | 120 |
| 121 factory_.SubmitFrame(surface_id, frame.Pass()); | 121 factory_.SubmitFrame(surface_id, frame.Pass(), base::Closure()); |
| 122 } | 122 } |
| 123 | 123 |
| 124 void QueuePassAsFrame(scoped_ptr<RenderPass> pass, SurfaceId surface_id) { | 124 void QueuePassAsFrame(scoped_ptr<RenderPass> pass, SurfaceId surface_id) { |
| 125 scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData); | 125 scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData); |
| 126 delegated_frame_data->render_pass_list.push_back(pass.Pass()); | 126 delegated_frame_data->render_pass_list.push_back(pass.Pass()); |
| 127 | 127 |
| 128 scoped_ptr<CompositorFrame> child_frame(new CompositorFrame); | 128 scoped_ptr<CompositorFrame> child_frame(new CompositorFrame); |
| 129 child_frame->delegated_frame_data = delegated_frame_data.Pass(); | 129 child_frame->delegated_frame_data = delegated_frame_data.Pass(); |
| 130 | 130 |
| 131 factory_.SubmitFrame(surface_id, child_frame.Pass()); | 131 factory_.SubmitFrame(surface_id, child_frame.Pass(), base::Closure()); |
| 132 } | 132 } |
| 133 | 133 |
| 134 protected: | 134 protected: |
| 135 SurfaceId root_surface_id_; | 135 SurfaceId root_surface_id_; |
| 136 SurfaceIdAllocator allocator_; | 136 SurfaceIdAllocator allocator_; |
| 137 }; | 137 }; |
| 138 | 138 |
| 139 // Tests that a very simple frame containing only two solid color quads makes it | 139 // Tests that a very simple frame containing only two solid color quads makes it |
| 140 // through the aggregator correctly. | 140 // through the aggregator correctly. |
| 141 TEST_F(SurfaceAggregatorValidSurfaceTest, SimpleFrame) { | 141 TEST_F(SurfaceAggregatorValidSurfaceTest, SimpleFrame) { |
| (...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 child_root_pass_sqs->content_to_target_transform.Translate(8, 0); | 694 child_root_pass_sqs->content_to_target_transform.Translate(8, 0); |
| 695 child_root_pass_sqs->is_clipped = true; | 695 child_root_pass_sqs->is_clipped = true; |
| 696 child_root_pass_sqs->clip_rect = gfx::Rect(0, 0, 5, 5); | 696 child_root_pass_sqs->clip_rect = gfx::Rect(0, 0, 5, 5); |
| 697 | 697 |
| 698 scoped_ptr<DelegatedFrameData> child_frame_data(new DelegatedFrameData); | 698 scoped_ptr<DelegatedFrameData> child_frame_data(new DelegatedFrameData); |
| 699 child_pass_list.swap(child_frame_data->render_pass_list); | 699 child_pass_list.swap(child_frame_data->render_pass_list); |
| 700 | 700 |
| 701 scoped_ptr<CompositorFrame> child_frame(new CompositorFrame); | 701 scoped_ptr<CompositorFrame> child_frame(new CompositorFrame); |
| 702 child_frame->delegated_frame_data = child_frame_data.Pass(); | 702 child_frame->delegated_frame_data = child_frame_data.Pass(); |
| 703 | 703 |
| 704 factory_.SubmitFrame(child_surface_id, child_frame.Pass()); | 704 factory_.SubmitFrame(child_surface_id, child_frame.Pass(), base::Closure()); |
| 705 | 705 |
| 706 test::Quad root_quads[] = {test::Quad::SolidColorQuad(1), | 706 test::Quad root_quads[] = {test::Quad::SolidColorQuad(1), |
| 707 test::Quad::SurfaceQuad(child_surface_id)}; | 707 test::Quad::SurfaceQuad(child_surface_id)}; |
| 708 test::Pass root_passes[] = {test::Pass(root_quads, arraysize(root_quads))}; | 708 test::Pass root_passes[] = {test::Pass(root_quads, arraysize(root_quads))}; |
| 709 | 709 |
| 710 RenderPassList root_pass_list; | 710 RenderPassList root_pass_list; |
| 711 AddPasses(&root_pass_list, | 711 AddPasses(&root_pass_list, |
| 712 gfx::Rect(SurfaceSize()), | 712 gfx::Rect(SurfaceSize()), |
| 713 root_passes, | 713 root_passes, |
| 714 arraysize(root_passes)); | 714 arraysize(root_passes)); |
| 715 | 715 |
| 716 root_pass_list.at(0) | 716 root_pass_list.at(0) |
| 717 ->shared_quad_state_list[0] | 717 ->shared_quad_state_list[0] |
| 718 ->content_to_target_transform.Translate(0, 7); | 718 ->content_to_target_transform.Translate(0, 7); |
| 719 root_pass_list.at(0) | 719 root_pass_list.at(0) |
| 720 ->shared_quad_state_list[1] | 720 ->shared_quad_state_list[1] |
| 721 ->content_to_target_transform.Translate(0, 10); | 721 ->content_to_target_transform.Translate(0, 10); |
| 722 | 722 |
| 723 scoped_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData); | 723 scoped_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData); |
| 724 root_pass_list.swap(root_frame_data->render_pass_list); | 724 root_pass_list.swap(root_frame_data->render_pass_list); |
| 725 | 725 |
| 726 scoped_ptr<CompositorFrame> root_frame(new CompositorFrame); | 726 scoped_ptr<CompositorFrame> root_frame(new CompositorFrame); |
| 727 root_frame->delegated_frame_data = root_frame_data.Pass(); | 727 root_frame->delegated_frame_data = root_frame_data.Pass(); |
| 728 | 728 |
| 729 factory_.SubmitFrame(root_surface_id_, root_frame.Pass()); | 729 factory_.SubmitFrame(root_surface_id_, root_frame.Pass(), base::Closure()); |
| 730 | 730 |
| 731 std::set<SurfaceId> surface_set; | 731 std::set<SurfaceId> surface_set; |
| 732 scoped_ptr<CompositorFrame> aggregated_frame = | 732 scoped_ptr<CompositorFrame> aggregated_frame = |
| 733 aggregator_.Aggregate(root_surface_id_, &surface_set); | 733 aggregator_.Aggregate(root_surface_id_, &surface_set); |
| 734 | 734 |
| 735 ASSERT_TRUE(aggregated_frame); | 735 ASSERT_TRUE(aggregated_frame); |
| 736 ASSERT_TRUE(aggregated_frame->delegated_frame_data); | 736 ASSERT_TRUE(aggregated_frame->delegated_frame_data); |
| 737 | 737 |
| 738 DelegatedFrameData* frame_data = aggregated_frame->delegated_frame_data.get(); | 738 DelegatedFrameData* frame_data = aggregated_frame->delegated_frame_data.get(); |
| 739 | 739 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 uv_bottom_right, | 881 uv_bottom_right, |
| 882 background_color, | 882 background_color, |
| 883 vertex_opacity, | 883 vertex_opacity, |
| 884 flipped); | 884 flipped); |
| 885 | 885 |
| 886 quad->shared_quad_state = sqs; | 886 quad->shared_quad_state = sqs; |
| 887 } | 887 } |
| 888 frame_data->render_pass_list.push_back(pass.Pass()); | 888 frame_data->render_pass_list.push_back(pass.Pass()); |
| 889 scoped_ptr<CompositorFrame> frame(new CompositorFrame); | 889 scoped_ptr<CompositorFrame> frame(new CompositorFrame); |
| 890 frame->delegated_frame_data = frame_data.Pass(); | 890 frame->delegated_frame_data = frame_data.Pass(); |
| 891 factory->SubmitFrame(surface_id, frame.Pass()); | 891 factory->SubmitFrame(surface_id, frame.Pass(), base::Closure()); |
| 892 } | 892 } |
| 893 | 893 |
| 894 TEST_F(SurfaceAggregatorWithResourcesTest, TakeResourcesOneSurface) { | 894 TEST_F(SurfaceAggregatorWithResourcesTest, TakeResourcesOneSurface) { |
| 895 ResourceTrackingSurfaceFactoryClient client; | 895 ResourceTrackingSurfaceFactoryClient client; |
| 896 SurfaceFactory factory(&manager_, &client); | 896 SurfaceFactory factory(&manager_, &client); |
| 897 SurfaceId surface_id(7u); | 897 SurfaceId surface_id(7u); |
| 898 factory.Create(surface_id, SurfaceSize()); | 898 factory.Create(surface_id, SurfaceSize()); |
| 899 | 899 |
| 900 ResourceProvider::ResourceId ids[] = {11, 12, 13}; | 900 ResourceProvider::ResourceId ids[] = {11, 12, 13}; |
| 901 SubmitFrameWithResources(ids, arraysize(ids), &factory, surface_id); | 901 SubmitFrameWithResources(ids, arraysize(ids), &factory, surface_id); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 918 returned_ids[i] = client.returned_resources()[i].id; | 918 returned_ids[i] = client.returned_resources()[i].id; |
| 919 } | 919 } |
| 920 EXPECT_THAT(returned_ids, | 920 EXPECT_THAT(returned_ids, |
| 921 testing::WhenSorted(testing::ElementsAreArray(ids))); | 921 testing::WhenSorted(testing::ElementsAreArray(ids))); |
| 922 factory.Destroy(surface_id); | 922 factory.Destroy(surface_id); |
| 923 } | 923 } |
| 924 | 924 |
| 925 } // namespace | 925 } // namespace |
| 926 } // namespace cc | 926 } // namespace cc |
| 927 | 927 |
| OLD | NEW |