| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 display_context_provider_->TestContext3d()->NumTextures(); | 807 display_context_provider_->TestContext3d()->NumTextures(); |
| 808 | 808 |
| 809 // Request a copy of the layer. This will use another texture. | 809 // Request a copy of the layer. This will use another texture. |
| 810 MainThreadTaskRunner()->PostTask( | 810 MainThreadTaskRunner()->PostTask( |
| 811 FROM_HERE, | 811 FROM_HERE, |
| 812 base::Bind( | 812 base::Bind( |
| 813 &LayerTreeHostCopyRequestTestDeleteTexture::InsertCopyRequest, | 813 &LayerTreeHostCopyRequestTestDeleteTexture::InsertCopyRequest, |
| 814 base::Unretained(this))); | 814 base::Unretained(this))); |
| 815 break; | 815 break; |
| 816 case 1: | 816 case 1: |
| 817 // Copy requests cause a followup commit and draw without the separate |
| 818 // RenderPass required. This changes the number of active textures. So |
| 819 // wait for that draw before counting textures and proceeding. |
| 820 break; |
| 821 case 2: |
| 817 // We did a readback, so there will be a readback texture around now. | 822 // We did a readback, so there will be a readback texture around now. |
| 818 num_textures_after_readback_ = | 823 num_textures_after_readback_ = |
| 819 display_context_provider_->TestContext3d()->NumTextures(); | 824 display_context_provider_->TestContext3d()->NumTextures(); |
| 820 EXPECT_LT(num_textures_without_readback_, num_textures_after_readback_); | 825 EXPECT_LT(num_textures_without_readback_, num_textures_after_readback_); |
| 821 | 826 |
| 822 // Now destroy the CopyOutputResult, releasing the texture inside back | 827 // Now destroy the CopyOutputResult, releasing the texture inside back |
| 823 // to the compositor. Then check the resulting number of allocated | 828 // to the compositor. Then check the resulting number of allocated |
| 824 // textures. | 829 // textures. |
| 825 MainThreadTaskRunner()->PostTask( | 830 MainThreadTaskRunner()->PostTask( |
| 826 FROM_HERE, base::Bind(&LayerTreeHostCopyRequestTestDeleteTexture:: | 831 FROM_HERE, base::Bind(&LayerTreeHostCopyRequestTestDeleteTexture:: |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1291 int num_draws_; | 1296 int num_draws_; |
| 1292 bool copy_happened_; | 1297 bool copy_happened_; |
| 1293 bool draw_happened_; | 1298 bool draw_happened_; |
| 1294 }; | 1299 }; |
| 1295 | 1300 |
| 1296 SINGLE_AND_MULTI_THREAD_TEST_F( | 1301 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 1297 LayerTreeHostCopyRequestTestMultipleDrawsHiddenCopyRequest); | 1302 LayerTreeHostCopyRequestTestMultipleDrawsHiddenCopyRequest); |
| 1298 | 1303 |
| 1299 } // namespace | 1304 } // namespace |
| 1300 } // namespace cc | 1305 } // namespace cc |
| OLD | NEW |