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

Side by Side Diff: cc/resources/resource_provider.cc

Issue 1265183002: Add memory tracking to TexturePool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@textures3
Patch Set: review feedback Created 5 years, 4 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
« cc/resources/resource_pool.cc ('K') | « cc/resources/resource_pool.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/resource_provider.h" 5 #include "cc/resources/resource_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
(...skipping 1955 matching lines...) Expand 10 before | Expand all | Expand 10 after
1966 bool ResourceProvider::OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd) { 1966 bool ResourceProvider::OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd) {
1967 DCHECK(thread_checker_.CalledOnValidThread()); 1967 DCHECK(thread_checker_.CalledOnValidThread());
1968 1968
1969 const uint64 tracing_process_id = 1969 const uint64 tracing_process_id =
1970 base::trace_event::MemoryDumpManager::GetInstance() 1970 base::trace_event::MemoryDumpManager::GetInstance()
1971 ->GetTracingProcessId(); 1971 ->GetTracingProcessId();
1972 1972
1973 for (const auto& resource_entry : resources_) { 1973 for (const auto& resource_entry : resources_) {
1974 const auto& resource = resource_entry.second; 1974 const auto& resource = resource_entry.second;
1975 1975
1976 // TODO(ericrk): Add per-compositor ID in name.
reveman 2015/08/05 01:26:59 A simple way to solve this is to replace ResourceP
1976 std::string dump_name = base::StringPrintf("cc/resource_memory/resource_%d", 1977 std::string dump_name = base::StringPrintf("cc/resource_memory/resource_%d",
1977 resource_entry.first); 1978 resource_entry.first);
1978 base::trace_event::MemoryAllocatorDump* dump = 1979 base::trace_event::MemoryAllocatorDump* dump =
1979 pmd->CreateAllocatorDump(dump_name); 1980 pmd->CreateAllocatorDump(dump_name);
1980 1981
1981 uint64_t total_bytes = ResourceUtil::UncheckedSizeInBytesAligned<size_t>( 1982 uint64_t total_bytes = ResourceUtil::UncheckedSizeInBytesAligned<size_t>(
1982 resource.size, resource.format); 1983 resource.size, resource.format);
1983 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, 1984 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
1984 base::trace_event::MemoryAllocatorDump::kUnitsBytes, 1985 base::trace_event::MemoryAllocatorDump::kUnitsBytes,
1985 static_cast<uint64_t>(total_bytes)); 1986 static_cast<uint64_t>(total_bytes));
(...skipping 16 matching lines...) Expand all
2002 const int kImportance = 2; 2003 const int kImportance = 2;
2003 pmd->CreateSharedGlobalAllocatorDump(guid); 2004 pmd->CreateSharedGlobalAllocatorDump(guid);
2004 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); 2005 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance);
2005 } 2006 }
2006 } 2007 }
2007 2008
2008 return true; 2009 return true;
2009 } 2010 }
2010 2011
2011 } // namespace cc 2012 } // namespace cc
OLDNEW
« cc/resources/resource_pool.cc ('K') | « cc/resources/resource_pool.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698