OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |