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

Side by Side Diff: third_party/WebKit/Source/platform/heap/BlinkGCMemoryDumpProvider.cpp

Issue 2307003002: Move collectGarbage* methods to ThreadState (Closed)
Patch Set: fix Created 4 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "platform/heap/BlinkGCMemoryDumpProvider.h" 5 #include "platform/heap/BlinkGCMemoryDumpProvider.h"
6 6
7 #include "base/trace_event/heap_profiler_allocation_context_tracker.h" 7 #include "base/trace_event/heap_profiler_allocation_context_tracker.h"
8 #include "base/trace_event/heap_profiler_allocation_register.h" 8 #include "base/trace_event/heap_profiler_allocation_register.h"
9 #include "base/trace_event/memory_allocator_dump.h" 9 #include "base/trace_event/memory_allocator_dump.h"
10 #include "base/trace_event/process_memory_dump.h" 10 #include "base/trace_event/process_memory_dump.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 { 52 {
53 } 53 }
54 54
55 bool BlinkGCMemoryDumpProvider::OnMemoryDump(const base::trace_event::MemoryDump Args& args, base::trace_event::ProcessMemoryDump* memoryDump) 55 bool BlinkGCMemoryDumpProvider::OnMemoryDump(const base::trace_event::MemoryDump Args& args, base::trace_event::ProcessMemoryDump* memoryDump)
56 { 56 {
57 using base::trace_event::MemoryDumpLevelOfDetail; 57 using base::trace_event::MemoryDumpLevelOfDetail;
58 MemoryDumpLevelOfDetail levelOfDetail = args.level_of_detail; 58 MemoryDumpLevelOfDetail levelOfDetail = args.level_of_detail;
59 // In the case of a detailed dump perform a mark-only GC pass to collect 59 // In the case of a detailed dump perform a mark-only GC pass to collect
60 // more detailed stats. 60 // more detailed stats.
61 if (levelOfDetail == MemoryDumpLevelOfDetail::DETAILED) 61 if (levelOfDetail == MemoryDumpLevelOfDetail::DETAILED)
62 ThreadHeap::collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::Take Snapshot, BlinkGC::ForcedGC); 62 ThreadState::current()->collectGarbage(BlinkGC::NoHeapPointersOnStack, B linkGC::TakeSnapshot, BlinkGC::ForcedGC);
63 dumpMemoryTotals(memoryDump); 63 dumpMemoryTotals(memoryDump);
64 64
65 if (m_isHeapProfilingEnabled) { 65 if (m_isHeapProfilingEnabled) {
66 // Overhead should always be reported, regardless of light vs. heavy. 66 // Overhead should always be reported, regardless of light vs. heavy.
67 base::trace_event::TraceEventMemoryOverhead overhead; 67 base::trace_event::TraceEventMemoryOverhead overhead;
68 base::hash_map<base::trace_event::AllocationContext, base::trace_event:: AllocationMetrics> metricsByContext; 68 base::hash_map<base::trace_event::AllocationContext, base::trace_event:: AllocationMetrics> metricsByContext;
69 { 69 {
70 MutexLocker locker(m_allocationRegisterMutex); 70 MutexLocker locker(m_allocationRegisterMutex);
71 if (levelOfDetail == MemoryDumpLevelOfDetail::DETAILED) { 71 if (levelOfDetail == MemoryDumpLevelOfDetail::DETAILED) {
72 for (const auto& allocSize : *m_allocationRegister) { 72 for (const auto& allocSize : *m_allocationRegister) {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 } 130 }
131 131
132 void BlinkGCMemoryDumpProvider::remove(Address address) 132 void BlinkGCMemoryDumpProvider::remove(Address address)
133 { 133 {
134 MutexLocker locker(m_allocationRegisterMutex); 134 MutexLocker locker(m_allocationRegisterMutex);
135 if (m_allocationRegister) 135 if (m_allocationRegister)
136 m_allocationRegister->Remove(address); 136 m_allocationRegister->Remove(address);
137 } 137 }
138 138
139 } // namespace blink 139 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/LifecycleContextTest.cpp ('k') | third_party/WebKit/Source/platform/heap/Heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698