// Copyright (c) 2022 Sentry. All Rights Reserved. #pragma once #include "HAL/CriticalSection.h" #include "Interface/SentrySubsystemInterface.h" class SentryScopeDesktop; class SentryCrashReporter; #if USE_SENTRY_NATIVE class SentrySubsystemDesktop : public ISentrySubsystem { public: SentrySubsystemDesktop(); virtual void InitWithSettings(const USentrySettings* settings, USentryBeforeSendHandler* beforeSendHandler, USentryTraceSampler* traceSampler) override; virtual void Close() override; virtual bool IsEnabled() override; virtual ESentryCrashedLastRun IsCrashedLastRun() override; virtual void AddBreadcrumb(TSharedPtr breadcrumb) override; virtual void AddBreadcrumbWithParams(const FString& Message, const FString& Category, const FString& Type, const TMap& Data, ESentryLevel Level) override; virtual void ClearBreadcrumbs() override; virtual TSharedPtr CaptureMessage(const FString& message, ESentryLevel level) override; virtual TSharedPtr CaptureMessageWithScope(const FString& message, const FSentryScopeDelegate& onScopeConfigure, ESentryLevel level) override; virtual TSharedPtr CaptureEvent(TSharedPtr event) override; virtual TSharedPtr CaptureEventWithScope(TSharedPtr event, const FSentryScopeDelegate& onScopeConfigure) override; virtual TSharedPtr CaptureException(const FString& type, const FString& message, int32 framesToSkip) override; virtual TSharedPtr CaptureAssertion(const FString& type, const FString& message) override; virtual TSharedPtr CaptureEnsure(const FString& type, const FString& message) override; virtual void CaptureUserFeedback(TSharedPtr userFeedback) override; virtual void SetUser(TSharedPtr user) override; virtual void RemoveUser() override; virtual void ConfigureScope(const FSentryScopeDelegate& onConfigureScope) override; virtual void SetContext(const FString& key, const TMap& values) override; virtual void SetTag(const FString& key, const FString& value) override; virtual void RemoveTag(const FString& key) override; virtual void SetLevel(ESentryLevel level) override; virtual void StartSession() override; virtual void EndSession() override; virtual TSharedPtr StartTransaction(const FString& name, const FString& operation) override; virtual TSharedPtr StartTransactionWithContext(TSharedPtr context) override; virtual TSharedPtr StartTransactionWithContextAndTimestamp(TSharedPtr context, int64 timestamp) override; virtual TSharedPtr StartTransactionWithContextAndOptions(TSharedPtr context, const TMap& options) override; virtual TSharedPtr ContinueTrace(const FString& sentryTrace, const TArray& baggageHeaders) override; USentryBeforeSendHandler* GetBeforeSendHandler(); void TryCaptureScreenshot() const; FString GetGpuDumpBackupPath() const; TSharedPtr GetCurrentScope(); private: FString GetHandlerPath() const; FString GetDatabasePath() const; FString GetScreenshotPath() const; USentryBeforeSendHandler* beforeSend; TSharedPtr crashReporter; TArray> scopeStack; bool isEnabled; bool isStackTraceEnabled; bool isScreenshotAttachmentEnabled; FCriticalSection CriticalSection; FString databaseParentPath; }; #endif