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/raster/tile_task_worker_pool.h" | 5 #include "cc/raster/tile_task_worker_pool.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/cancelable_callback.h" | 10 #include "base/cancelable_callback.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 TestRasterTaskImpl(const Resource* resource, | 62 TestRasterTaskImpl(const Resource* resource, |
63 const Reply& reply, | 63 const Reply& reply, |
64 ImageDecodeTask::Vector* dependencies) | 64 ImageDecodeTask::Vector* dependencies) |
65 : RasterTask(resource, dependencies), | 65 : RasterTask(resource, dependencies), |
66 reply_(reply), | 66 reply_(reply), |
67 picture_pile_(FakePicturePileImpl::CreateEmptyPile(gfx::Size(1, 1), | 67 picture_pile_(FakePicturePileImpl::CreateEmptyPile(gfx::Size(1, 1), |
68 gfx::Size(1, 1))) {} | 68 gfx::Size(1, 1))) {} |
69 | 69 |
70 // Overridden from Task: | 70 // Overridden from Task: |
71 void RunOnWorkerThread() override { | 71 void RunOnWorkerThread() override { |
72 raster_buffer_->Playback(picture_pile_.get(), gfx::Rect(0, 0, 1, 1), 1.0); | 72 raster_buffer_->Playback(picture_pile_.get(), gfx::Rect(1, 1), |
| 73 gfx::Rect(1, 1), 1.0); |
73 } | 74 } |
74 | 75 |
75 // Overridden from TileTask: | 76 // Overridden from TileTask: |
76 void ScheduleOnOriginThread(TileTaskClient* client) override { | 77 void ScheduleOnOriginThread(TileTaskClient* client) override { |
77 raster_buffer_ = client->AcquireBufferForRaster(resource()); | 78 // The raster buffer has no tile ids associated with it for partial update, |
| 79 // so doesn't need to provide a valid dirty rect. |
| 80 TileTaskData data(resource(), 0, 0); |
| 81 raster_buffer_ = client->AcquireBufferForRaster(data); |
78 } | 82 } |
79 void CompleteOnOriginThread(TileTaskClient* client) override { | 83 void CompleteOnOriginThread(TileTaskClient* client) override { |
80 client->ReleaseBufferForRaster(raster_buffer_.Pass()); | 84 client->ReleaseBufferForRaster(raster_buffer_.Pass()); |
81 } | 85 } |
82 void RunReplyOnOriginThread() override { | 86 void RunReplyOnOriginThread() override { |
83 reply_.Run(RasterSource::SolidColorAnalysis(), !HasFinishedRunning()); | 87 reply_.Run(RasterSource::SolidColorAnalysis(), !HasFinishedRunning()); |
84 } | 88 } |
85 | 89 |
86 protected: | 90 protected: |
87 ~TestRasterTaskImpl() override {} | 91 ~TestRasterTaskImpl() override {} |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 base::ThreadTaskRunnerHandle::Get().get(), &task_graph_runner_, | 163 base::ThreadTaskRunnerHandle::Get().get(), &task_graph_runner_, |
160 resource_provider_.get()); | 164 resource_provider_.get()); |
161 break; | 165 break; |
162 case TILE_TASK_WORKER_POOL_TYPE_ONE_COPY: | 166 case TILE_TASK_WORKER_POOL_TYPE_ONE_COPY: |
163 Create3dOutputSurfaceAndResourceProvider(); | 167 Create3dOutputSurfaceAndResourceProvider(); |
164 staging_resource_pool_ = ResourcePool::Create(resource_provider_.get(), | 168 staging_resource_pool_ = ResourcePool::Create(resource_provider_.get(), |
165 GL_TEXTURE_2D); | 169 GL_TEXTURE_2D); |
166 tile_task_worker_pool_ = OneCopyTileTaskWorkerPool::Create( | 170 tile_task_worker_pool_ = OneCopyTileTaskWorkerPool::Create( |
167 base::ThreadTaskRunnerHandle::Get().get(), &task_graph_runner_, | 171 base::ThreadTaskRunnerHandle::Get().get(), &task_graph_runner_, |
168 context_provider_.get(), resource_provider_.get(), | 172 context_provider_.get(), resource_provider_.get(), |
169 staging_resource_pool_.get(), kMaxBytesPerCopyOperation); | 173 staging_resource_pool_.get(), kMaxBytesPerCopyOperation, false); |
170 break; | 174 break; |
171 case TILE_TASK_WORKER_POOL_TYPE_GPU: | 175 case TILE_TASK_WORKER_POOL_TYPE_GPU: |
172 Create3dOutputSurfaceAndResourceProvider(); | 176 Create3dOutputSurfaceAndResourceProvider(); |
173 tile_task_worker_pool_ = GpuTileTaskWorkerPool::Create( | 177 tile_task_worker_pool_ = GpuTileTaskWorkerPool::Create( |
174 base::ThreadTaskRunnerHandle::Get().get(), &task_graph_runner_, | 178 base::ThreadTaskRunnerHandle::Get().get(), &task_graph_runner_, |
175 context_provider_.get(), resource_provider_.get(), false, 0); | 179 context_provider_.get(), resource_provider_.get(), false, 0); |
176 break; | 180 break; |
177 case TILE_TASK_WORKER_POOL_TYPE_BITMAP: | 181 case TILE_TASK_WORKER_POOL_TYPE_BITMAP: |
178 CreateSoftwareOutputSurfaceAndResourceProvider(); | 182 CreateSoftwareOutputSurfaceAndResourceProvider(); |
179 tile_task_worker_pool_ = BitmapTileTaskWorkerPool::Create( | 183 tile_task_worker_pool_ = BitmapTileTaskWorkerPool::Create( |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 void LoseContext(ContextProvider* context_provider) { | 287 void LoseContext(ContextProvider* context_provider) { |
284 if (!context_provider) | 288 if (!context_provider) |
285 return; | 289 return; |
286 context_provider->ContextGL()->LoseContextCHROMIUM( | 290 context_provider->ContextGL()->LoseContextCHROMIUM( |
287 GL_GUILTY_CONTEXT_RESET_ARB, GL_INNOCENT_CONTEXT_RESET_ARB); | 291 GL_GUILTY_CONTEXT_RESET_ARB, GL_INNOCENT_CONTEXT_RESET_ARB); |
288 context_provider->ContextGL()->Flush(); | 292 context_provider->ContextGL()->Flush(); |
289 } | 293 } |
290 | 294 |
291 private: | 295 private: |
292 void Create3dOutputSurfaceAndResourceProvider() { | 296 void Create3dOutputSurfaceAndResourceProvider() { |
293 output_surface_ = FakeOutputSurface::Create3d( | 297 output_surface_ = FakeOutputSurface::Create3d(context_provider_, |
294 context_provider_, worker_context_provider_).Pass(); | 298 worker_context_provider_); |
295 CHECK(output_surface_->BindToClient(&output_surface_client_)); | 299 CHECK(output_surface_->BindToClient(&output_surface_client_)); |
296 TestWebGraphicsContext3D* context3d = context_provider_->TestContext3d(); | 300 TestWebGraphicsContext3D* context3d = context_provider_->TestContext3d(); |
297 context3d->set_support_sync_query(true); | 301 context3d->set_support_sync_query(true); |
298 resource_provider_ = FakeResourceProvider::Create( | 302 resource_provider_ = FakeResourceProvider::Create( |
299 output_surface_.get(), nullptr, &gpu_memory_buffer_manager_); | 303 output_surface_.get(), nullptr, &gpu_memory_buffer_manager_); |
300 } | 304 } |
301 | 305 |
302 void CreateSoftwareOutputSurfaceAndResourceProvider() { | 306 void CreateSoftwareOutputSurfaceAndResourceProvider() { |
303 output_surface_ = FakeOutputSurface::CreateSoftware( | 307 output_surface_ = FakeOutputSurface::CreateSoftware( |
304 make_scoped_ptr(new SoftwareOutputDevice)); | 308 make_scoped_ptr(new SoftwareOutputDevice)); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 TileTaskWorkerPoolTests, | 438 TileTaskWorkerPoolTests, |
435 TileTaskWorkerPoolTest, | 439 TileTaskWorkerPoolTest, |
436 ::testing::Values(TILE_TASK_WORKER_POOL_TYPE_PIXEL_BUFFER, | 440 ::testing::Values(TILE_TASK_WORKER_POOL_TYPE_PIXEL_BUFFER, |
437 TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY, | 441 TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY, |
438 TILE_TASK_WORKER_POOL_TYPE_ONE_COPY, | 442 TILE_TASK_WORKER_POOL_TYPE_ONE_COPY, |
439 TILE_TASK_WORKER_POOL_TYPE_GPU, | 443 TILE_TASK_WORKER_POOL_TYPE_GPU, |
440 TILE_TASK_WORKER_POOL_TYPE_BITMAP)); | 444 TILE_TASK_WORKER_POOL_TYPE_BITMAP)); |
441 | 445 |
442 } // namespace | 446 } // namespace |
443 } // namespace cc | 447 } // namespace cc |
OLD | NEW |