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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 explicit GlobalObjectNameResolver(V8RuntimeAgentImpl* runtimeAgent) : m_offs
et(0), m_runtimeAgent(runtimeAgent) | 48 explicit GlobalObjectNameResolver(V8RuntimeAgentImpl* runtimeAgent) : m_offs
et(0), m_runtimeAgent(runtimeAgent) |
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 = V8Debugger::contextId(object->CreationContext()); |
56 if (!contextId) | 56 if (!contextId) |
57 return ""; | 57 return ""; |
58 InjectedScript* injectedScript = m_runtimeAgent->getInjectedScriptManage
r()->findInjectedScript(contextId); | 58 ErrorString errorString; |
| 59 InjectedScript* injectedScript = m_runtimeAgent->getInjectedScriptManage
r()->findInjectedScript(&errorString, contextId); |
59 if (!injectedScript) | 60 if (!injectedScript) |
60 return ""; | 61 return ""; |
61 String16 name = injectedScript->origin(); | 62 String16 name = injectedScript->origin(); |
62 size_t length = name.length(); | 63 size_t length = name.length(); |
63 if (m_offset + length + 1 >= m_strings.size()) | 64 if (m_offset + length + 1 >= m_strings.size()) |
64 return ""; | 65 return ""; |
65 for (size_t i = 0; i < length; ++i) { | 66 for (size_t i = 0; i < length; ++i) { |
66 UChar ch = name[i]; | 67 UChar ch = name[i]; |
67 m_strings[m_offset + i] = ch > 0xff ? '?' : static_cast<char>(ch); | 68 m_strings[m_offset + i] = ch > 0xff ? '?' : static_cast<char>(ch); |
68 } | 69 } |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 *errorString = "Cannot access v8 sampled heap profile."; | 362 *errorString = "Cannot access v8 sampled heap profile."; |
362 return; | 363 return; |
363 } | 364 } |
364 v8::AllocationProfile::Node* root = v8Profile->GetRootNode(); | 365 v8::AllocationProfile::Node* root = v8Profile->GetRootNode(); |
365 *profile = protocol::HeapProfiler::SamplingHeapProfile::create() | 366 *profile = protocol::HeapProfiler::SamplingHeapProfile::create() |
366 .setHead(buildSampingHeapProfileNode(root)).build(); | 367 .setHead(buildSampingHeapProfileNode(root)).build(); |
367 #endif | 368 #endif |
368 } | 369 } |
369 | 370 |
370 } // namespace blink | 371 } // namespace blink |
OLD | NEW |