| 54 | } |
| 55 | |
| 56 | BytesView HermesJavaScriptContextFactory::dumpHeap(std::span<IJavaScriptContext*> jsContexts, |
| 57 | JSExceptionTracker& exceptionTracker) { |
| 58 | if constexpr (shouldEnableJsHeapDump()) { |
| 59 | Valdi::JavaScriptHeapDumpBuilder heapDumpBuilder; |
| 60 | |
| 61 | for (auto* jsContext : jsContexts) { |
| 62 | auto heapDump = dynamic_cast<HermesJavaScriptContext*>(jsContext)->dumpHeap(exceptionTracker); |
| 63 | if (!exceptionTracker) { |
| 64 | return BytesView(); |
| 65 | } |
| 66 | |
| 67 | heapDumpBuilder.appendDump(heapDump.data(), heapDump.size(), exceptionTracker); |
| 68 | if (!exceptionTracker) { |
| 69 | return BytesView(); |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | return heapDumpBuilder.build(); |
| 74 | } else { |
| 75 | exceptionTracker.onError("Heap dump support not enabled"); |
| 76 | return BytesView(); |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | } // namespace Valdi::Hermes |
nothing calls this directly
no test coverage detected