| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 return ""; | 50 return ""; |
| 51 InjectedScript* injectedScript = m_runtimeAgent->injectedScriptManager()
->findInjectedScript(contextId); | 51 InjectedScript* injectedScript = m_runtimeAgent->injectedScriptManager()
->findInjectedScript(contextId); |
| 52 if (!injectedScript) | 52 if (!injectedScript) |
| 53 return ""; | 53 return ""; |
| 54 CString name = injectedScript->origin().utf8(); | 54 CString name = injectedScript->origin().utf8(); |
| 55 m_strings.append(name); | 55 m_strings.append(name); |
| 56 return name.data(); | 56 return name.data(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 private: | 59 private: |
| 60 Vector<CString> m_strings; | 60 protocol::Vector<CString> m_strings; |
| 61 V8RuntimeAgentImpl* m_runtimeAgent; | 61 V8RuntimeAgentImpl* m_runtimeAgent; |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 class HeapSnapshotOutputStream final : public v8::OutputStream { | 64 class HeapSnapshotOutputStream final : public v8::OutputStream { |
| 65 public: | 65 public: |
| 66 HeapSnapshotOutputStream(protocol::Frontend::HeapProfiler* frontend) | 66 HeapSnapshotOutputStream(protocol::Frontend::HeapProfiler* frontend) |
| 67 : m_frontend(frontend) { } | 67 : m_frontend(frontend) { } |
| 68 void EndOfStream() override { } | 68 void EndOfStream() override { } |
| 69 int GetChunkSize() override { return 102400; } | 69 int GetChunkSize() override { return 102400; } |
| 70 WriteResult WriteAsciiChunk(char* data, int size) override | 70 WriteResult WriteAsciiChunk(char* data, int size) override |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |