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/InjectedScriptManager.h" | 8 #include "platform/v8_inspector/InjectedScriptManager.h" |
9 #include "platform/v8_inspector/V8DebuggerImpl.h" | 9 #include "platform/v8_inspector/V8DebuggerImpl.h" |
10 #include "platform/v8_inspector/V8RuntimeAgentImpl.h" | 10 #include "platform/v8_inspector/V8RuntimeAgentImpl.h" |
(...skipping 30 matching lines...) Loading... |
41 }; | 41 }; |
42 | 42 |
43 class GlobalObjectNameResolver final : public v8::HeapProfiler::ObjectNameResolv
er { | 43 class GlobalObjectNameResolver final : public v8::HeapProfiler::ObjectNameResolv
er { |
44 public: | 44 public: |
45 explicit GlobalObjectNameResolver(V8RuntimeAgentImpl* runtimeAgent) : m_runt
imeAgent(runtimeAgent) { } | 45 explicit GlobalObjectNameResolver(V8RuntimeAgentImpl* runtimeAgent) : m_runt
imeAgent(runtimeAgent) { } |
46 const char* GetName(v8::Local<v8::Object> object) override | 46 const char* GetName(v8::Local<v8::Object> object) override |
47 { | 47 { |
48 int contextId = V8Debugger::contextId(object->CreationContext()); | 48 int contextId = V8Debugger::contextId(object->CreationContext()); |
49 if (!contextId) | 49 if (!contextId) |
50 return ""; | 50 return ""; |
51 InjectedScript* injectedScript = m_runtimeAgent->injectedScriptManager()
->findInjectedScript(contextId); | 51 InjectedScript* injectedScript = m_runtimeAgent->getInjectedScriptManage
r()->findInjectedScript(contextId); |
52 if (!injectedScript) | 52 if (!injectedScript) |
53 return ""; | 53 return ""; |
54 String16 name = injectedScript->origin().latin1Data(); | 54 String16 name = injectedScript->origin().latin1Data(); |
55 m_strings.append(name); | 55 m_strings.append(name); |
56 return reinterpret_cast<const char *>(name.characters8()); | 56 return reinterpret_cast<const char *>(name.characters8()); |
57 } | 57 } |
58 | 58 |
59 private: | 59 private: |
60 protocol::Vector<String16> m_strings; | 60 protocol::Vector<String16> m_strings; |
61 V8RuntimeAgentImpl* m_runtimeAgent; | 61 V8RuntimeAgentImpl* m_runtimeAgent; |
(...skipping 274 matching lines...) Loading... |
336 if (!v8Profile) { | 336 if (!v8Profile) { |
337 *errorString = "Cannot access v8 sampled heap profile."; | 337 *errorString = "Cannot access v8 sampled heap profile."; |
338 return; | 338 return; |
339 } | 339 } |
340 v8::AllocationProfile::Node* root = v8Profile->GetRootNode(); | 340 v8::AllocationProfile::Node* root = v8Profile->GetRootNode(); |
341 *profile = protocol::HeapProfiler::SamplingHeapProfile::create() | 341 *profile = protocol::HeapProfiler::SamplingHeapProfile::create() |
342 .setHead(buildSampingHeapProfileNode(root)).build(); | 342 .setHead(buildSampingHeapProfileNode(root)).build(); |
343 } | 343 } |
344 | 344 |
345 } // namespace blink | 345 } // namespace blink |
OLD | NEW |