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

Side by Side Diff: content/child/child_discardable_shared_memory_manager.cc

Issue 1259333003: [tracing] Add SkResourceCache as suballocation to avoid double counting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@skia_v1
Patch Set: Removing segment dump from base. 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
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/child/child_discardable_shared_memory_manager.h" 5 #include "content/child/child_discardable_shared_memory_manager.h"
6 6
7 #include "base/atomic_sequence_num.h" 7 #include "base/atomic_sequence_num.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/debug/crash_logging.h" 9 #include "base/debug/crash_logging.h"
10 #include "base/memory/discardable_memory.h" 10 #include "base/memory/discardable_memory.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 heap_.MergeIntoFreeLists(leftover.Pass()); 185 heap_.MergeIntoFreeLists(leftover.Pass());
186 } 186 }
187 187
188 MemoryUsageChanged(heap_.GetSize(), heap_.GetSizeOfFreeLists()); 188 MemoryUsageChanged(heap_.GetSize(), heap_.GetSizeOfFreeLists());
189 189
190 return make_scoped_ptr(new DiscardableMemoryImpl(this, new_span.Pass())); 190 return make_scoped_ptr(new DiscardableMemoryImpl(this, new_span.Pass()));
191 } 191 }
192 192
193 bool ChildDiscardableSharedMemoryManager::OnMemoryDump( 193 bool ChildDiscardableSharedMemoryManager::OnMemoryDump(
194 base::trace_event::ProcessMemoryDump* pmd) { 194 base::trace_event::ProcessMemoryDump* pmd) {
195 base::trace_event::MemoryAllocatorDump* objects_dump =
196 pmd->CreateAllocatorDump(GetMemoryPoolNameForTracing());
197 base::trace_event::MemoryAllocatorDump* discardable_segments_dump =
198 pmd->CreateAllocatorDump("discardable/segments");
199 pmd->AddOwnershipEdge(objects_dump->guid(),
200 discardable_segments_dump->guid());
201
195 base::AutoLock lock(lock_); 202 base::AutoLock lock(lock_);
196 return heap_.OnMemoryDump(pmd); 203 return heap_.OnMemoryDump(pmd);
197 } 204 }
198 205
199 void ChildDiscardableSharedMemoryManager::ReleaseFreeMemory() { 206 void ChildDiscardableSharedMemoryManager::ReleaseFreeMemory() {
200 base::AutoLock lock(lock_); 207 base::AutoLock lock(lock_);
201 208
202 size_t heap_size_prior_to_releasing_memory = heap_.GetSize(); 209 size_t heap_size_prior_to_releasing_memory = heap_.GetSize();
203 210
204 // Release both purged and free memory. 211 // Release both purged and free memory.
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 "discardable-memory-allocated"; 297 "discardable-memory-allocated";
291 base::debug::SetCrashKeyValue(kDiscardableMemoryAllocatedKey, 298 base::debug::SetCrashKeyValue(kDiscardableMemoryAllocatedKey,
292 base::Uint64ToString(new_bytes_total)); 299 base::Uint64ToString(new_bytes_total));
293 300
294 static const char kDiscardableMemoryFreeKey[] = "discardable-memory-free"; 301 static const char kDiscardableMemoryFreeKey[] = "discardable-memory-free";
295 base::debug::SetCrashKeyValue(kDiscardableMemoryFreeKey, 302 base::debug::SetCrashKeyValue(kDiscardableMemoryFreeKey,
296 base::Uint64ToString(new_bytes_free)); 303 base::Uint64ToString(new_bytes_free));
297 } 304 }
298 305
299 } // namespace content 306 } // namespace content
OLDNEW
« no previous file with comments | « base/memory/discardable_memory_allocator.cc ('k') | content/common/discardable_shared_memory_heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698