| 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 "content/common/discardable_shared_memory_heap.h" | 5 #include "content/common/discardable_shared_memory_heap.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/memory/discardable_shared_memory.h" | 10 #include "base/memory/discardable_shared_memory.h" |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 std::string segment_dump_name = | 382 std::string segment_dump_name = |
| 383 base::StringPrintf("discardable/segment_%d", segment_id); | 383 base::StringPrintf("discardable/segment_%d", segment_id); |
| 384 base::trace_event::MemoryAllocatorDump* segment_dump = | 384 base::trace_event::MemoryAllocatorDump* segment_dump = |
| 385 pmd->CreateAllocatorDump(segment_dump_name); | 385 pmd->CreateAllocatorDump(segment_dump_name); |
| 386 segment_dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, | 386 segment_dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, |
| 387 base::trace_event::MemoryAllocatorDump::kUnitsBytes, | 387 base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
| 388 static_cast<uint64_t>(size)); | 388 static_cast<uint64_t>(size)); |
| 389 | 389 |
| 390 base::trace_event::MemoryAllocatorDump* obj_dump = | 390 base::trace_event::MemoryAllocatorDump* obj_dump = |
| 391 pmd->CreateAllocatorDump(segment_dump_name + "/allocated_objects"); | 391 pmd->CreateAllocatorDump(segment_dump_name + "/allocated_objects"); |
| 392 obj_dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameObjectsCount, | 392 obj_dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameObjectCount, |
| 393 base::trace_event::MemoryAllocatorDump::kUnitsObjects, | 393 base::trace_event::MemoryAllocatorDump::kUnitsObjects, |
| 394 static_cast<uint64_t>(allocated_objects_count)); | 394 static_cast<uint64_t>(allocated_objects_count)); |
| 395 obj_dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, | 395 obj_dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, |
| 396 base::trace_event::MemoryAllocatorDump::kUnitsBytes, | 396 base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
| 397 static_cast<uint64_t>(allocated_objects_size_in_bytes)); | 397 static_cast<uint64_t>(allocated_objects_size_in_bytes)); |
| 398 | 398 |
| 399 // Emit an ownership edge towards a global allocator dump node. This allows | 399 // Emit an ownership edge towards a global allocator dump node. This allows |
| 400 // to avoid double-counting segments when both browser and child process emit | 400 // to avoid double-counting segments when both browser and child process emit |
| 401 // them. In the special case of single-process-mode, this will be the only | 401 // them. In the special case of single-process-mode, this will be the only |
| 402 // dumper active and the single ownership edge will become a no-op in the UI. | 402 // dumper active and the single ownership edge will become a no-op in the UI. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 ScopedVector<ScopedMemorySegment>::const_iterator it = | 437 ScopedVector<ScopedMemorySegment>::const_iterator it = |
| 438 std::find_if(memory_segments_.begin(), memory_segments_.end(), | 438 std::find_if(memory_segments_.begin(), memory_segments_.end(), |
| 439 [span](const ScopedMemorySegment* segment) { | 439 [span](const ScopedMemorySegment* segment) { |
| 440 return segment->ContainsSpan(span); | 440 return segment->ContainsSpan(span); |
| 441 }); | 441 }); |
| 442 DCHECK(it != memory_segments_.end()); | 442 DCHECK(it != memory_segments_.end()); |
| 443 return (*it)->CreateMemoryAllocatorDump(span, block_size_, name, pmd); | 443 return (*it)->CreateMemoryAllocatorDump(span, block_size_, name, pmd); |
| 444 } | 444 } |
| 445 | 445 |
| 446 } // namespace content | 446 } // namespace content |
| OLD | NEW |