OSDN Git Service

Add shared memory based buffer metadata
[android-x86/frameworks-native.git] / libs / vr / libpdx_uds / private / uds / channel_manager.h
1 #ifndef ANDROID_PDX_UDS_CHANNEL_MANAGER_H_
2 #define ANDROID_PDX_UDS_CHANNEL_MANAGER_H_
3
4 #include <mutex>
5 #include <unordered_map>
6
7 #include <pdx/channel_handle.h>
8 #include <pdx/file_handle.h>
9 #include <uds/channel_event_set.h>
10
11 namespace android {
12 namespace pdx {
13 namespace uds {
14
15 class ChannelManager : public ChannelManagerInterface {
16  public:
17   static ChannelManager& Get();
18
19   LocalChannelHandle CreateHandle(LocalHandle data_fd,
20                                   LocalHandle pollin_event_fd,
21                                   LocalHandle pollhup_event_fd);
22
23   ChannelEventReceiver* GetChannelData(int32_t handle);
24
25  private:
26   ChannelManager() = default;
27
28   void CloseHandle(int32_t handle) override;
29
30   std::mutex mutex_;
31   std::unordered_map<int32_t, ChannelEventReceiver> channels_;
32 };
33
34 }  // namespace uds
35 }  // namespace pdx
36 }  // namespace android
37
38 #endif  // ANDROID_PDX_UDS_CHANNEL_MANAGER_H_