| 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 <stdint.h> | 8 #include <stdint.h> |
| 8 | 9 |
| 9 #include <algorithm> | 10 #include <algorithm> |
| 10 #include <functional> | 11 #include <functional> |
| 11 | 12 |
| 12 #include "base/format_macros.h" | 13 #include "base/format_macros.h" |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/memory/discardable_memory.h" | 15 #include "base/memory/discardable_memory.h" |
| 15 #include "base/memory/ptr_util.h" | 16 #include "base/memory/ptr_util.h" |
| 16 #include "base/metrics/histogram_macros.h" | 17 #include "base/metrics/histogram_macros.h" |
| (...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 } | 701 } |
| 701 | 702 |
| 702 void SoftwareImageDecodeController::DumpImageMemoryForCache( | 703 void SoftwareImageDecodeController::DumpImageMemoryForCache( |
| 703 const ImageMRUCache& cache, | 704 const ImageMRUCache& cache, |
| 704 const char* cache_name, | 705 const char* cache_name, |
| 705 base::trace_event::ProcessMemoryDump* pmd) const { | 706 base::trace_event::ProcessMemoryDump* pmd) const { |
| 706 lock_.AssertAcquired(); | 707 lock_.AssertAcquired(); |
| 707 | 708 |
| 708 for (const auto& image_pair : cache) { | 709 for (const auto& image_pair : cache) { |
| 709 std::string dump_name = base::StringPrintf( | 710 std::string dump_name = base::StringPrintf( |
| 710 "cc/image_memory/controller_%p/%s/image_%" PRIu64 "_id_%d", this, | 711 "cc/image_memory/controller_0x%" PRIXPTR "/%s/image_%" PRIu64 "_id_%d", |
| 711 cache_name, image_pair.second->tracing_id(), | 712 reinterpret_cast<uintptr_t>(this), cache_name, |
| 712 image_pair.first.image_id()); | 713 image_pair.second->tracing_id(), image_pair.first.image_id()); |
| 713 base::trace_event::MemoryAllocatorDump* dump = | 714 base::trace_event::MemoryAllocatorDump* dump = |
| 714 image_pair.second->memory()->CreateMemoryAllocatorDump( | 715 image_pair.second->memory()->CreateMemoryAllocatorDump( |
| 715 dump_name.c_str(), pmd); | 716 dump_name.c_str(), pmd); |
| 716 DCHECK(dump); | 717 DCHECK(dump); |
| 717 if (image_pair.second->is_locked()) { | 718 if (image_pair.second->is_locked()) { |
| 718 dump->AddScalar("locked_size", | 719 dump->AddScalar("locked_size", |
| 719 base::trace_event::MemoryAllocatorDump::kUnitsBytes, | 720 base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
| 720 image_pair.first.locked_bytes()); | 721 image_pair.first.locked_bytes()); |
| 721 } | 722 } |
| 722 } | 723 } |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 971 void SoftwareImageDecodeController::MemoryBudget::ResetUsage() { | 972 void SoftwareImageDecodeController::MemoryBudget::ResetUsage() { |
| 972 current_usage_bytes_ = 0; | 973 current_usage_bytes_ = 0; |
| 973 } | 974 } |
| 974 | 975 |
| 975 size_t SoftwareImageDecodeController::MemoryBudget::GetCurrentUsageSafe() | 976 size_t SoftwareImageDecodeController::MemoryBudget::GetCurrentUsageSafe() |
| 976 const { | 977 const { |
| 977 return current_usage_bytes_.ValueOrDie(); | 978 return current_usage_bytes_.ValueOrDie(); |
| 978 } | 979 } |
| 979 | 980 |
| 980 } // namespace cc | 981 } // namespace cc |
| OLD | NEW |