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 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 busy_buffers_.push_back(staging_buffer.Pass()); | 533 busy_buffers_.push_back(staging_buffer.Pass()); |
534 | 534 |
535 ScheduleReduceMemoryUsage(); | 535 ScheduleReduceMemoryUsage(); |
536 } | 536 } |
537 | 537 |
538 bool OneCopyTileTaskWorkerPool::OnMemoryDump( | 538 bool OneCopyTileTaskWorkerPool::OnMemoryDump( |
539 const base::trace_event::MemoryDumpArgs& args, | 539 const base::trace_event::MemoryDumpArgs& args, |
540 base::trace_event::ProcessMemoryDump* pmd) { | 540 base::trace_event::ProcessMemoryDump* pmd) { |
541 base::AutoLock lock(lock_); | 541 base::AutoLock lock(lock_); |
542 | 542 |
543 for (const auto& buffer : buffers_) { | 543 for (const auto* buffer : buffers_) { |
| 544 auto in_free_buffers = |
| 545 std::find_if(free_buffers_.begin(), free_buffers_.end(), |
| 546 [buffer](const scoped_ptr<StagingBuffer>& b) { |
| 547 return b.get() == buffer; |
| 548 }); |
544 buffer->OnMemoryDump(pmd, buffer->format, | 549 buffer->OnMemoryDump(pmd, buffer->format, |
545 std::find(free_buffers_.begin(), free_buffers_.end(), | 550 in_free_buffers != free_buffers_.end()); |
546 buffer) != free_buffers_.end()); | |
547 } | 551 } |
548 | 552 |
549 return true; | 553 return true; |
550 } | 554 } |
551 | 555 |
552 void OneCopyTileTaskWorkerPool::AddStagingBuffer( | 556 void OneCopyTileTaskWorkerPool::AddStagingBuffer( |
553 const StagingBuffer* staging_buffer, | 557 const StagingBuffer* staging_buffer, |
554 ResourceFormat format) { | 558 ResourceFormat format) { |
555 lock_.AssertAcquired(); | 559 lock_.AssertAcquired(); |
556 | 560 |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 | 823 |
820 staging_state->SetInteger("staging_buffer_count", | 824 staging_state->SetInteger("staging_buffer_count", |
821 static_cast<int>(buffers_.size())); | 825 static_cast<int>(buffers_.size())); |
822 staging_state->SetInteger("busy_count", | 826 staging_state->SetInteger("busy_count", |
823 static_cast<int>(busy_buffers_.size())); | 827 static_cast<int>(busy_buffers_.size())); |
824 staging_state->SetInteger("free_count", | 828 staging_state->SetInteger("free_count", |
825 static_cast<int>(free_buffers_.size())); | 829 static_cast<int>(free_buffers_.size())); |
826 } | 830 } |
827 | 831 |
828 } // namespace cc | 832 } // namespace cc |
OLD | NEW |