Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(485)

Side by Side Diff: cc/tiles/software_image_decode_cache.cc

Issue 2713483002: cc: Always report locked_size in software image cache. (Closed)
Patch Set: update Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/tiles/gpu_image_decode_cache.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_cache.h" 5 #include "cc/tiles/software_image_decode_cache.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 846 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 const char* cache_name, 857 const char* cache_name,
858 base::trace_event::ProcessMemoryDump* pmd) const { 858 base::trace_event::ProcessMemoryDump* pmd) const {
859 lock_.AssertAcquired(); 859 lock_.AssertAcquired();
860 860
861 for (const auto& image_pair : cache) { 861 for (const auto& image_pair : cache) {
862 std::string dump_name = base::StringPrintf( 862 std::string dump_name = base::StringPrintf(
863 "cc/image_memory/cache_0x%" PRIXPTR "/%s/image_%" PRIu64 "_id_%d", 863 "cc/image_memory/cache_0x%" PRIXPTR "/%s/image_%" PRIu64 "_id_%d",
864 reinterpret_cast<uintptr_t>(this), cache_name, 864 reinterpret_cast<uintptr_t>(this), cache_name,
865 image_pair.second->tracing_id(), image_pair.first.image_id()); 865 image_pair.second->tracing_id(), image_pair.first.image_id());
866 // CreateMemoryAllocatorDump will automatically add tracking values for the 866 // CreateMemoryAllocatorDump will automatically add tracking values for the
867 // total size. If locked, we also add a "locked_size" below. 867 // total size. We also add a "locked_size" below.
868 MemoryAllocatorDump* dump = 868 MemoryAllocatorDump* dump =
869 image_pair.second->memory()->CreateMemoryAllocatorDump( 869 image_pair.second->memory()->CreateMemoryAllocatorDump(
870 dump_name.c_str(), pmd); 870 dump_name.c_str(), pmd);
871 DCHECK(dump); 871 DCHECK(dump);
872 if (image_pair.second->is_locked()) { 872 size_t locked_bytes =
873 dump->AddScalar("locked_size", MemoryAllocatorDump::kUnitsBytes, 873 image_pair.second->is_locked() ? image_pair.first.locked_bytes() : 0u;
874 image_pair.first.locked_bytes()); 874 dump->AddScalar("locked_size", MemoryAllocatorDump::kUnitsBytes,
875 } 875 locked_bytes);
876 } 876 }
877 } 877 }
878 878
879 void SoftwareImageDecodeCache::SanityCheckState(int line, bool lock_acquired) { 879 void SoftwareImageDecodeCache::SanityCheckState(int line, bool lock_acquired) {
880 #if DCHECK_IS_ON() 880 #if DCHECK_IS_ON()
881 if (!lock_acquired) { 881 if (!lock_acquired) {
882 base::AutoLock lock(lock_); 882 base::AutoLock lock(lock_);
883 SanityCheckState(line, true); 883 SanityCheckState(line, true);
884 return; 884 return;
885 } 885 }
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
1177 } 1177 }
1178 } 1178 }
1179 } 1179 }
1180 1180
1181 void SoftwareImageDecodeCache::OnPurgeMemory() { 1181 void SoftwareImageDecodeCache::OnPurgeMemory() {
1182 base::AutoLock lock(lock_); 1182 base::AutoLock lock(lock_);
1183 ReduceCacheUsageUntilWithinLimit(0); 1183 ReduceCacheUsageUntilWithinLimit(0);
1184 } 1184 }
1185 1185
1186 } // namespace cc 1186 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tiles/gpu_image_decode_cache.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698