diff options
Diffstat (limited to '')
-rw-r--r-- | third_party/libwebrtc/modules/desktop_capture/linux/wayland/restore_token_manager.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/third_party/libwebrtc/modules/desktop_capture/linux/wayland/restore_token_manager.h b/third_party/libwebrtc/modules/desktop_capture/linux/wayland/restore_token_manager.h new file mode 100644 index 0000000000..ad4f74790f --- /dev/null +++ b/third_party/libwebrtc/modules/desktop_capture/linux/wayland/restore_token_manager.h @@ -0,0 +1,46 @@ +/* + * Copyright 2022 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef MODULES_DESKTOP_CAPTURE_LINUX_WAYLAND_RESTORE_TOKEN_MANAGER_H_ +#define MODULES_DESKTOP_CAPTURE_LINUX_WAYLAND_RESTORE_TOKEN_MANAGER_H_ + +#include <mutex> +#include <string> +#include <unordered_map> + +#include "modules/desktop_capture/desktop_capturer.h" + +namespace webrtc { + +class RestoreTokenManager { + public: + RestoreTokenManager(const RestoreTokenManager& manager) = delete; + RestoreTokenManager& operator=(const RestoreTokenManager& manager) = delete; + + static RestoreTokenManager& GetInstance(); + + void AddToken(DesktopCapturer::SourceId id, const std::string& token); + std::string GetToken(DesktopCapturer::SourceId id); + + // Returns a source ID which does not have any token associated with it yet. + DesktopCapturer::SourceId GetUnusedId(); + + private: + RestoreTokenManager() = default; + ~RestoreTokenManager() = default; + + DesktopCapturer::SourceId last_source_id_ = 0; + + std::unordered_map<DesktopCapturer::SourceId, std::string> restore_tokens_; +}; + +} // namespace webrtc + +#endif // MODULES_DESKTOP_CAPTURE_LINUX_WAYLAND_RESTORE_TOKEN_MANAGER_H_ |