| 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/test/layer_tree_pixel_resource_test.h" | 5 #include "cc/test/layer_tree_pixel_resource_test.h" |
| 6 | 6 |
| 7 #include "cc/layers/layer.h" | 7 #include "cc/layers/layer.h" |
| 8 #include "cc/resources/bitmap_tile_task_worker_pool.h" | 8 #include "cc/resources/bitmap_tile_task_worker_pool.h" |
| 9 #include "cc/resources/gpu_tile_task_worker_pool.h" | 9 #include "cc/resources/gpu_tile_task_worker_pool.h" |
| 10 #include "cc/resources/one_copy_tile_task_worker_pool.h" | 10 #include "cc/resources/one_copy_tile_task_worker_pool.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 return false; | 40 return false; |
| 41 } | 41 } |
| 42 | 42 |
| 43 } // namespace | 43 } // namespace |
| 44 | 44 |
| 45 LayerTreeHostPixelResourceTest::LayerTreeHostPixelResourceTest( | 45 LayerTreeHostPixelResourceTest::LayerTreeHostPixelResourceTest( |
| 46 PixelResourceTestCase test_case) | 46 PixelResourceTestCase test_case) |
| 47 : staging_texture_target_(GL_INVALID_VALUE), | 47 : staging_texture_target_(GL_INVALID_VALUE), |
| 48 draw_texture_target_(GL_INVALID_VALUE), | 48 draw_texture_target_(GL_INVALID_VALUE), |
| 49 resource_pool_option_(BITMAP_TILE_TASK_WORKER_POOL), | 49 resource_pool_option_(BITMAP_TILE_TASK_WORKER_POOL), |
| 50 initialized_(false), |
| 50 test_case_(test_case) { | 51 test_case_(test_case) { |
| 51 InitializeFromTestCase(test_case); | 52 InitializeFromTestCase(test_case); |
| 52 } | 53 } |
| 53 | 54 |
| 55 LayerTreeHostPixelResourceTest::LayerTreeHostPixelResourceTest() |
| 56 : staging_texture_target_(GL_INVALID_VALUE), |
| 57 draw_texture_target_(GL_INVALID_VALUE), |
| 58 resource_pool_option_(BITMAP_TILE_TASK_WORKER_POOL), |
| 59 initialized_(false), |
| 60 test_case_(SOFTWARE) { |
| 61 } |
| 62 |
| 54 void LayerTreeHostPixelResourceTest::InitializeFromTestCase( | 63 void LayerTreeHostPixelResourceTest::InitializeFromTestCase( |
| 55 PixelResourceTestCase test_case) { | 64 PixelResourceTestCase test_case) { |
| 65 DCHECK(!initialized_); |
| 66 initialized_ = true; |
| 56 switch (test_case) { | 67 switch (test_case) { |
| 57 case SOFTWARE: | 68 case SOFTWARE: |
| 58 test_type_ = PIXEL_TEST_SOFTWARE; | 69 test_type_ = PIXEL_TEST_SOFTWARE; |
| 59 staging_texture_target_ = GL_INVALID_VALUE; | 70 staging_texture_target_ = GL_INVALID_VALUE; |
| 60 draw_texture_target_ = GL_INVALID_VALUE; | 71 draw_texture_target_ = GL_INVALID_VALUE; |
| 61 resource_pool_option_ = BITMAP_TILE_TASK_WORKER_POOL; | 72 resource_pool_option_ = BITMAP_TILE_TASK_WORKER_POOL; |
| 62 return; | 73 return; |
| 63 case GL_GPU_RASTER_2D_DRAW: | 74 case GL_GPU_RASTER_2D_DRAW: |
| 64 test_type_ = PIXEL_TEST_GL; | 75 test_type_ = PIXEL_TEST_GL; |
| 65 staging_texture_target_ = GL_INVALID_VALUE; | 76 staging_texture_target_ = GL_INVALID_VALUE; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 125 |
| 115 void LayerTreeHostPixelResourceTest::CreateResourceAndTileTaskWorkerPool( | 126 void LayerTreeHostPixelResourceTest::CreateResourceAndTileTaskWorkerPool( |
| 116 LayerTreeHostImpl* host_impl, | 127 LayerTreeHostImpl* host_impl, |
| 117 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, | 128 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, |
| 118 scoped_ptr<ResourcePool>* resource_pool, | 129 scoped_ptr<ResourcePool>* resource_pool, |
| 119 scoped_ptr<ResourcePool>* staging_resource_pool) { | 130 scoped_ptr<ResourcePool>* staging_resource_pool) { |
| 120 base::SingleThreadTaskRunner* task_runner = | 131 base::SingleThreadTaskRunner* task_runner = |
| 121 proxy()->HasImplThread() ? proxy()->ImplThreadTaskRunner() | 132 proxy()->HasImplThread() ? proxy()->ImplThreadTaskRunner() |
| 122 : proxy()->MainThreadTaskRunner(); | 133 : proxy()->MainThreadTaskRunner(); |
| 123 DCHECK(task_runner); | 134 DCHECK(task_runner); |
| 135 DCHECK(initialized_); |
| 124 | 136 |
| 125 ContextProvider* context_provider = | 137 ContextProvider* context_provider = |
| 126 host_impl->output_surface()->context_provider(); | 138 host_impl->output_surface()->context_provider(); |
| 127 ResourceProvider* resource_provider = host_impl->resource_provider(); | 139 ResourceProvider* resource_provider = host_impl->resource_provider(); |
| 128 bool use_distance_field_text = false; | 140 bool use_distance_field_text = false; |
| 129 size_t max_transfer_buffer_usage_bytes = 1024u * 1024u * 60u; | 141 size_t max_transfer_buffer_usage_bytes = 1024u * 1024u * 60u; |
| 130 | 142 |
| 131 switch (resource_pool_option_) { | 143 switch (resource_pool_option_) { |
| 132 case BITMAP_TILE_TASK_WORKER_POOL: | 144 case BITMAP_TILE_TASK_WORKER_POOL: |
| 133 EXPECT_FALSE(context_provider); | 145 EXPECT_FALSE(context_provider); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 if (!IsTestCaseSupported(test_case_)) | 217 if (!IsTestCaseSupported(test_case_)) |
| 206 return; | 218 return; |
| 207 RunPixelTest(test_type_, content_root, file_name); | 219 RunPixelTest(test_type_, content_root, file_name); |
| 208 } | 220 } |
| 209 | 221 |
| 210 ParameterizedPixelResourceTest::ParameterizedPixelResourceTest() | 222 ParameterizedPixelResourceTest::ParameterizedPixelResourceTest() |
| 211 : LayerTreeHostPixelResourceTest(GetParam()) { | 223 : LayerTreeHostPixelResourceTest(GetParam()) { |
| 212 } | 224 } |
| 213 | 225 |
| 214 } // namespace cc | 226 } // namespace cc |
| OLD | NEW |