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 <limits> | 7 #include <limits> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "cc/debug/test_web_graphics_context_3d.h" | 10 #include "cc/debug/test_web_graphics_context_3d.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 TestRasterWorkerPoolTaskImpl( | 29 TestRasterWorkerPoolTaskImpl( |
30 const Resource* resource, | 30 const Resource* resource, |
31 const Reply& reply, | 31 const Reply& reply, |
32 TaskVector* dependencies) | 32 TaskVector* dependencies) |
33 : internal::RasterWorkerPoolTask(resource, dependencies), | 33 : internal::RasterWorkerPoolTask(resource, dependencies), |
34 reply_(reply), | 34 reply_(reply), |
35 did_raster_(false) {} | 35 did_raster_(false) {} |
36 | 36 |
37 // Overridden from internal::WorkerPoolTask: | 37 // Overridden from internal::WorkerPoolTask: |
38 virtual bool RunOnWorkerThread(SkBaseDevice* device, unsigned thread_index) | 38 virtual bool RunOnWorkerThread(unsigned thread_index, |
39 OVERRIDE { | 39 void* buffer, |
| 40 gfx::Size size, |
| 41 int stride) OVERRIDE { |
40 did_raster_ = true; | 42 did_raster_ = true; |
41 return true; | 43 return true; |
42 } | 44 } |
43 virtual void CompleteOnOriginThread() OVERRIDE { | 45 virtual void CompleteOnOriginThread() OVERRIDE { |
44 reply_.Run(PicturePileImpl::Analysis(), !HasFinishedRunning(), did_raster_); | 46 reply_.Run(PicturePileImpl::Analysis(), !HasFinishedRunning(), did_raster_); |
45 } | 47 } |
46 | 48 |
47 protected: | 49 protected: |
48 virtual ~TestRasterWorkerPoolTaskImpl() {} | 50 virtual ~TestRasterWorkerPoolTaskImpl() {} |
49 | 51 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 99 |
98 RasterWorkerPool* worker_pool() { | 100 RasterWorkerPool* worker_pool() { |
99 return raster_worker_pool_.get(); | 101 return raster_worker_pool_.get(); |
100 } | 102 } |
101 | 103 |
102 void RunTest(bool use_map_image) { | 104 void RunTest(bool use_map_image) { |
103 if (use_map_image) { | 105 if (use_map_image) { |
104 raster_worker_pool_ = ImageRasterWorkerPool::Create( | 106 raster_worker_pool_ = ImageRasterWorkerPool::Create( |
105 resource_provider(), 1); | 107 resource_provider(), 1); |
106 } else { | 108 } else { |
107 raster_worker_pool_ = PixelBufferRasterWorkerPool::Create( | 109 raster_worker_pool_ = |
108 resource_provider(), 1, std::numeric_limits<size_t>::max()); | 110 PixelBufferRasterWorkerPool::Create( |
| 111 resource_provider(), |
| 112 1, |
| 113 std::numeric_limits<size_t>::max(), |
| 114 RGBA_8888); |
109 } | 115 } |
110 | 116 |
111 raster_worker_pool_->SetClient(this); | 117 raster_worker_pool_->SetClient(this); |
112 | 118 |
113 BeginTest(); | 119 BeginTest(); |
114 | 120 |
115 ScheduleCheckForCompletedTasks(); | 121 ScheduleCheckForCompletedTasks(); |
116 | 122 |
117 if (timeout_seconds_) { | 123 if (timeout_seconds_) { |
118 timeout_.Reset(base::Bind(&RasterWorkerPoolTest::OnTimeout, | 124 timeout_.Reset(base::Bind(&RasterWorkerPoolTest::OnTimeout, |
(...skipping 29 matching lines...) Expand all Loading... |
148 tasks.Append(*it, false); | 154 tasks.Append(*it, false); |
149 | 155 |
150 worker_pool()->ScheduleTasks(&tasks); | 156 worker_pool()->ScheduleTasks(&tasks); |
151 } | 157 } |
152 | 158 |
153 void AppendTask(unsigned id) { | 159 void AppendTask(unsigned id) { |
154 const gfx::Size size(1, 1); | 160 const gfx::Size size(1, 1); |
155 | 161 |
156 scoped_ptr<ScopedResource> resource( | 162 scoped_ptr<ScopedResource> resource( |
157 ScopedResource::create(resource_provider())); | 163 ScopedResource::create(resource_provider())); |
158 resource->Allocate(size, GL_RGBA, ResourceProvider::TextureUsageAny); | 164 resource->Allocate(size, ResourceProvider::TextureUsageAny, RGBA_8888); |
159 const Resource* const_resource = resource.get(); | 165 const Resource* const_resource = resource.get(); |
160 | 166 |
161 RasterWorkerPool::Task::Set empty; | 167 RasterWorkerPool::Task::Set empty; |
162 tasks_.push_back( | 168 tasks_.push_back( |
163 RasterWorkerPool::RasterTask(new TestRasterWorkerPoolTaskImpl( | 169 RasterWorkerPool::RasterTask(new TestRasterWorkerPoolTaskImpl( |
164 const_resource, | 170 const_resource, |
165 base::Bind(&RasterWorkerPoolTest::OnTaskCompleted, | 171 base::Bind(&RasterWorkerPoolTest::OnTaskCompleted, |
166 base::Unretained(this), | 172 base::Unretained(this), |
167 base::Passed(&resource), | 173 base::Passed(&resource), |
168 id), | 174 id), |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 ASSERT_EQ(1u, tasks_.size()); | 284 ASSERT_EQ(1u, tasks_.size()); |
279 tasks_.clear(); | 285 tasks_.clear(); |
280 } | 286 } |
281 }; | 287 }; |
282 | 288 |
283 PIXEL_BUFFER_AND_IMAGE_TEST_F(RasterWorkerPoolTestFailedMapResource); | 289 PIXEL_BUFFER_AND_IMAGE_TEST_F(RasterWorkerPoolTestFailedMapResource); |
284 | 290 |
285 } // namespace | 291 } // namespace |
286 | 292 |
287 } // namespace cc | 293 } // namespace cc |
OLD | NEW |