OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/layers/layer_iterator.h" | 5 #include "cc/layers/layer_iterator.h" |
6 #include "cc/output/copy_output_request.h" | 6 #include "cc/output/copy_output_request.h" |
7 #include "cc/output/copy_output_result.h" | 7 #include "cc/output/copy_output_result.h" |
8 #include "cc/test/fake_content_layer_client.h" | 8 #include "cc/test/fake_content_layer_client.h" |
9 #include "cc/test/fake_output_surface.h" | 9 #include "cc/test/fake_output_surface.h" |
10 #include "cc/test/fake_picture_layer.h" | 10 #include "cc/test/fake_picture_layer.h" |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) { | 405 void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) { |
406 EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread()); | 406 EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread()); |
407 EXPECT_EQ(copy_layer_->bounds().ToString(), result->size().ToString()); | 407 EXPECT_EQ(copy_layer_->bounds().ToString(), result->size().ToString()); |
408 EndTest(); | 408 EndTest(); |
409 } | 409 } |
410 | 410 |
411 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { | 411 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { |
412 Renderer* renderer = host_impl->renderer(); | 412 Renderer* renderer = host_impl->renderer(); |
413 | 413 |
414 LayerImpl* root = host_impl->active_tree()->root_layer(); | 414 LayerImpl* root = host_impl->active_tree()->root_layer(); |
415 LayerImpl* grand_parent = root->children()[0]; | 415 LayerImpl* grand_parent = root->children()[0].get(); |
416 LayerImpl* parent = grand_parent->children()[0]; | 416 LayerImpl* parent = grand_parent->children()[0].get(); |
417 LayerImpl* copy_layer = parent->children()[0]; | 417 LayerImpl* copy_layer = parent->children()[0].get(); |
418 | 418 |
419 // |parent| owns a surface, but it was hidden and not part of the copy | 419 // |parent| owns a surface, but it was hidden and not part of the copy |
420 // request so it should not allocate any resource. | 420 // request so it should not allocate any resource. |
421 EXPECT_FALSE(renderer->HasAllocatedResourcesForTesting( | 421 EXPECT_FALSE(renderer->HasAllocatedResourcesForTesting( |
422 parent->render_surface()->GetRenderPassId())); | 422 parent->render_surface()->GetRenderPassId())); |
423 | 423 |
424 // |copy_layer| should have been rendered to a texture since it was needed | 424 // |copy_layer| should have been rendered to a texture since it was needed |
425 // for a copy request. | 425 // for a copy request. |
426 EXPECT_TRUE(renderer->HasAllocatedResourcesForTesting( | 426 EXPECT_TRUE(renderer->HasAllocatedResourcesForTesting( |
427 copy_layer->render_surface()->GetRenderPassId())); | 427 copy_layer->render_surface()->GetRenderPassId())); |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1044 &LayerTreeHostCopyRequestTestMultipleDrawsHiddenCopyRequest:: | 1044 &LayerTreeHostCopyRequestTestMultipleDrawsHiddenCopyRequest:: |
1045 CopyOutputCallback, | 1045 CopyOutputCallback, |
1046 base::Unretained(this)))); | 1046 base::Unretained(this)))); |
1047 } | 1047 } |
1048 } | 1048 } |
1049 | 1049 |
1050 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 1050 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
1051 LayerTreeHostImpl::FrameData* frame_data, | 1051 LayerTreeHostImpl::FrameData* frame_data, |
1052 DrawResult draw_result) override { | 1052 DrawResult draw_result) override { |
1053 LayerImpl* root = host_impl->active_tree()->root_layer(); | 1053 LayerImpl* root = host_impl->active_tree()->root_layer(); |
1054 LayerImpl* child = root->children()[0]; | 1054 LayerImpl* child = root->children()[0].get(); |
1055 | 1055 |
1056 bool saw_root = false; | 1056 bool saw_root = false; |
1057 bool saw_child = false; | 1057 bool saw_child = false; |
1058 for (LayerIterator it = | 1058 for (LayerIterator it = |
1059 LayerIterator::Begin(frame_data->render_surface_layer_list); | 1059 LayerIterator::Begin(frame_data->render_surface_layer_list); |
1060 it != LayerIterator::End(frame_data->render_surface_layer_list); | 1060 it != LayerIterator::End(frame_data->render_surface_layer_list); |
1061 ++it) { | 1061 ++it) { |
1062 if (it.represents_itself()) { | 1062 if (it.represents_itself()) { |
1063 if (*it == root) | 1063 if (*it == root) |
1064 saw_root = true; | 1064 saw_root = true; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1123 int num_draws_; | 1123 int num_draws_; |
1124 bool copy_happened_; | 1124 bool copy_happened_; |
1125 bool draw_happened_; | 1125 bool draw_happened_; |
1126 }; | 1126 }; |
1127 | 1127 |
1128 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( | 1128 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( |
1129 LayerTreeHostCopyRequestTestMultipleDrawsHiddenCopyRequest); | 1129 LayerTreeHostCopyRequestTestMultipleDrawsHiddenCopyRequest); |
1130 | 1130 |
1131 } // namespace | 1131 } // namespace |
1132 } // namespace cc | 1132 } // namespace cc |
OLD | NEW |