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