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

Side by Side Diff: content/common/discardable_shared_memory_heap.cc

Issue 1308213005: Fix the size dumped by child discardable manager for tracing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@discardable
Patch Set: Created 5 years, 3 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 | « no previous file | 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 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 base::trace_event::MemoryAllocatorDump* 68 base::trace_event::MemoryAllocatorDump*
69 DiscardableSharedMemoryHeap::ScopedMemorySegment::CreateMemoryAllocatorDump( 69 DiscardableSharedMemoryHeap::ScopedMemorySegment::CreateMemoryAllocatorDump(
70 Span* span, 70 Span* span,
71 const char* name, 71 const char* name,
72 base::trace_event::ProcessMemoryDump* pmd) const { 72 base::trace_event::ProcessMemoryDump* pmd) const {
73 DCHECK_EQ(shared_memory_, span->shared_memory()); 73 DCHECK_EQ(shared_memory_, span->shared_memory());
74 base::trace_event::MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(name); 74 base::trace_event::MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(name);
75 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, 75 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
76 base::trace_event::MemoryAllocatorDump::kUnitsBytes, 76 base::trace_event::MemoryAllocatorDump::kUnitsBytes,
77 static_cast<uint64_t>(span->length())); 77 static_cast<uint64_t>(span->shared_memory()->mapped_size()));
reveman 2015/08/26 15:56:18 hm, mapped_size is the total size of the segment b
ssid 2015/08/26 16:00:35 Ah yes, I got confused here because of the host si
78 78
79 pmd->AddSuballocation(dump->guid(), 79 pmd->AddSuballocation(
80 base::StringPrintf("discardable/segment_%d", id_)); 80 dump->guid(),
81 base::StringPrintf("discardable/segment_%d/allocated_objects", id_));
81 return dump; 82 return dump;
82 } 83 }
83 84
84 void DiscardableSharedMemoryHeap::ScopedMemorySegment::OnMemoryDump( 85 void DiscardableSharedMemoryHeap::ScopedMemorySegment::OnMemoryDump(
85 base::trace_event::ProcessMemoryDump* pmd) const { 86 base::trace_event::ProcessMemoryDump* pmd) const {
86 heap_->OnMemoryDump(shared_memory_.get(), size_, id_, pmd); 87 heap_->OnMemoryDump(shared_memory_.get(), size_, id_, pmd);
87 } 88 }
88 89
89 DiscardableSharedMemoryHeap::DiscardableSharedMemoryHeap(size_t block_size) 90 DiscardableSharedMemoryHeap::DiscardableSharedMemoryHeap(size_t block_size)
90 : block_size_(block_size), num_blocks_(0), num_free_blocks_(0) { 91 : block_size_(block_size), num_blocks_(0), num_free_blocks_(0) {
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 ScopedVector<ScopedMemorySegment>::const_iterator it = 436 ScopedVector<ScopedMemorySegment>::const_iterator it =
436 std::find_if(memory_segments_.begin(), memory_segments_.end(), 437 std::find_if(memory_segments_.begin(), memory_segments_.end(),
437 [span](const ScopedMemorySegment* segment) { 438 [span](const ScopedMemorySegment* segment) {
438 return segment->ContainsSpan(span); 439 return segment->ContainsSpan(span);
439 }); 440 });
440 DCHECK(it != memory_segments_.end()); 441 DCHECK(it != memory_segments_.end());
441 return (*it)->CreateMemoryAllocatorDump(span, name, pmd); 442 return (*it)->CreateMemoryAllocatorDump(span, name, pmd);
442 } 443 }
443 444
444 } // namespace content 445 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698