| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MEDIA_GPU_IPC_SERVICE_MEDIA_GPU_CHANNEL_MANAGER_H_ | 5 #ifndef MEDIA_GPU_IPC_SERVICE_MEDIA_GPU_CHANNEL_MANAGER_H_ |
| 6 #define MEDIA_GPU_IPC_SERVICE_MEDIA_GPU_CHANNEL_MANAGER_H_ | 6 #define MEDIA_GPU_IPC_SERVICE_MEDIA_GPU_CHANNEL_MANAGER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <unordered_map> | 11 #include <unordered_map> |
| 12 | 12 |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/unguessable_token.h" | 15 #include "base/unguessable_token.h" |
| 16 #include "ipc/ipc_listener.h" | 16 #include "ipc/ipc_listener.h" |
| 17 #include "ipc/ipc_sender.h" | 17 #include "ipc/ipc_sender.h" |
| 18 #include "media/base/android_overlay_mojo_factory.h" |
| 18 #include "media/video/video_decode_accelerator.h" | 19 #include "media/video/video_decode_accelerator.h" |
| 19 | 20 |
| 20 namespace gpu { | 21 namespace gpu { |
| 21 class GpuChannel; | 22 class GpuChannel; |
| 22 class GpuChannelManager; | 23 class GpuChannelManager; |
| 23 } | 24 } |
| 24 | 25 |
| 25 namespace media { | 26 namespace media { |
| 26 | 27 |
| 27 class MediaGpuChannel; | 28 class MediaGpuChannel; |
| 28 | 29 |
| 29 class MediaGpuChannelManager | 30 class MediaGpuChannelManager |
| 30 : public base::SupportsWeakPtr<MediaGpuChannelManager> { | 31 : public base::SupportsWeakPtr<MediaGpuChannelManager> { |
| 31 public: | 32 public: |
| 32 explicit MediaGpuChannelManager(gpu::GpuChannelManager* channel_manager); | 33 explicit MediaGpuChannelManager(gpu::GpuChannelManager* channel_manager); |
| 33 ~MediaGpuChannelManager(); | 34 ~MediaGpuChannelManager(); |
| 34 | 35 |
| 35 void AddChannel(int32_t client_id); | 36 void AddChannel(int32_t client_id); |
| 36 void RemoveChannel(int32_t client_id); | 37 void RemoveChannel(int32_t client_id); |
| 37 void DestroyAllChannels(); | 38 void DestroyAllChannels(); |
| 38 | 39 |
| 40 void SetOverlayFactory(AndroidOverlayMojoFactoryCB overlay_factory_cb); |
| 41 |
| 39 // TODO(sandersd): Should we expose the MediaGpuChannel instead? | 42 // TODO(sandersd): Should we expose the MediaGpuChannel instead? |
| 40 gpu::GpuChannel* LookupChannel(const base::UnguessableToken& channel_token); | 43 gpu::GpuChannel* LookupChannel(const base::UnguessableToken& channel_token); |
| 41 | 44 |
| 42 private: | 45 private: |
| 43 gpu::GpuChannelManager* const channel_manager_; | 46 gpu::GpuChannelManager* const channel_manager_; |
| 44 std::unordered_map<int32_t, std::unique_ptr<MediaGpuChannel>> | 47 std::unordered_map<int32_t, std::unique_ptr<MediaGpuChannel>> |
| 45 media_gpu_channels_; | 48 media_gpu_channels_; |
| 46 std::map<base::UnguessableToken, int32_t> token_to_channel_; | 49 std::map<base::UnguessableToken, int32_t> token_to_channel_; |
| 47 std::map<int32_t, base::UnguessableToken> channel_to_token_; | 50 std::map<int32_t, base::UnguessableToken> channel_to_token_; |
| 51 AndroidOverlayMojoFactoryCB overlay_factory_cb_; |
| 48 DISALLOW_COPY_AND_ASSIGN(MediaGpuChannelManager); | 52 DISALLOW_COPY_AND_ASSIGN(MediaGpuChannelManager); |
| 49 }; | 53 }; |
| 50 | 54 |
| 51 } // namespace media | 55 } // namespace media |
| 52 | 56 |
| 53 #endif // MEDIA_GPU_IPC_SERVICE_MEDIA_GPU_CHANNEL_MANAGER_H_ | 57 #endif // MEDIA_GPU_IPC_SERVICE_MEDIA_GPU_CHANNEL_MANAGER_H_ |
| OLD | NEW |