| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "mojo/edk/system/handle_table.h" | 5 #include "mojo/edk/system/handle_table.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 | 10 |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 handle_count[Dispatcher::Type::PLATFORM_HANDLE]; | 174 handle_count[Dispatcher::Type::PLATFORM_HANDLE]; |
| 175 | 175 |
| 176 // Count the number of each dispatcher type. | 176 // Count the number of each dispatcher type. |
| 177 { | 177 { |
| 178 base::AutoLock lock(GetLock()); | 178 base::AutoLock lock(GetLock()); |
| 179 for (const auto& entry : handles_) { | 179 for (const auto& entry : handles_) { |
| 180 ++handle_count[entry.second.dispatcher->GetType()]; | 180 ++handle_count[entry.second.dispatcher->GetType()]; |
| 181 } | 181 } |
| 182 } | 182 } |
| 183 | 183 |
| 184 base::trace_event::MemoryAllocatorDump* outer_dump = | 184 pmd->CreateAllocatorDump("mojo"); |
| 185 pmd->CreateAllocatorDump("mojo"); | |
| 186 for (const auto& entry : handle_count) { | 185 for (const auto& entry : handle_count) { |
| 187 outer_dump->AddScalar(GetNameForDispatcherType(entry.first), | 186 base::trace_event::MemoryAllocatorDump* inner_dump = |
| 188 base::trace_event::MemoryAllocatorDump::kUnitsObjects, | 187 pmd->CreateAllocatorDump(std::string("mojo/") + |
| 189 entry.second); | 188 GetNameForDispatcherType(entry.first)); |
| 189 inner_dump->AddScalar( |
| 190 base::trace_event::MemoryAllocatorDump::kNameObjectCount, |
| 191 base::trace_event::MemoryAllocatorDump::kUnitsObjects, entry.second); |
| 190 } | 192 } |
| 191 | 193 |
| 192 return true; | 194 return true; |
| 193 } | 195 } |
| 194 | 196 |
| 195 HandleTable::Entry::Entry() {} | 197 HandleTable::Entry::Entry() {} |
| 196 | 198 |
| 197 HandleTable::Entry::Entry(scoped_refptr<Dispatcher> dispatcher) | 199 HandleTable::Entry::Entry(scoped_refptr<Dispatcher> dispatcher) |
| 198 : dispatcher(std::move(dispatcher)) {} | 200 : dispatcher(std::move(dispatcher)) {} |
| 199 | 201 |
| 200 HandleTable::Entry::Entry(const Entry& other) = default; | 202 HandleTable::Entry::Entry(const Entry& other) = default; |
| 201 | 203 |
| 202 HandleTable::Entry::~Entry() {} | 204 HandleTable::Entry::~Entry() {} |
| 203 | 205 |
| 204 } // namespace edk | 206 } // namespace edk |
| 205 } // namespace mojo | 207 } // namespace mojo |
| OLD | NEW |