| 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" |
| 11 #include "gin/public/isolate_holder.h" | 11 #include "gin/public/isolate_holder.h" |
| 12 #include "v8/include/v8.h" | 12 #include "v8/include/v8.h" |
| 13 | 13 |
| 14 namespace gin { | 14 namespace gin { |
| 15 | 15 |
| 16 V8IsolateMemoryDumpProvider::V8IsolateMemoryDumpProvider( | 16 V8IsolateMemoryDumpProvider::V8IsolateMemoryDumpProvider( |
| 17 IsolateHolder* isolate_holder) | 17 IsolateHolder* isolate_holder) |
| 18 : isolate_holder_(isolate_holder) { | 18 : isolate_holder_(isolate_holder) { |
| 19 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( | 19 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( |
| 20 this, base::ThreadTaskRunnerHandle::Get()); | 20 this, "V8Isolate", base::ThreadTaskRunnerHandle::Get()); |
| 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( |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 } | 147 } |
| 148 | 148 |
| 149 if (did_dump_object_stats) { | 149 if (did_dump_object_stats) { |
| 150 process_memory_dump->AddOwnershipEdge( | 150 process_memory_dump->AddOwnershipEdge( |
| 151 process_memory_dump->CreateAllocatorDump(object_name_prefix)->guid(), | 151 process_memory_dump->CreateAllocatorDump(object_name_prefix)->guid(), |
| 152 process_memory_dump->CreateAllocatorDump(space_name_prefix)->guid()); | 152 process_memory_dump->CreateAllocatorDump(space_name_prefix)->guid()); |
| 153 } | 153 } |
| 154 } | 154 } |
| 155 | 155 |
| 156 } // namespace gin | 156 } // namespace gin |
| OLD | NEW |