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

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: rebase 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
« no previous file with comments | « 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 1962 matching lines...) Expand 10 before | Expand all | Expand 10 after
1973 base::trace_event::ProcessMemoryDump* pmd) { 1973 base::trace_event::ProcessMemoryDump* pmd) {
1974 DCHECK(thread_checker_.CalledOnValidThread()); 1974 DCHECK(thread_checker_.CalledOnValidThread());
1975 1975
1976 const uint64 tracing_process_id = 1976 const uint64 tracing_process_id =
1977 base::trace_event::MemoryDumpManager::GetInstance() 1977 base::trace_event::MemoryDumpManager::GetInstance()
1978 ->GetTracingProcessId(); 1978 ->GetTracingProcessId();
1979 1979
1980 for (const auto& resource_entry : resources_) { 1980 for (const auto& resource_entry : resources_) {
1981 const auto& resource = resource_entry.second; 1981 const auto& resource = resource_entry.second;
1982 1982
1983 // TODO(ericrk): Add per-compositor ID in name.
1983 std::string dump_name = base::StringPrintf("cc/resource_memory/resource_%d", 1984 std::string dump_name = base::StringPrintf("cc/resource_memory/resource_%d",
1984 resource_entry.first); 1985 resource_entry.first);
1985 base::trace_event::MemoryAllocatorDump* dump = 1986 base::trace_event::MemoryAllocatorDump* dump =
1986 pmd->CreateAllocatorDump(dump_name); 1987 pmd->CreateAllocatorDump(dump_name);
1987 1988
1988 uint64_t total_bytes = ResourceUtil::UncheckedSizeInBytesAligned<size_t>( 1989 uint64_t total_bytes = ResourceUtil::UncheckedSizeInBytesAligned<size_t>(
1989 resource.size, resource.format); 1990 resource.size, resource.format);
1990 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, 1991 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
1991 base::trace_event::MemoryAllocatorDump::kUnitsBytes, 1992 base::trace_event::MemoryAllocatorDump::kUnitsBytes,
1992 static_cast<uint64_t>(total_bytes)); 1993 static_cast<uint64_t>(total_bytes));
(...skipping 16 matching lines...) Expand all
2009 const int kImportance = 2; 2010 const int kImportance = 2;
2010 pmd->CreateSharedGlobalAllocatorDump(guid); 2011 pmd->CreateSharedGlobalAllocatorDump(guid);
2011 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); 2012 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance);
2012 } 2013 }
2013 } 2014 }
2014 2015
2015 return true; 2016 return true;
2016 } 2017 }
2017 2018
2018 } // namespace cc 2019 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/resource_pool.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698