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/resources/one_copy_raster_worker_pool.h" | 5 #include "cc/resources/one_copy_raster_worker_pool.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 } | 380 } |
381 client_->DidFinishRunningTasks(task_set); | 381 client_->DidFinishRunningTasks(task_set); |
382 } | 382 } |
383 | 383 |
384 void OneCopyRasterWorkerPool::IssueCopyOperations(int64 count) { | 384 void OneCopyRasterWorkerPool::IssueCopyOperations(int64 count) { |
385 TRACE_EVENT1( | 385 TRACE_EVENT1( |
386 "cc", "OneCopyRasterWorkerPool::IssueCopyOperations", "count", count); | 386 "cc", "OneCopyRasterWorkerPool::IssueCopyOperations", "count", count); |
387 | 387 |
388 CopyOperation::Deque copy_operations; | 388 CopyOperation::Deque copy_operations; |
389 | 389 |
390 // This is a good time to check for completed copy operations as | |
391 // |issued_copy_operation_count_| need to be updated below. | |
392 resource_pool_->CheckBusyResources(); | |
393 | |
394 { | 390 { |
395 base::AutoLock lock(lock_); | 391 base::AutoLock lock(lock_); |
396 | 392 |
397 for (int64 i = 0; i < count; ++i) { | 393 for (int64 i = 0; i < count; ++i) { |
398 DCHECK(!pending_copy_operations_.empty()); | 394 DCHECK(!pending_copy_operations_.empty()); |
399 copy_operations.push_back(pending_copy_operations_.take_front()); | 395 copy_operations.push_back(pending_copy_operations_.take_front()); |
400 } | 396 } |
401 | 397 |
402 // Decrement |scheduled_copy_operation_count_| and increment | 398 // Decrement |scheduled_copy_operation_count_| and increment |
403 // |issued_copy_operation_count_| to reflect the transition of copy | 399 // |issued_copy_operation_count_| to reflect the transition of copy |
404 // operations from "pending" to "issued" state. | 400 // operations from "pending" to "issued" state. |
405 DCHECK_GE(scheduled_copy_operation_count_, copy_operations.size()); | 401 DCHECK_GE(scheduled_copy_operation_count_, copy_operations.size()); |
406 scheduled_copy_operation_count_ -= copy_operations.size(); | 402 scheduled_copy_operation_count_ -= copy_operations.size(); |
407 | 403 issued_copy_operation_count_ += copy_operations.size(); |
408 issued_copy_operation_count_ = | |
409 resource_pool_->busy_resource_count() + copy_operations.size(); | |
410 } | 404 } |
411 | 405 |
412 while (!copy_operations.empty()) { | 406 while (!copy_operations.empty()) { |
413 scoped_ptr<CopyOperation> copy_operation = copy_operations.take_front(); | 407 scoped_ptr<CopyOperation> copy_operation = copy_operations.take_front(); |
414 | 408 |
415 // Remove the write lock. | 409 // Remove the write lock. |
416 copy_operation->write_lock.reset(); | 410 copy_operation->write_lock.reset(); |
417 | 411 |
418 // Copy contents of source resource to destination resource. | 412 // Copy contents of source resource to destination resource. |
419 resource_provider_->CopyResource(copy_operation->src->id(), | 413 resource_provider_->CopyResource(copy_operation->src->id(), |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 resource_pool_->total_memory_usage_bytes()); | 494 resource_pool_->total_memory_usage_bytes()); |
501 staging_state->SetInteger("pending_copy_count", | 495 staging_state->SetInteger("pending_copy_count", |
502 resource_pool_->total_resource_count() - | 496 resource_pool_->total_resource_count() - |
503 resource_pool_->acquired_resource_count()); | 497 resource_pool_->acquired_resource_count()); |
504 staging_state->SetInteger("bytes_pending_copy", | 498 staging_state->SetInteger("bytes_pending_copy", |
505 resource_pool_->total_memory_usage_bytes() - | 499 resource_pool_->total_memory_usage_bytes() - |
506 resource_pool_->acquired_memory_usage_bytes()); | 500 resource_pool_->acquired_memory_usage_bytes()); |
507 } | 501 } |
508 | 502 |
509 } // namespace cc | 503 } // namespace cc |
OLD | NEW |