| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/tiles/software_image_decode_controller.h" | 5 #include "cc/tiles/software_image_decode_controller.h" |
| 6 | 6 |
| 7 #include <inttypes.h> | 7 #include <inttypes.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 return true; | 798 return true; |
| 799 } | 799 } |
| 800 | 800 |
| 801 void SoftwareImageDecodeController::DumpImageMemoryForCache( | 801 void SoftwareImageDecodeController::DumpImageMemoryForCache( |
| 802 const ImageMRUCache& cache, | 802 const ImageMRUCache& cache, |
| 803 const char* cache_name, | 803 const char* cache_name, |
| 804 base::trace_event::ProcessMemoryDump* pmd) const { | 804 base::trace_event::ProcessMemoryDump* pmd) const { |
| 805 lock_.AssertAcquired(); | 805 lock_.AssertAcquired(); |
| 806 | 806 |
| 807 for (const auto& image_pair : cache) { | 807 for (const auto& image_pair : cache) { |
| 808 std::string dump_name = base::StringPrintf( |
| 809 "cc/image_memory/controller_0x%" PRIXPTR "/%s/image_%" PRIu64 "_id_%d", |
| 810 reinterpret_cast<uintptr_t>(this), cache_name, |
| 811 image_pair.second->tracing_id(), image_pair.first.image_id()); |
| 812 // CreateMemoryAllocatorDump will automatically add tracking values for the |
| 813 // total size. If locked, we also add a "locked_size" below. |
| 814 MemoryAllocatorDump* dump = |
| 815 image_pair.second->memory()->CreateMemoryAllocatorDump( |
| 816 dump_name.c_str(), pmd); |
| 817 DCHECK(dump); |
| 808 if (image_pair.second->is_locked()) { | 818 if (image_pair.second->is_locked()) { |
| 809 std::string dump_name = base::StringPrintf( | |
| 810 "cc/image_memory/controller_0x%" PRIXPTR "/%s/image_%" PRIu64 | |
| 811 "_id_%d", | |
| 812 reinterpret_cast<uintptr_t>(this), cache_name, | |
| 813 image_pair.second->tracing_id(), image_pair.first.image_id()); | |
| 814 MemoryAllocatorDump* dump = | |
| 815 image_pair.second->memory()->CreateMemoryAllocatorDump( | |
| 816 dump_name.c_str(), pmd); | |
| 817 DCHECK(dump); | |
| 818 dump->AddScalar("locked_size", MemoryAllocatorDump::kUnitsBytes, | 819 dump->AddScalar("locked_size", MemoryAllocatorDump::kUnitsBytes, |
| 819 image_pair.first.locked_bytes()); | 820 image_pair.first.locked_bytes()); |
| 820 } | 821 } |
| 821 } | 822 } |
| 822 } | 823 } |
| 823 | 824 |
| 824 void SoftwareImageDecodeController::SanityCheckState(int line, | 825 void SoftwareImageDecodeController::SanityCheckState(int line, |
| 825 bool lock_acquired) { | 826 bool lock_acquired) { |
| 826 #if DCHECK_IS_ON() | 827 #if DCHECK_IS_ON() |
| 827 if (!lock_acquired) { | 828 if (!lock_acquired) { |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1122 break; | 1123 break; |
| 1123 case base::MemoryState::UNKNOWN: | 1124 case base::MemoryState::UNKNOWN: |
| 1124 NOTREACHED(); | 1125 NOTREACHED(); |
| 1125 return; | 1126 return; |
| 1126 } | 1127 } |
| 1127 } | 1128 } |
| 1128 ReduceCacheUsage(); | 1129 ReduceCacheUsage(); |
| 1129 } | 1130 } |
| 1130 | 1131 |
| 1131 } // namespace cc | 1132 } // namespace cc |
| OLD | NEW |