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/resources/raster_worker_pool.h" | 5 #include "cc/resources/raster_worker_pool.h" |
6 | 6 |
7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
8 #include "cc/output/context_provider.h" | 8 #include "cc/output/context_provider.h" |
9 #include "cc/resources/direct_raster_worker_pool.h" | 9 #include "cc/resources/direct_raster_worker_pool.h" |
10 #include "cc/resources/image_raster_worker_pool.h" | 10 #include "cc/resources/image_raster_worker_pool.h" |
11 #include "cc/resources/pixel_buffer_raster_worker_pool.h" | 11 #include "cc/resources/pixel_buffer_raster_worker_pool.h" |
12 #include "cc/resources/resource_provider.h" | 12 #include "cc/resources/resource_provider.h" |
13 #include "cc/resources/scoped_resource.h" | 13 #include "cc/resources/scoped_resource.h" |
14 #include "cc/test/fake_output_surface.h" | 14 #include "cc/test/fake_output_surface.h" |
15 #include "cc/test/fake_output_surface_client.h" | 15 #include "cc/test/fake_output_surface_client.h" |
16 #include "cc/test/lap_timer.h" | 16 #include "cc/test/lap_timer.h" |
17 #include "cc/test/test_context_support.h" | 17 #include "cc/test/test_context_support.h" |
| 18 #include "cc/test/test_shared_bitmap_manager.h" |
18 #include "cc/test/test_web_graphics_context_3d.h" | 19 #include "cc/test/test_web_graphics_context_3d.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
20 #include "testing/perf/perf_test.h" | 21 #include "testing/perf/perf_test.h" |
21 #include "third_party/khronos/GLES2/gl2.h" | 22 #include "third_party/khronos/GLES2/gl2.h" |
22 | 23 |
23 namespace cc { | 24 namespace cc { |
24 namespace { | 25 namespace { |
25 | 26 |
26 class PerfContextProvider : public ContextProvider { | 27 class PerfContextProvider : public ContextProvider { |
27 public: | 28 public: |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 RasterTaskVector; | 158 RasterTaskVector; |
158 | 159 |
159 RasterWorkerPoolPerfTestBase() | 160 RasterWorkerPoolPerfTestBase() |
160 : context_provider_(make_scoped_refptr(new PerfContextProvider)), | 161 : context_provider_(make_scoped_refptr(new PerfContextProvider)), |
161 timer_(kWarmupRuns, | 162 timer_(kWarmupRuns, |
162 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), | 163 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), |
163 kTimeCheckInterval) { | 164 kTimeCheckInterval) { |
164 output_surface_ = FakeOutputSurface::Create3d(context_provider_).Pass(); | 165 output_surface_ = FakeOutputSurface::Create3d(context_provider_).Pass(); |
165 CHECK(output_surface_->BindToClient(&output_surface_client_)); | 166 CHECK(output_surface_->BindToClient(&output_surface_client_)); |
166 | 167 |
167 resource_provider_ = ResourceProvider::Create( | 168 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); |
168 output_surface_.get(), NULL, 0, false, 1).Pass(); | 169 resource_provider_ = |
| 170 ResourceProvider::Create( |
| 171 output_surface_.get(), shared_bitmap_manager_.get(), 0, false, 1) |
| 172 .Pass(); |
169 } | 173 } |
170 virtual ~RasterWorkerPoolPerfTestBase() { resource_provider_.reset(); } | 174 virtual ~RasterWorkerPoolPerfTestBase() { resource_provider_.reset(); } |
171 | 175 |
172 void CreateImageDecodeTasks( | 176 void CreateImageDecodeTasks( |
173 unsigned num_image_decode_tasks, | 177 unsigned num_image_decode_tasks, |
174 internal::WorkerPoolTask::Vector* image_decode_tasks) { | 178 internal::WorkerPoolTask::Vector* image_decode_tasks) { |
175 for (unsigned i = 0; i < num_image_decode_tasks; ++i) | 179 for (unsigned i = 0; i < num_image_decode_tasks; ++i) |
176 image_decode_tasks->push_back(new PerfWorkerPoolTaskImpl); | 180 image_decode_tasks->push_back(new PerfWorkerPoolTaskImpl); |
177 } | 181 } |
178 | 182 |
(...skipping 21 matching lines...) Expand all Loading... |
200 queue->items.push_back(RasterTaskQueue::Item(raster_tasks[i].get(), | 204 queue->items.push_back(RasterTaskQueue::Item(raster_tasks[i].get(), |
201 required_for_activation)); | 205 required_for_activation)); |
202 queue->required_for_activation_count += required_for_activation; | 206 queue->required_for_activation_count += required_for_activation; |
203 } | 207 } |
204 } | 208 } |
205 | 209 |
206 protected: | 210 protected: |
207 scoped_refptr<ContextProvider> context_provider_; | 211 scoped_refptr<ContextProvider> context_provider_; |
208 FakeOutputSurfaceClient output_surface_client_; | 212 FakeOutputSurfaceClient output_surface_client_; |
209 scoped_ptr<FakeOutputSurface> output_surface_; | 213 scoped_ptr<FakeOutputSurface> output_surface_; |
| 214 scoped_ptr<SharedBitmapManager> shared_bitmap_manager_; |
210 scoped_ptr<ResourceProvider> resource_provider_; | 215 scoped_ptr<ResourceProvider> resource_provider_; |
211 LapTimer timer_; | 216 LapTimer timer_; |
212 }; | 217 }; |
213 | 218 |
214 class RasterWorkerPoolPerfTest | 219 class RasterWorkerPoolPerfTest |
215 : public RasterWorkerPoolPerfTestBase, | 220 : public RasterWorkerPoolPerfTestBase, |
216 public testing::TestWithParam<RasterWorkerPoolType>, | 221 public testing::TestWithParam<RasterWorkerPoolType>, |
217 public RasterWorkerPoolClient { | 222 public RasterWorkerPoolClient { |
218 public: | 223 public: |
219 RasterWorkerPoolPerfTest() | 224 RasterWorkerPoolPerfTest() |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 RunBuildRasterTaskQueueTest("1_0", 1, 0); | 451 RunBuildRasterTaskQueueTest("1_0", 1, 0); |
447 RunBuildRasterTaskQueueTest("32_0", 32, 0); | 452 RunBuildRasterTaskQueueTest("32_0", 32, 0); |
448 RunBuildRasterTaskQueueTest("1_1", 1, 1); | 453 RunBuildRasterTaskQueueTest("1_1", 1, 1); |
449 RunBuildRasterTaskQueueTest("32_1", 32, 1); | 454 RunBuildRasterTaskQueueTest("32_1", 32, 1); |
450 RunBuildRasterTaskQueueTest("1_4", 1, 4); | 455 RunBuildRasterTaskQueueTest("1_4", 1, 4); |
451 RunBuildRasterTaskQueueTest("32_4", 32, 4); | 456 RunBuildRasterTaskQueueTest("32_4", 32, 4); |
452 } | 457 } |
453 | 458 |
454 } // namespace | 459 } // namespace |
455 } // namespace cc | 460 } // namespace cc |
OLD | NEW |