| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/v8_inspector/V8HeapProfilerAgentImpl.h" | 5 #include "platform/v8_inspector/V8HeapProfilerAgentImpl.h" |
| 6 | 6 |
| 7 #include "platform/v8_inspector/InjectedScript.h" | 7 #include "platform/v8_inspector/InjectedScript.h" |
| 8 #include "platform/v8_inspector/V8Debugger.h" | 8 #include "platform/v8_inspector/V8Debugger.h" |
| 9 #include "platform/v8_inspector/V8InspectorImpl.h" | 9 #include "platform/v8_inspector/V8InspectorImpl.h" |
| 10 #include "platform/v8_inspector/V8InspectorSessionImpl.h" | 10 #include "platform/v8_inspector/V8InspectorSessionImpl.h" |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 } | 282 } |
| 283 | 283 |
| 284 m_session->addInspectedObject(wrapUnique(new InspectableHeapObject(id))); | 284 m_session->addInspectedObject(wrapUnique(new InspectableHeapObject(id))); |
| 285 } | 285 } |
| 286 | 286 |
| 287 void V8HeapProfilerAgentImpl::getHeapObjectId(ErrorString* errorString, const St
ring16& objectId, String16* heapSnapshotObjectId) | 287 void V8HeapProfilerAgentImpl::getHeapObjectId(ErrorString* errorString, const St
ring16& objectId, String16* heapSnapshotObjectId) |
| 288 { | 288 { |
| 289 v8::HandleScope handles(m_isolate); | 289 v8::HandleScope handles(m_isolate); |
| 290 v8::Local<v8::Value> value; | 290 v8::Local<v8::Value> value; |
| 291 v8::Local<v8::Context> context; | 291 v8::Local<v8::Context> context; |
| 292 String16 objectGroup; | 292 if (!m_session->unwrapObject(errorString, toStringView(objectId), &value, &c
ontext, nullptr) || value->IsUndefined()) |
| 293 if (!m_session->unwrapObject(errorString, objectId, &value, &context, &objec
tGroup) || value->IsUndefined()) | |
| 294 return; | 293 return; |
| 295 | 294 |
| 296 v8::SnapshotObjectId id = m_isolate->GetHeapProfiler()->GetObjectId(value); | 295 v8::SnapshotObjectId id = m_isolate->GetHeapProfiler()->GetObjectId(value); |
| 297 *heapSnapshotObjectId = String16::fromInteger(id); | 296 *heapSnapshotObjectId = String16::fromInteger(id); |
| 298 } | 297 } |
| 299 | 298 |
| 300 void V8HeapProfilerAgentImpl::requestHeapStatsUpdate() | 299 void V8HeapProfilerAgentImpl::requestHeapStatsUpdate() |
| 301 { | 300 { |
| 302 HeapStatsStream stream(&m_frontend); | 301 HeapStatsStream stream(&m_frontend); |
| 303 v8::SnapshotObjectId lastSeenObjectId = m_isolate->GetHeapProfiler()->GetHea
pStats(&stream); | 302 v8::SnapshotObjectId lastSeenObjectId = m_isolate->GetHeapProfiler()->GetHea
pStats(&stream); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 *errorString = "Cannot access v8 sampled heap profile."; | 391 *errorString = "Cannot access v8 sampled heap profile."; |
| 393 return; | 392 return; |
| 394 } | 393 } |
| 395 v8::AllocationProfile::Node* root = v8Profile->GetRootNode(); | 394 v8::AllocationProfile::Node* root = v8Profile->GetRootNode(); |
| 396 *profile = protocol::HeapProfiler::SamplingHeapProfile::create() | 395 *profile = protocol::HeapProfiler::SamplingHeapProfile::create() |
| 397 .setHead(buildSampingHeapProfileNode(root)).build(); | 396 .setHead(buildSampingHeapProfileNode(root)).build(); |
| 398 #endif | 397 #endif |
| 399 } | 398 } |
| 400 | 399 |
| 401 } // namespace v8_inspector | 400 } // namespace v8_inspector |
| OLD | NEW |