OLD | NEW |
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 "gin/v8_isolate_memory_dump_provider.h" | 5 #include "gin/v8_isolate_memory_dump_provider.h" |
6 | 6 |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "base/thread_task_runner_handle.h" | 8 #include "base/thread_task_runner_handle.h" |
9 #include "base/trace_event/memory_dump_manager.h" | 9 #include "base/trace_event/memory_dump_manager.h" |
10 #include "base/trace_event/process_memory_dump.h" | 10 #include "base/trace_event/process_memory_dump.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 } | 21 } |
22 | 22 |
23 V8IsolateMemoryDumpProvider::~V8IsolateMemoryDumpProvider() { | 23 V8IsolateMemoryDumpProvider::~V8IsolateMemoryDumpProvider() { |
24 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider( | 24 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider( |
25 this); | 25 this); |
26 } | 26 } |
27 | 27 |
28 // Called at trace dump point time. Creates a snapshot with the memory counters | 28 // Called at trace dump point time. Creates a snapshot with the memory counters |
29 // for the current isolate. | 29 // for the current isolate. |
30 bool V8IsolateMemoryDumpProvider::OnMemoryDump( | 30 bool V8IsolateMemoryDumpProvider::OnMemoryDump( |
| 31 const base::trace_event::MemoryDumpArgs& args, |
31 base::trace_event::ProcessMemoryDump* process_memory_dump) { | 32 base::trace_event::ProcessMemoryDump* process_memory_dump) { |
| 33 // TODO(ssid): Use MemoryDumpArgs to create light dumps when requested |
| 34 // (crbug.com/499731). |
| 35 |
32 if (isolate_holder_->access_mode() == IsolateHolder::kUseLocker) { | 36 if (isolate_holder_->access_mode() == IsolateHolder::kUseLocker) { |
33 v8::Locker locked(isolate_holder_->isolate()); | 37 v8::Locker locked(isolate_holder_->isolate()); |
34 DumpHeapStatistics(process_memory_dump); | 38 DumpHeapStatistics(process_memory_dump); |
35 } else { | 39 } else { |
36 DumpHeapStatistics(process_memory_dump); | 40 DumpHeapStatistics(process_memory_dump); |
37 } | 41 } |
38 return true; | 42 return true; |
39 } | 43 } |
40 | 44 |
41 void V8IsolateMemoryDumpProvider::DumpHeapStatistics( | 45 void V8IsolateMemoryDumpProvider::DumpHeapStatistics( |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 } | 131 } |
128 | 132 |
129 if (did_dump_object_stats) { | 133 if (did_dump_object_stats) { |
130 process_memory_dump->AddOwnershipEdge( | 134 process_memory_dump->AddOwnershipEdge( |
131 process_memory_dump->CreateAllocatorDump(object_name_prefix)->guid(), | 135 process_memory_dump->CreateAllocatorDump(object_name_prefix)->guid(), |
132 process_memory_dump->CreateAllocatorDump(space_name_prefix)->guid()); | 136 process_memory_dump->CreateAllocatorDump(space_name_prefix)->guid()); |
133 } | 137 } |
134 } | 138 } |
135 | 139 |
136 } // namespace gin | 140 } // namespace gin |
OLD | NEW |