| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 protocol::HeapProfiler::Frontend* m_frontend; | 43 protocol::HeapProfiler::Frontend* m_frontend; |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 class GlobalObjectNameResolver final : public v8::HeapProfiler::ObjectNameResolv
er { | 46 class GlobalObjectNameResolver final : public v8::HeapProfiler::ObjectNameResolv
er { |
| 47 public: | 47 public: |
| 48 explicit GlobalObjectNameResolver(V8InspectorSessionImpl* session) | 48 explicit GlobalObjectNameResolver(V8InspectorSessionImpl* session) |
| 49 : m_offset(0), m_strings(10000), m_session(session) {} | 49 : m_offset(0), m_strings(10000), m_session(session) {} |
| 50 | 50 |
| 51 const char* GetName(v8::Local<v8::Object> object) override | 51 const char* GetName(v8::Local<v8::Object> object) override |
| 52 { | 52 { |
| 53 int contextId = V8Debugger::contextId(object->CreationContext()); | 53 int contextId = V8DebuggerImpl::contextId(object->CreationContext()); |
| 54 if (!contextId) | 54 if (!contextId) |
| 55 return ""; | 55 return ""; |
| 56 ErrorString errorString; | 56 ErrorString errorString; |
| 57 InjectedScript* injectedScript = m_session->findInjectedScript(&errorStr
ing, contextId); | 57 InjectedScript* injectedScript = m_session->findInjectedScript(&errorStr
ing, contextId); |
| 58 if (!injectedScript) | 58 if (!injectedScript) |
| 59 return ""; | 59 return ""; |
| 60 String16 name = injectedScript->context()->origin(); | 60 String16 name = injectedScript->context()->origin(); |
| 61 size_t length = name.length(); | 61 size_t length = name.length(); |
| 62 if (m_offset + length + 1 >= m_strings.size()) | 62 if (m_offset + length + 1 >= m_strings.size()) |
| 63 return ""; | 63 return ""; |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 *errorString = "Cannot access v8 sampled heap profile."; | 390 *errorString = "Cannot access v8 sampled heap profile."; |
| 391 return; | 391 return; |
| 392 } | 392 } |
| 393 v8::AllocationProfile::Node* root = v8Profile->GetRootNode(); | 393 v8::AllocationProfile::Node* root = v8Profile->GetRootNode(); |
| 394 *profile = protocol::HeapProfiler::SamplingHeapProfile::create() | 394 *profile = protocol::HeapProfiler::SamplingHeapProfile::create() |
| 395 .setHead(buildSampingHeapProfileNode(root)).build(); | 395 .setHead(buildSampingHeapProfileNode(root)).build(); |
| 396 #endif | 396 #endif |
| 397 } | 397 } |
| 398 | 398 |
| 399 } // namespace blink | 399 } // namespace blink |
| OLD | NEW |