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