| 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/V8DebuggerImpl.h" | 8 #include "platform/v8_inspector/V8DebuggerImpl.h" |
| 9 #include "platform/v8_inspector/V8InspectorSessionImpl.h" | 9 #include "platform/v8_inspector/V8InspectorSessionImpl.h" |
| 10 #include "platform/v8_inspector/V8StringUtil.h" | 10 #include "platform/v8_inspector/V8StringUtil.h" |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 *errorString = "Object is not available"; | 283 *errorString = "Object is not available"; |
| 284 return; | 284 return; |
| 285 } | 285 } |
| 286 | 286 |
| 287 m_session->addInspectedObject(wrapUnique(new InspectableHeapObject(id))); | 287 m_session->addInspectedObject(wrapUnique(new InspectableHeapObject(id))); |
| 288 } | 288 } |
| 289 | 289 |
| 290 void V8HeapProfilerAgentImpl::getHeapObjectId(ErrorString* errorString, const St
ring16& objectId, String16* heapSnapshotObjectId) | 290 void V8HeapProfilerAgentImpl::getHeapObjectId(ErrorString* errorString, const St
ring16& objectId, String16* heapSnapshotObjectId) |
| 291 { | 291 { |
| 292 v8::HandleScope handles(m_isolate); | 292 v8::HandleScope handles(m_isolate); |
| 293 v8::Local<v8::Value> value = m_session->findObject(errorString, objectId); | 293 v8::Local<v8::Value> value; |
| 294 if (value.IsEmpty() || value->IsUndefined()) | 294 v8::Local<v8::Context> context; |
| 295 String16 objectGroup; |
| 296 if (!m_session->unwrapObject(errorString, objectId, &value, &context, &objec
tGroup) || value->IsUndefined()) |
| 295 return; | 297 return; |
| 296 | 298 |
| 297 v8::SnapshotObjectId id = m_isolate->GetHeapProfiler()->GetObjectId(value); | 299 v8::SnapshotObjectId id = m_isolate->GetHeapProfiler()->GetObjectId(value); |
| 298 *heapSnapshotObjectId = String16::fromInteger(id); | 300 *heapSnapshotObjectId = String16::fromInteger(id); |
| 299 } | 301 } |
| 300 | 302 |
| 301 void V8HeapProfilerAgentImpl::requestHeapStatsUpdate() | 303 void V8HeapProfilerAgentImpl::requestHeapStatsUpdate() |
| 302 { | 304 { |
| 303 HeapStatsStream stream(&m_frontend); | 305 HeapStatsStream stream(&m_frontend); |
| 304 v8::SnapshotObjectId lastSeenObjectId = m_isolate->GetHeapProfiler()->GetHea
pStats(&stream); | 306 v8::SnapshotObjectId lastSeenObjectId = m_isolate->GetHeapProfiler()->GetHea
pStats(&stream); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 *errorString = "Cannot access v8 sampled heap profile."; | 395 *errorString = "Cannot access v8 sampled heap profile."; |
| 394 return; | 396 return; |
| 395 } | 397 } |
| 396 v8::AllocationProfile::Node* root = v8Profile->GetRootNode(); | 398 v8::AllocationProfile::Node* root = v8Profile->GetRootNode(); |
| 397 *profile = protocol::HeapProfiler::SamplingHeapProfile::create() | 399 *profile = protocol::HeapProfiler::SamplingHeapProfile::create() |
| 398 .setHead(buildSampingHeapProfileNode(root)).build(); | 400 .setHead(buildSampingHeapProfileNode(root)).build(); |
| 399 #endif | 401 #endif |
| 400 } | 402 } |
| 401 | 403 |
| 402 } // namespace blink | 404 } // namespace blink |
| OLD | NEW |