diff options
| author | Mason Reed <mason@vector35.com> | 2025-10-07 14:32:48 -0400 |
|---|---|---|
| committer | Mason Reed <mason@vector35.com> | 2025-10-07 14:33:34 -0400 |
| commit | 4a227e0523391bc026bf96c3c31d44a39cac1701 (patch) | |
| tree | cc603b899a446fb469a0be3ae4c2c77e6351c091 /plugins/warp/ui/shared/fetcher.h | |
| parent | 3e24f6ab0b373d8718e26a19ac296044cc0d19c6 (diff) | |
[WARP] Format UI plugin
Diffstat (limited to 'plugins/warp/ui/shared/fetcher.h')
| -rw-r--r-- | plugins/warp/ui/shared/fetcher.h | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/plugins/warp/ui/shared/fetcher.h b/plugins/warp/ui/shared/fetcher.h index 917ac912..52d0a0e2 100644 --- a/plugins/warp/ui/shared/fetcher.h +++ b/plugins/warp/ui/shared/fetcher.h @@ -12,43 +12,44 @@ enum WarpFetchCompletionStatus { - KeepCallback, - RemoveCallback, + KeepCallback, + RemoveCallback, }; // Responsible for fetching data from the containers, to later be queried from the container interface. class WarpFetcher { - LoggerRef m_logger; + LoggerRef m_logger; - std::mutex m_requestMutex; - std::vector<FunctionRef> m_pendingRequests; - std::unordered_set<Warp::FunctionGUID> m_processedGuids; + std::mutex m_requestMutex; + std::vector<FunctionRef> m_pendingRequests; + std::unordered_set<Warp::FunctionGUID> m_processedGuids; - // List of callbacks to call when done fetching data, assume that others are using this as well. - std::vector<std::function<WarpFetchCompletionStatus()> > m_completionCallbacks; + // List of callbacks to call when done fetching data, assume that others are using this as well. + std::vector<std::function<WarpFetchCompletionStatus()>> m_completionCallbacks; public: - explicit WarpFetcher(); + explicit WarpFetcher(); - // The global fetcher instance, this is used for the fetch dialog and the sidebar. - static std::shared_ptr<WarpFetcher> Global(); + // The global fetcher instance, this is used for the fetch dialog and the sidebar. + static std::shared_ptr<WarpFetcher> Global(); - std::atomic<bool> m_requestInProgress = false; + std::atomic<bool> m_requestInProgress = false; - void AddCompletionCallback(std::function<WarpFetchCompletionStatus()> cb) - { - std::lock_guard<std::mutex> lock(m_requestMutex); - m_completionCallbacks.push_back(std::move(cb)); - } + void AddCompletionCallback(std::function<WarpFetchCompletionStatus()> cb) + { + std::lock_guard<std::mutex> lock(m_requestMutex); + m_completionCallbacks.push_back(std::move(cb)); + } - void AddPendingFunction(const FunctionRef &func); + void AddPendingFunction(const FunctionRef& func); - void FetchPendingFunctions(const std::vector<Warp::SourceTag>& allowedTags); + void FetchPendingFunctions(const std::vector<Warp::SourceTag>& allowedTags); + + void ClearProcessed(); - void ClearProcessed(); private: - std::vector<FunctionRef> FlushPendingFunctions(); + std::vector<FunctionRef> FlushPendingFunctions(); - void ExecuteCompletionCallback(); + void ExecuteCompletionCallback(); }; |
