OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project 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 "src/inspector/V8HeapProfilerAgentImpl.h" | 5 #include "src/inspector/V8HeapProfilerAgentImpl.h" |
6 | 6 |
7 #include "src/inspector/InjectedScript.h" | 7 #include "src/inspector/InjectedScript.h" |
8 #include "src/inspector/StringUtil.h" | 8 #include "src/inspector/StringUtil.h" |
9 #include "src/inspector/V8Debugger.h" | 9 #include "src/inspector/V8Debugger.h" |
10 #include "src/inspector/V8InspectorImpl.h" | 10 #include "src/inspector/V8InspectorImpl.h" |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 String16* heapSnapshotObjectId) { | 287 String16* heapSnapshotObjectId) { |
288 v8::HandleScope handles(m_isolate); | 288 v8::HandleScope handles(m_isolate); |
289 v8::Local<v8::Value> value; | 289 v8::Local<v8::Value> value; |
290 v8::Local<v8::Context> context; | 290 v8::Local<v8::Context> context; |
291 if (!m_session->unwrapObject(errorString, objectId, &value, &context, | 291 if (!m_session->unwrapObject(errorString, objectId, &value, &context, |
292 nullptr) || | 292 nullptr) || |
293 value->IsUndefined()) | 293 value->IsUndefined()) |
294 return; | 294 return; |
295 | 295 |
296 v8::SnapshotObjectId id = m_isolate->GetHeapProfiler()->GetObjectId(value); | 296 v8::SnapshotObjectId id = m_isolate->GetHeapProfiler()->GetObjectId(value); |
297 *heapSnapshotObjectId = String16::fromInteger(static_cast<size_t>(id)); | 297 *heapSnapshotObjectId = String16::fromInteger(id); |
298 } | 298 } |
299 | 299 |
300 void V8HeapProfilerAgentImpl::requestHeapStatsUpdate() { | 300 void V8HeapProfilerAgentImpl::requestHeapStatsUpdate() { |
301 HeapStatsStream stream(&m_frontend); | 301 HeapStatsStream stream(&m_frontend); |
302 v8::SnapshotObjectId lastSeenObjectId = | 302 v8::SnapshotObjectId lastSeenObjectId = |
303 m_isolate->GetHeapProfiler()->GetHeapStats(&stream); | 303 m_isolate->GetHeapProfiler()->GetHeapStats(&stream); |
304 m_frontend.lastSeenObjectId( | 304 m_frontend.lastSeenObjectId( |
305 lastSeenObjectId, m_session->inspector()->client()->currentTimeMS()); | 305 lastSeenObjectId, m_session->inspector()->client()->currentTimeMS()); |
306 } | 306 } |
307 | 307 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 *errorString = "Cannot access v8 sampled heap profile."; | 398 *errorString = "Cannot access v8 sampled heap profile."; |
399 return; | 399 return; |
400 } | 400 } |
401 v8::AllocationProfile::Node* root = v8Profile->GetRootNode(); | 401 v8::AllocationProfile::Node* root = v8Profile->GetRootNode(); |
402 *profile = protocol::HeapProfiler::SamplingHeapProfile::create() | 402 *profile = protocol::HeapProfiler::SamplingHeapProfile::create() |
403 .setHead(buildSampingHeapProfileNode(root)) | 403 .setHead(buildSampingHeapProfileNode(root)) |
404 .build(); | 404 .build(); |
405 } | 405 } |
406 | 406 |
407 } // namespace v8_inspector | 407 } // namespace v8_inspector |
OLD | NEW |