| 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/raster/one_copy_tile_task_worker_pool.h" | 5 #include "cc/raster/one_copy_tile_task_worker_pool.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 task->WillComplete(); | 318 task->WillComplete(); |
| 319 task->CompleteOnOriginThread(this); | 319 task->CompleteOnOriginThread(this); |
| 320 task->DidComplete(); | 320 task->DidComplete(); |
| 321 | 321 |
| 322 task->RunReplyOnOriginThread(); | 322 task->RunReplyOnOriginThread(); |
| 323 } | 323 } |
| 324 completed_tasks_.clear(); | 324 completed_tasks_.clear(); |
| 325 } | 325 } |
| 326 | 326 |
| 327 ResourceFormat OneCopyTileTaskWorkerPool::GetResourceFormat() const { | 327 ResourceFormat OneCopyTileTaskWorkerPool::GetResourceFormat() const { |
| 328 return resource_provider_->best_texture_format(); | 328 return resource_provider_->memory_efficient_texture_format(); |
| 329 } | 329 } |
| 330 | 330 |
| 331 bool OneCopyTileTaskWorkerPool::GetResourceRequiresSwizzle() const { | 331 bool OneCopyTileTaskWorkerPool::GetResourceRequiresSwizzle() const { |
| 332 return !PlatformColor::SameComponentOrder(GetResourceFormat()); | 332 return !PlatformColor::SameComponentOrder(GetResourceFormat()); |
| 333 } | 333 } |
| 334 | 334 |
| 335 scoped_ptr<RasterBuffer> OneCopyTileTaskWorkerPool::AcquireBufferForRaster( | 335 scoped_ptr<RasterBuffer> OneCopyTileTaskWorkerPool::AcquireBufferForRaster( |
| 336 const Resource* resource, | 336 const Resource* resource, |
| 337 uint64_t resource_content_id, | 337 uint64_t resource_content_id, |
| 338 uint64_t previous_content_id) { | 338 uint64_t previous_content_id) { |
| 339 // TODO(danakj): If resource_content_id != 0, we only need to copy/upload | 339 // TODO(danakj): If resource_content_id != 0, we only need to copy/upload |
| 340 // the dirty rect. | 340 // the dirty rect. |
| 341 DCHECK_EQ(resource->format(), resource_provider_->best_texture_format()); | 341 DCHECK_EQ(resource->format(), |
| 342 resource_provider_->memory_efficient_texture_format()); |
| 342 return make_scoped_ptr<RasterBuffer>(new RasterBufferImpl( | 343 return make_scoped_ptr<RasterBuffer>(new RasterBufferImpl( |
| 343 this, resource_provider_, resource_provider_->best_texture_format(), | 344 this, resource_provider_, |
| 344 resource, previous_content_id)); | 345 resource_provider_->memory_efficient_texture_format(), resource, |
| 346 previous_content_id)); |
| 345 } | 347 } |
| 346 | 348 |
| 347 void OneCopyTileTaskWorkerPool::ReleaseBufferForRaster( | 349 void OneCopyTileTaskWorkerPool::ReleaseBufferForRaster( |
| 348 scoped_ptr<RasterBuffer> buffer) { | 350 scoped_ptr<RasterBuffer> buffer) { |
| 349 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. | 351 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. |
| 350 } | 352 } |
| 351 | 353 |
| 352 void OneCopyTileTaskWorkerPool::PlaybackAndCopyOnWorkerThread( | 354 void OneCopyTileTaskWorkerPool::PlaybackAndCopyOnWorkerThread( |
| 353 const Resource* resource, | 355 const Resource* resource, |
| 354 const ResourceProvider::ScopedWriteLockGL* resource_lock, | 356 const ResourceProvider::ScopedWriteLockGL* resource_lock, |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 | 744 |
| 743 staging_state->SetInteger("staging_buffer_count", | 745 staging_state->SetInteger("staging_buffer_count", |
| 744 static_cast<int>(buffers_.size())); | 746 static_cast<int>(buffers_.size())); |
| 745 staging_state->SetInteger("busy_count", | 747 staging_state->SetInteger("busy_count", |
| 746 static_cast<int>(busy_buffers_.size())); | 748 static_cast<int>(busy_buffers_.size())); |
| 747 staging_state->SetInteger("free_count", | 749 staging_state->SetInteger("free_count", |
| 748 static_cast<int>(free_buffers_.size())); | 750 static_cast<int>(free_buffers_.size())); |
| 749 } | 751 } |
| 750 | 752 |
| 751 } // namespace cc | 753 } // namespace cc |
| OLD | NEW |