Chromium Code Reviews| 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" |
| 11 #include "base/trace_event/trace_event.h" | 11 #include "base/trace_event/trace_event.h" |
| 12 #include "base/trace_event/trace_event_argument.h" | 12 #include "base/trace_event/trace_event_argument.h" |
| 13 #include "cc/base/math_util.h" | 13 #include "cc/base/math_util.h" |
| 14 #include "cc/debug/traced_value.h" | 14 #include "cc/debug/traced_value.h" |
| 15 #include "cc/raster/raster_buffer.h" | 15 #include "cc/raster/raster_buffer.h" |
| 16 #include "cc/resources/resource_pool.h" | 16 #include "cc/resources/resource_pool.h" |
| 17 #include "cc/resources/scoped_resource.h" | 17 #include "cc/resources/scoped_resource.h" |
| 18 #include "gpu/command_buffer/client/gles2_interface.h" | 18 #include "gpu/command_buffer/client/gles2_interface.h" |
| 19 #include "ui/gfx/gpu_memory_buffer.h" | 19 #include "ui/gfx/gpu_memory_buffer.h" |
| 20 | 20 |
| 21 namespace cc { | 21 namespace cc { |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 class RasterBufferImpl : public RasterBuffer { | 24 class RasterBufferImpl : public RasterBuffer { |
| 25 public: | 25 public: |
| 26 RasterBufferImpl(OneCopyTileTaskWorkerPool* worker_pool, | 26 RasterBufferImpl(OneCopyTileTaskWorkerPool* worker_pool, |
| 27 ResourceProvider* resource_provider, | 27 ResourceProvider* resource_provider, |
| 28 ResourcePool* resource_pool, | 28 ResourcePool* resource_pool, |
| 29 ResourceFormat resource_format, | 29 ResourceFormat resource_format, |
| 30 const Resource* resource) | 30 const Resource* upload_resource, |
| 31 uint64_t new_content_id, | |
| 32 uint64_t previous_content_id) | |
| 31 : worker_pool_(worker_pool), | 33 : worker_pool_(worker_pool), |
| 32 resource_provider_(resource_provider), | 34 resource_provider_(resource_provider), |
| 33 resource_pool_(resource_pool), | 35 resource_pool_(resource_pool), |
| 34 resource_(resource), | 36 upload_resource_(upload_resource), |
| 35 raster_resource_( | 37 new_content_id_(new_content_id), |
| 36 resource_pool->AcquireResource(resource->size(), resource_format)), | 38 reusing_raster_resource_(true), |
| 37 lock_(new ResourceProvider::ScopedWriteLockGpuMemoryBuffer( | 39 sequence_(0) { |
| 38 resource_provider_, | 40 if (worker_pool->have_persistent_gpu_memory_buffers() && |
| 39 raster_resource_->id())), | 41 previous_content_id) { |
| 40 sequence_(0) {} | 42 raster_resource_ = |
| 43 resource_pool->TryAcquireResourceWithContentId(previous_content_id); | |
| 44 DCHECK_EQ(resource_format, raster_resource_->format()); | |
|
reveman
2015/05/29 14:50:26
what if raster_resource_ == nullptr?
danakj
2015/05/29 17:16:06
Done.
| |
| 45 DCHECK_EQ(upload_resource->size().ToString(), | |
| 46 raster_resource_->size().ToString()); | |
| 47 } | |
| 48 if (!raster_resource_) { | |
| 49 raster_resource_ = resource_pool->AcquireResource(upload_resource->size(), | |
| 50 resource_format); | |
| 51 reusing_raster_resource_ = false; | |
| 52 } | |
| 53 | |
| 54 lock_.reset(new ResourceProvider::ScopedWriteLockGpuMemoryBuffer( | |
| 55 resource_provider_, raster_resource_->id())); | |
| 56 } | |
| 41 | 57 |
| 42 ~RasterBufferImpl() override { | 58 ~RasterBufferImpl() override { |
| 43 // Release write lock in case a copy was never scheduled. | 59 // Release write lock in case a copy was never scheduled. |
| 44 lock_.reset(); | 60 lock_.reset(); |
| 45 | 61 |
| 46 // Make sure any scheduled copy operations are issued before we release the | 62 // Make sure any scheduled copy operations are issued before we release the |
| 47 // raster resource. | 63 // raster resource. |
| 48 if (sequence_) | 64 bool did_playback = sequence_ != 0; |
| 65 if (did_playback) | |
| 49 worker_pool_->AdvanceLastIssuedCopyTo(sequence_); | 66 worker_pool_->AdvanceLastIssuedCopyTo(sequence_); |
| 50 | 67 |
| 51 // Return raster resource to pool so it can be used by another RasterBuffer | 68 // Return resources to pool so they can be used by another RasterBuffer |
| 52 // instance. | 69 // instance. |
| 53 if (raster_resource_) | 70 uint64_t id(did_playback ? new_content_id_ : 0); |
| 54 resource_pool_->ReleaseResource(raster_resource_.Pass()); | 71 resource_pool_->ReleaseResource(raster_resource_.Pass(), id); |
|
reveman
2015/05/29 14:50:26
should we keep the old content id if raster buffer
danakj
2015/05/29 17:16:06
we could but it'll never be used. the tile id will
reveman
2015/05/29 18:42:43
I'm thinking of cases where tasks are canceled and
danakj
2015/05/29 18:59:48
Ya, but well, it won't hurt. I'll make it use the
| |
| 55 } | 72 } |
| 56 | 73 |
| 57 // Overridden from RasterBuffer: | 74 // Overridden from RasterBuffer: |
| 58 void Playback(const RasterSource* raster_source, | 75 void Playback(const RasterSource* raster_source, |
| 59 const gfx::Rect& rect, | 76 const gfx::Rect& raster_full_rect, |
| 77 const gfx::Rect& raster_dirty_rect, | |
| 60 float scale) override { | 78 float scale) override { |
| 61 sequence_ = worker_pool_->PlaybackAndScheduleCopyOnWorkerThread( | 79 sequence_ = worker_pool_->PlaybackAndScheduleCopyOnWorkerThread( |
| 62 lock_.Pass(), raster_resource_.get(), resource_, raster_source, rect, | 80 reusing_raster_resource_, lock_.Pass(), raster_resource_.get(), |
| 81 upload_resource_, raster_source, raster_full_rect, raster_dirty_rect, | |
| 63 scale); | 82 scale); |
| 64 } | 83 } |
| 65 | 84 |
| 66 private: | 85 private: |
| 67 OneCopyTileTaskWorkerPool* worker_pool_; | 86 OneCopyTileTaskWorkerPool* worker_pool_; |
| 68 ResourceProvider* resource_provider_; | 87 ResourceProvider* resource_provider_; |
| 69 ResourcePool* resource_pool_; | 88 ResourcePool* resource_pool_; |
| 70 const Resource* resource_; | 89 const Resource* upload_resource_; |
| 90 uint64_t new_content_id_; | |
| 91 bool reusing_raster_resource_; | |
| 71 scoped_ptr<ScopedResource> raster_resource_; | 92 scoped_ptr<ScopedResource> raster_resource_; |
| 72 scoped_ptr<ResourceProvider::ScopedWriteLockGpuMemoryBuffer> lock_; | 93 scoped_ptr<ResourceProvider::ScopedWriteLockGpuMemoryBuffer> lock_; |
| 73 CopySequenceNumber sequence_; | 94 CopySequenceNumber sequence_; |
| 74 | 95 |
| 75 DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl); | 96 DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl); |
| 76 }; | 97 }; |
| 77 | 98 |
| 78 // Flush interval when performing copy operations. | 99 // Flush interval when performing copy operations. |
| 79 const int kCopyFlushPeriod = 4; | 100 const int kCopyFlushPeriod = 4; |
| 80 | 101 |
| 81 // Number of in-flight copy operations to allow. | 102 // Number of in-flight copy operations to allow. |
| 82 const int kMaxCopyOperations = 32; | 103 const int kMaxCopyOperations = 32; |
| 83 | 104 |
| 84 // Delay been checking for copy operations to complete. | 105 // Delay been checking for copy operations to complete. |
| 85 const int kCheckForCompletedCopyOperationsTickRateMs = 1; | 106 const int kCheckForCompletedCopyOperationsTickRateMs = 1; |
| 86 | 107 |
| 87 // Number of failed attempts to allow before we perform a check that will | 108 // Number of failed attempts to allow before we perform a check that will |
| 88 // wait for copy operations to complete if needed. | 109 // wait for copy operations to complete if needed. |
| 89 const int kFailedAttemptsBeforeWaitIfNeeded = 256; | 110 const int kFailedAttemptsBeforeWaitIfNeeded = 256; |
| 90 | 111 |
| 91 } // namespace | 112 } // namespace |
| 92 | 113 |
| 93 OneCopyTileTaskWorkerPool::CopyOperation::CopyOperation( | 114 OneCopyTileTaskWorkerPool::CopyOperation::CopyOperation( |
| 94 scoped_ptr<ResourceProvider::ScopedWriteLockGpuMemoryBuffer> write_lock, | 115 scoped_ptr<ResourceProvider::ScopedWriteLockGpuMemoryBuffer> src_write_lock, |
| 95 const Resource* src, | 116 const Resource* src, |
| 96 const Resource* dst, | 117 const Resource* dst, |
| 97 const gfx::Rect& rect) | 118 const gfx::Rect& rect) |
| 98 : write_lock(write_lock.Pass()), src(src), dst(dst), rect(rect) { | 119 : src_write_lock(src_write_lock.Pass()), src(src), dst(dst), rect(rect) { |
| 99 } | 120 } |
| 100 | 121 |
| 101 OneCopyTileTaskWorkerPool::CopyOperation::~CopyOperation() { | 122 OneCopyTileTaskWorkerPool::CopyOperation::~CopyOperation() { |
| 102 } | 123 } |
| 103 | 124 |
| 104 // static | 125 // static |
| 105 scoped_ptr<TileTaskWorkerPool> OneCopyTileTaskWorkerPool::Create( | 126 scoped_ptr<TileTaskWorkerPool> OneCopyTileTaskWorkerPool::Create( |
| 106 base::SequencedTaskRunner* task_runner, | 127 base::SequencedTaskRunner* task_runner, |
| 107 TaskGraphRunner* task_graph_runner, | 128 TaskGraphRunner* task_graph_runner, |
| 108 ContextProvider* context_provider, | 129 ContextProvider* context_provider, |
| 109 ResourceProvider* resource_provider, | 130 ResourceProvider* resource_provider, |
| 110 ResourcePool* resource_pool, | 131 ResourcePool* resource_pool, |
| 111 size_t max_bytes_per_copy_operation) { | 132 size_t max_bytes_per_copy_operation, |
| 133 bool have_persistent_gpu_memory_buffers) { | |
| 112 return make_scoped_ptr<TileTaskWorkerPool>(new OneCopyTileTaskWorkerPool( | 134 return make_scoped_ptr<TileTaskWorkerPool>(new OneCopyTileTaskWorkerPool( |
| 113 task_runner, task_graph_runner, context_provider, resource_provider, | 135 task_runner, task_graph_runner, context_provider, resource_provider, |
| 114 resource_pool, max_bytes_per_copy_operation)); | 136 resource_pool, max_bytes_per_copy_operation, |
| 137 have_persistent_gpu_memory_buffers)); | |
| 115 } | 138 } |
| 116 | 139 |
| 117 OneCopyTileTaskWorkerPool::OneCopyTileTaskWorkerPool( | 140 OneCopyTileTaskWorkerPool::OneCopyTileTaskWorkerPool( |
| 118 base::SequencedTaskRunner* task_runner, | 141 base::SequencedTaskRunner* task_runner, |
| 119 TaskGraphRunner* task_graph_runner, | 142 TaskGraphRunner* task_graph_runner, |
| 120 ContextProvider* context_provider, | 143 ContextProvider* context_provider, |
| 121 ResourceProvider* resource_provider, | 144 ResourceProvider* resource_provider, |
| 122 ResourcePool* resource_pool, | 145 ResourcePool* resource_pool, |
| 123 size_t max_bytes_per_copy_operation) | 146 size_t max_bytes_per_copy_operation, |
| 147 bool have_persistent_gpu_memory_buffers) | |
| 124 : task_runner_(task_runner), | 148 : task_runner_(task_runner), |
| 125 task_graph_runner_(task_graph_runner), | 149 task_graph_runner_(task_graph_runner), |
| 126 namespace_token_(task_graph_runner->GetNamespaceToken()), | 150 namespace_token_(task_graph_runner->GetNamespaceToken()), |
| 127 context_provider_(context_provider), | 151 context_provider_(context_provider), |
| 128 resource_provider_(resource_provider), | 152 resource_provider_(resource_provider), |
| 129 resource_pool_(resource_pool), | 153 resource_pool_(resource_pool), |
| 130 max_bytes_per_copy_operation_(max_bytes_per_copy_operation), | 154 max_bytes_per_copy_operation_(max_bytes_per_copy_operation), |
| 155 have_persistent_gpu_memory_buffers_(have_persistent_gpu_memory_buffers), | |
| 131 last_issued_copy_operation_(0), | 156 last_issued_copy_operation_(0), |
| 132 last_flushed_copy_operation_(0), | 157 last_flushed_copy_operation_(0), |
| 133 lock_(), | 158 lock_(), |
| 134 copy_operation_count_cv_(&lock_), | 159 copy_operation_count_cv_(&lock_), |
| 135 issued_copy_operation_count_(0), | 160 issued_copy_operation_count_(0), |
| 136 next_copy_operation_sequence_(1), | 161 next_copy_operation_sequence_(1), |
| 137 check_for_completed_copy_operations_pending_(false), | 162 check_for_completed_copy_operations_pending_(false), |
| 138 shutdown_(false), | 163 shutdown_(false), |
| 139 weak_ptr_factory_(this), | 164 weak_ptr_factory_(this), |
| 140 task_set_finished_weak_ptr_factory_(this) { | 165 task_set_finished_weak_ptr_factory_(this) { |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 259 task->RunReplyOnOriginThread(); | 284 task->RunReplyOnOriginThread(); |
| 260 } | 285 } |
| 261 completed_tasks_.clear(); | 286 completed_tasks_.clear(); |
| 262 } | 287 } |
| 263 | 288 |
| 264 ResourceFormat OneCopyTileTaskWorkerPool::GetResourceFormat() { | 289 ResourceFormat OneCopyTileTaskWorkerPool::GetResourceFormat() { |
| 265 return resource_provider_->best_texture_format(); | 290 return resource_provider_->best_texture_format(); |
| 266 } | 291 } |
| 267 | 292 |
| 268 scoped_ptr<RasterBuffer> OneCopyTileTaskWorkerPool::AcquireBufferForRaster( | 293 scoped_ptr<RasterBuffer> OneCopyTileTaskWorkerPool::AcquireBufferForRaster( |
| 269 const Resource* resource) { | 294 const Resource* resource, |
| 295 uint64_t new_content_id, | |
| 296 uint64_t previous_content_id) { | |
| 270 DCHECK_EQ(resource->format(), resource_provider_->best_texture_format()); | 297 DCHECK_EQ(resource->format(), resource_provider_->best_texture_format()); |
| 271 return make_scoped_ptr<RasterBuffer>( | 298 return make_scoped_ptr<RasterBuffer>( |
| 272 new RasterBufferImpl(this, resource_provider_, resource_pool_, | 299 new RasterBufferImpl(this, resource_provider_, resource_pool_, |
| 273 resource_provider_->best_texture_format(), | 300 resource_provider_->best_texture_format(), resource, |
| 274 resource)); | 301 new_content_id, previous_content_id)); |
| 275 } | 302 } |
| 276 | 303 |
| 277 void OneCopyTileTaskWorkerPool::ReleaseBufferForRaster( | 304 void OneCopyTileTaskWorkerPool::ReleaseBufferForRaster( |
| 278 scoped_ptr<RasterBuffer> buffer) { | 305 scoped_ptr<RasterBuffer> buffer) { |
| 279 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. | 306 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. |
| 280 } | 307 } |
| 281 | 308 |
| 282 CopySequenceNumber | 309 CopySequenceNumber |
| 283 OneCopyTileTaskWorkerPool::PlaybackAndScheduleCopyOnWorkerThread( | 310 OneCopyTileTaskWorkerPool::PlaybackAndScheduleCopyOnWorkerThread( |
| 284 scoped_ptr<ResourceProvider::ScopedWriteLockGpuMemoryBuffer> write_lock, | 311 bool reusing_raster_resource, |
| 285 const Resource* src, | 312 scoped_ptr<ResourceProvider::ScopedWriteLockGpuMemoryBuffer> |
| 286 const Resource* dst, | 313 raster_resource_write_lock, |
| 314 const Resource* raster_resource, | |
| 315 const Resource* upload_resource, | |
| 287 const RasterSource* raster_source, | 316 const RasterSource* raster_source, |
| 288 const gfx::Rect& rect, | 317 const gfx::Rect& raster_full_rect, |
| 318 const gfx::Rect& raster_dirty_rect, | |
| 289 float scale) { | 319 float scale) { |
| 290 gfx::GpuMemoryBuffer* gpu_memory_buffer = write_lock->GetGpuMemoryBuffer(); | 320 gfx::GpuMemoryBuffer* gpu_memory_buffer = |
| 321 raster_resource_write_lock->GetGpuMemoryBuffer(); | |
| 291 if (gpu_memory_buffer) { | 322 if (gpu_memory_buffer) { |
| 292 void* data = NULL; | 323 void* data = NULL; |
| 293 bool rv = gpu_memory_buffer->Map(&data); | 324 bool rv = gpu_memory_buffer->Map(&data); |
| 294 DCHECK(rv); | 325 DCHECK(rv); |
| 295 int stride; | 326 int stride; |
| 296 gpu_memory_buffer->GetStride(&stride); | 327 gpu_memory_buffer->GetStride(&stride); |
| 297 TileTaskWorkerPool::PlaybackToMemory(data, src->format(), src->size(), | 328 |
| 298 stride, raster_source, rect, scale); | 329 gfx::Rect playback_rect = raster_full_rect; |
| 330 if (reusing_raster_resource) { | |
| 331 playback_rect.Intersect(raster_dirty_rect); | |
| 332 } | |
| 333 DCHECK(!playback_rect.IsEmpty()) | |
| 334 << "Why are we rastering a tile that's not dirty?"; | |
| 335 TileTaskWorkerPool::PlaybackToMemory( | |
| 336 data, raster_resource->format(), raster_resource->size(), stride, | |
| 337 raster_source, raster_full_rect, playback_rect, scale); | |
| 299 gpu_memory_buffer->Unmap(); | 338 gpu_memory_buffer->Unmap(); |
| 300 } | 339 } |
| 301 | 340 |
| 302 base::AutoLock lock(lock_); | 341 base::AutoLock lock(lock_); |
| 303 | 342 |
| 304 CopySequenceNumber sequence = 0; | 343 CopySequenceNumber sequence = 0; |
| 305 size_t bytes_per_row = | 344 size_t bytes_per_row = (BitsPerPixel(raster_resource->format()) * |
| 306 (BitsPerPixel(src->format()) * src->size().width()) / 8; | 345 raster_resource->size().width()) / |
| 346 8; | |
| 307 size_t chunk_size_in_rows = std::max( | 347 size_t chunk_size_in_rows = std::max( |
| 308 static_cast<size_t>(1), max_bytes_per_copy_operation_ / bytes_per_row); | 348 static_cast<size_t>(1), max_bytes_per_copy_operation_ / bytes_per_row); |
| 309 // Align chunk size to 4. Required to support compressed texture formats. | 349 // Align chunk size to 4. Required to support compressed texture formats. |
| 310 chunk_size_in_rows = | 350 chunk_size_in_rows = |
| 311 MathUtil::RoundUp(chunk_size_in_rows, static_cast<size_t>(4)); | 351 MathUtil::RoundUp(chunk_size_in_rows, static_cast<size_t>(4)); |
| 312 size_t y = 0; | 352 size_t y = 0; |
| 313 size_t height = src->size().height(); | 353 size_t height = raster_resource->size().height(); |
| 314 while (y < height) { | 354 while (y < height) { |
| 315 int failed_attempts = 0; | 355 int failed_attempts = 0; |
| 316 while ((pending_copy_operations_.size() + issued_copy_operation_count_) >= | 356 while ((pending_copy_operations_.size() + issued_copy_operation_count_) >= |
| 317 kMaxCopyOperations) { | 357 kMaxCopyOperations) { |
| 318 // Ignore limit when shutdown is set. | 358 // Ignore limit when shutdown is set. |
| 319 if (shutdown_) | 359 if (shutdown_) |
| 320 break; | 360 break; |
| 321 | 361 |
| 322 ++failed_attempts; | 362 ++failed_attempts; |
| 323 | 363 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 336 copy_operation_count_cv_.Wait(); | 376 copy_operation_count_cv_.Wait(); |
| 337 } | 377 } |
| 338 } | 378 } |
| 339 | 379 |
| 340 // There may be more work available, so wake up another worker thread. | 380 // There may be more work available, so wake up another worker thread. |
| 341 copy_operation_count_cv_.Signal(); | 381 copy_operation_count_cv_.Signal(); |
| 342 | 382 |
| 343 // Copy at most |chunk_size_in_rows|. | 383 // Copy at most |chunk_size_in_rows|. |
| 344 size_t rows_to_copy = std::min(chunk_size_in_rows, height - y); | 384 size_t rows_to_copy = std::min(chunk_size_in_rows, height - y); |
| 345 | 385 |
| 346 // |write_lock| is passed to the first copy operation as it needs to be | 386 // |write_lock| is passed to the first copy operation as it needs to be |
|
reveman
2015/05/29 14:50:27
|raster_resource_write_lock|
danakj
2015/05/29 17:16:06
Done.
| |
| 347 // released before we can issue a copy. | 387 // released before we can issue a copy. |
| 348 pending_copy_operations_.push_back(make_scoped_ptr( | 388 pending_copy_operations_.push_back(make_scoped_ptr(new CopyOperation( |
| 349 new CopyOperation(write_lock.Pass(), src, dst, | 389 raster_resource_write_lock.Pass(), raster_resource, upload_resource, |
| 350 gfx::Rect(0, y, src->size().width(), rows_to_copy)))); | 390 gfx::Rect(0, y, raster_resource->size().width(), rows_to_copy)))); |
| 351 | |
| 352 y += rows_to_copy; | 391 y += rows_to_copy; |
| 353 | 392 |
| 354 // Acquire a sequence number for this copy operation. | 393 // Acquire a sequence number for this copy operation. |
| 355 sequence = next_copy_operation_sequence_++; | 394 sequence = next_copy_operation_sequence_++; |
| 356 | 395 |
| 357 // Post task that will advance last flushed copy operation to |sequence| | 396 // Post task that will advance last flushed copy operation to |sequence| |
| 358 // if we have reached the flush period. | 397 // if we have reached the flush period. |
| 359 if ((sequence % kCopyFlushPeriod) == 0) { | 398 if ((sequence % kCopyFlushPeriod) == 0) { |
| 360 task_runner_->PostTask( | 399 task_runner_->PostTask( |
| 361 FROM_HERE, | 400 FROM_HERE, |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 419 | 458 |
| 420 // Increment |issued_copy_operation_count_| to reflect the transition of | 459 // Increment |issued_copy_operation_count_| to reflect the transition of |
| 421 // copy operations from "pending" to "issued" state. | 460 // copy operations from "pending" to "issued" state. |
| 422 issued_copy_operation_count_ += copy_operations.size(); | 461 issued_copy_operation_count_ += copy_operations.size(); |
| 423 } | 462 } |
| 424 | 463 |
| 425 while (!copy_operations.empty()) { | 464 while (!copy_operations.empty()) { |
| 426 scoped_ptr<CopyOperation> copy_operation = copy_operations.take_front(); | 465 scoped_ptr<CopyOperation> copy_operation = copy_operations.take_front(); |
| 427 | 466 |
| 428 // Remove the write lock. | 467 // Remove the write lock. |
| 429 copy_operation->write_lock.reset(); | 468 copy_operation->src_write_lock.reset(); |
| 430 | 469 |
| 431 // Copy contents of source resource to destination resource. | 470 // Copy contents of source resource to destination resource. |
| 432 resource_provider_->CopyResource(copy_operation->src->id(), | 471 resource_provider_->CopyResource(copy_operation->src->id(), |
| 433 copy_operation->dst->id(), | 472 copy_operation->dst->id(), |
| 434 copy_operation->rect); | 473 copy_operation->rect); |
| 435 } | 474 } |
| 436 } | 475 } |
| 437 | 476 |
| 438 void OneCopyTileTaskWorkerPool:: | 477 void OneCopyTileTaskWorkerPool:: |
| 439 ScheduleCheckForCompletedCopyOperationsWithLockAcquired( | 478 ScheduleCheckForCompletedCopyOperationsWithLockAcquired( |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 513 resource_pool_->total_memory_usage_bytes()); | 552 resource_pool_->total_memory_usage_bytes()); |
| 514 staging_state->SetInteger("pending_copy_count", | 553 staging_state->SetInteger("pending_copy_count", |
| 515 resource_pool_->total_resource_count() - | 554 resource_pool_->total_resource_count() - |
| 516 resource_pool_->acquired_resource_count()); | 555 resource_pool_->acquired_resource_count()); |
| 517 staging_state->SetInteger("bytes_pending_copy", | 556 staging_state->SetInteger("bytes_pending_copy", |
| 518 resource_pool_->total_memory_usage_bytes() - | 557 resource_pool_->total_memory_usage_bytes() - |
| 519 resource_pool_->acquired_memory_usage_bytes()); | 558 resource_pool_->acquired_memory_usage_bytes()); |
| 520 } | 559 } |
| 521 | 560 |
| 522 } // namespace cc | 561 } // namespace cc |
| OLD | NEW |