| 262 | |
| 263 | bool doDispose() { |
| 264 | if (_context == nullptr) { |
| 265 | return false; |
| 266 | } |
| 267 | auto context = std::move(_context); |
| 268 | _contextManager.destroyContext(context); |
| 269 | |
| 270 | return true; |
| 271 | } |
| 272 | |
| 273 | Valdi::Value getReachableObjectsDescription() override { |
| 274 | if (_context == nullptr) { |
| 275 | return Valdi::Value::undefined(); |
| 276 | } |
| 277 | |
| 278 | auto disposables = _context->getAllDisposables(); |
| 279 | ValueArrayBuilder output; |
| 280 | for (auto* disposable : disposables) { |
| 281 | auto* attachedObject = dynamic_cast<ContextAttachedValdiObject*>(disposable); |
| 282 | if (attachedObject == nullptr) { |
| 283 | continue; |
| 284 | } |
| 285 | auto innerObject = attachedObject->getInnerValdiObject(); |
| 286 | if (innerObject == nullptr) { |
| 287 | continue; |
| 288 | } |
| 289 | output.append(Value(innerObject->getDebugDescription())); |
| 290 | } |
| 291 | |
| 292 | return Value(output.build()); |
| 293 | } |
| 294 | |
| 295 | constexpr const Ref<Context>& getContext() const { |
| 296 | return _context; |
| 297 | } |
| 298 | |
| 299 | private: |
| 300 | ContextManager& _contextManager; |
| 301 | Ref<Context> _context; |
| 302 | }; |
| 303 | |
| 304 | JavaScriptStacktraceCaptureSession::JavaScriptStacktraceCaptureSession() = default; |
| 305 | JavaScriptStacktraceCaptureSession::~JavaScriptStacktraceCaptureSession() = default; |
| 306 | |
| 307 | void JavaScriptStacktraceCaptureSession::setCapturedStacktrace(const JavaScriptCapturedStacktrace& capturedStacktrace) { |
| 308 | std::lock_guard<Mutex> lock(_mutex); |
| 309 | _capturedStacktrace = {capturedStacktrace}; |
| 310 | } |
| 311 | |
| 312 | bool JavaScriptStacktraceCaptureSession::finishedCapture() const { |
| 313 | std::lock_guard<Mutex> lock(_mutex); |
| 314 | return _capturedStacktrace.has_value(); |
| 315 | } |
| 316 | |
| 317 | std::optional<JavaScriptCapturedStacktrace> JavaScriptStacktraceCaptureSession::getCapturedStacktrace() const { |
nothing calls this directly
no test coverage detected