| 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 raster_buffer_ = client->AcquireBufferForRaster(resource(), 0, 0); |
| 78 } | 81 } |
| 79 void CompleteOnOriginThread(TileTaskClient* client) override { | 82 void CompleteOnOriginThread(TileTaskClient* client) override { |
| 80 client->ReleaseBufferForRaster(raster_buffer_.Pass()); | 83 client->ReleaseBufferForRaster(raster_buffer_.Pass()); |
| 81 } | 84 } |
| 82 void RunReplyOnOriginThread() override { | 85 void RunReplyOnOriginThread() override { |
| 83 reply_.Run(RasterSource::SolidColorAnalysis(), !HasFinishedRunning()); | 86 reply_.Run(RasterSource::SolidColorAnalysis(), !HasFinishedRunning()); |
| 84 } | 87 } |
| 85 | 88 |
| 86 protected: | 89 protected: |
| 87 ~TestRasterTaskImpl() override {} | 90 ~TestRasterTaskImpl() override {} |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 base::ThreadTaskRunnerHandle::Get().get(), &task_graph_runner_, | 162 base::ThreadTaskRunnerHandle::Get().get(), &task_graph_runner_, |
| 160 resource_provider_.get()); | 163 resource_provider_.get()); |
| 161 break; | 164 break; |
| 162 case TILE_TASK_WORKER_POOL_TYPE_ONE_COPY: | 165 case TILE_TASK_WORKER_POOL_TYPE_ONE_COPY: |
| 163 Create3dOutputSurfaceAndResourceProvider(); | 166 Create3dOutputSurfaceAndResourceProvider(); |
| 164 staging_resource_pool_ = ResourcePool::Create(resource_provider_.get(), | 167 staging_resource_pool_ = ResourcePool::Create(resource_provider_.get(), |
| 165 GL_TEXTURE_2D); | 168 GL_TEXTURE_2D); |
| 166 tile_task_worker_pool_ = OneCopyTileTaskWorkerPool::Create( | 169 tile_task_worker_pool_ = OneCopyTileTaskWorkerPool::Create( |
| 167 base::ThreadTaskRunnerHandle::Get().get(), &task_graph_runner_, | 170 base::ThreadTaskRunnerHandle::Get().get(), &task_graph_runner_, |
| 168 context_provider_.get(), resource_provider_.get(), | 171 context_provider_.get(), resource_provider_.get(), |
| 169 staging_resource_pool_.get(), kMaxBytesPerCopyOperation); | 172 staging_resource_pool_.get(), kMaxBytesPerCopyOperation, false); |
| 170 break; | 173 break; |
| 171 case TILE_TASK_WORKER_POOL_TYPE_GPU: | 174 case TILE_TASK_WORKER_POOL_TYPE_GPU: |
| 172 Create3dOutputSurfaceAndResourceProvider(); | 175 Create3dOutputSurfaceAndResourceProvider(); |
| 173 tile_task_worker_pool_ = GpuTileTaskWorkerPool::Create( | 176 tile_task_worker_pool_ = GpuTileTaskWorkerPool::Create( |
| 174 base::ThreadTaskRunnerHandle::Get().get(), &task_graph_runner_, | 177 base::ThreadTaskRunnerHandle::Get().get(), &task_graph_runner_, |
| 175 context_provider_.get(), resource_provider_.get(), false, 0); | 178 context_provider_.get(), resource_provider_.get(), false, 0); |
| 176 break; | 179 break; |
| 177 case TILE_TASK_WORKER_POOL_TYPE_BITMAP: | 180 case TILE_TASK_WORKER_POOL_TYPE_BITMAP: |
| 178 CreateSoftwareOutputSurfaceAndResourceProvider(); | 181 CreateSoftwareOutputSurfaceAndResourceProvider(); |
| 179 tile_task_worker_pool_ = BitmapTileTaskWorkerPool::Create( | 182 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) { | 286 void LoseContext(ContextProvider* context_provider) { |
| 284 if (!context_provider) | 287 if (!context_provider) |
| 285 return; | 288 return; |
| 286 context_provider->ContextGL()->LoseContextCHROMIUM( | 289 context_provider->ContextGL()->LoseContextCHROMIUM( |
| 287 GL_GUILTY_CONTEXT_RESET_ARB, GL_INNOCENT_CONTEXT_RESET_ARB); | 290 GL_GUILTY_CONTEXT_RESET_ARB, GL_INNOCENT_CONTEXT_RESET_ARB); |
| 288 context_provider->ContextGL()->Flush(); | 291 context_provider->ContextGL()->Flush(); |
| 289 } | 292 } |
| 290 | 293 |
| 291 private: | 294 private: |
| 292 void Create3dOutputSurfaceAndResourceProvider() { | 295 void Create3dOutputSurfaceAndResourceProvider() { |
| 293 output_surface_ = FakeOutputSurface::Create3d( | 296 output_surface_ = FakeOutputSurface::Create3d(context_provider_, |
| 294 context_provider_, worker_context_provider_).Pass(); | 297 worker_context_provider_); |
| 295 CHECK(output_surface_->BindToClient(&output_surface_client_)); | 298 CHECK(output_surface_->BindToClient(&output_surface_client_)); |
| 296 TestWebGraphicsContext3D* context3d = context_provider_->TestContext3d(); | 299 TestWebGraphicsContext3D* context3d = context_provider_->TestContext3d(); |
| 297 context3d->set_support_sync_query(true); | 300 context3d->set_support_sync_query(true); |
| 298 resource_provider_ = FakeResourceProvider::Create( | 301 resource_provider_ = FakeResourceProvider::Create( |
| 299 output_surface_.get(), nullptr, &gpu_memory_buffer_manager_); | 302 output_surface_.get(), nullptr, &gpu_memory_buffer_manager_); |
| 300 } | 303 } |
| 301 | 304 |
| 302 void CreateSoftwareOutputSurfaceAndResourceProvider() { | 305 void CreateSoftwareOutputSurfaceAndResourceProvider() { |
| 303 output_surface_ = FakeOutputSurface::CreateSoftware( | 306 output_surface_ = FakeOutputSurface::CreateSoftware( |
| 304 make_scoped_ptr(new SoftwareOutputDevice)); | 307 make_scoped_ptr(new SoftwareOutputDevice)); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 TileTaskWorkerPoolTests, | 437 TileTaskWorkerPoolTests, |
| 435 TileTaskWorkerPoolTest, | 438 TileTaskWorkerPoolTest, |
| 436 ::testing::Values(TILE_TASK_WORKER_POOL_TYPE_PIXEL_BUFFER, | 439 ::testing::Values(TILE_TASK_WORKER_POOL_TYPE_PIXEL_BUFFER, |
| 437 TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY, | 440 TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY, |
| 438 TILE_TASK_WORKER_POOL_TYPE_ONE_COPY, | 441 TILE_TASK_WORKER_POOL_TYPE_ONE_COPY, |
| 439 TILE_TASK_WORKER_POOL_TYPE_GPU, | 442 TILE_TASK_WORKER_POOL_TYPE_GPU, |
| 440 TILE_TASK_WORKER_POOL_TYPE_BITMAP)); | 443 TILE_TASK_WORKER_POOL_TYPE_BITMAP)); |
| 441 | 444 |
| 442 } // namespace | 445 } // namespace |
| 443 } // namespace cc | 446 } // namespace cc |
| OLD | NEW |