| 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 CHROME_GPU_GPU_ARC_VIDEO_SERVICE_H_ | 5 #ifndef CHROME_GPU_GPU_ARC_VIDEO_SERVICE_H_ |
| 6 #define CHROME_GPU_GPU_ARC_VIDEO_SERVICE_H_ | 6 #define CHROME_GPU_GPU_ARC_VIDEO_SERVICE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "components/arc/common/video.mojom.h" | 12 #include "components/arc/common/video.mojom.h" |
| 13 #include "mojo/public/cpp/bindings/strong_binding.h" | 13 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 14 | 14 |
| 15 namespace chromeos { | 15 namespace chromeos { |
| 16 namespace arc { | 16 namespace arc { |
| 17 | 17 |
| 18 // GpuArcVideoService manages life-cycle and IPC message translation for | 18 // GpuArcVideoService manages life-cycle and IPC message translation for |
| 19 // ArcVideoAccelerator. | 19 // ArcVideoAccelerator. |
| 20 // | 20 // |
| 21 // For each creation request from GpuArcVideoServiceHost, GpuArcVideoService | 21 // For each creation request from GpuArcVideoServiceHost, GpuArcVideoService |
| 22 // will create a new IPC channel. | 22 // will create a new IPC channel. |
| 23 class GpuArcVideoService : public ::arc::VideoHost { | 23 class GpuArcVideoService : public ::arc::mojom::VideoHost { |
| 24 public: | 24 public: |
| 25 class AcceleratorStub; | 25 class AcceleratorStub; |
| 26 | 26 |
| 27 // |request| is mojo interface request of arc::VideoHost. | 27 // |request| is mojo interface request of arc::mojom::VideoHost. |
| 28 explicit GpuArcVideoService(mojo::InterfaceRequest<::arc::VideoHost> request); | 28 explicit GpuArcVideoService( |
| 29 mojo::InterfaceRequest<::arc::mojom::VideoHost> request); |
| 29 | 30 |
| 30 // Upon deletion, all ArcVideoAccelerator will be deleted and the associated | 31 // Upon deletion, all ArcVideoAccelerator will be deleted and the associated |
| 31 // IPC channels are closed. | 32 // IPC channels are closed. |
| 32 ~GpuArcVideoService() override; | 33 ~GpuArcVideoService() override; |
| 33 | 34 |
| 34 // Removes the reference of |stub| (and trigger deletion) from this class. | 35 // Removes the reference of |stub| (and trigger deletion) from this class. |
| 35 void RemoveClient(AcceleratorStub* stub); | 36 void RemoveClient(AcceleratorStub* stub); |
| 36 | 37 |
| 37 private: | 38 private: |
| 38 // arc::VideoHost implementation. | 39 // arc::mojom::VideoHost implementation. |
| 39 void OnRequestArcVideoAcceleratorChannel( | 40 void OnRequestArcVideoAcceleratorChannel( |
| 40 const OnRequestArcVideoAcceleratorChannelCallback& callback) override; | 41 const OnRequestArcVideoAcceleratorChannelCallback& callback) override; |
| 41 | 42 |
| 42 base::ThreadChecker thread_checker_; | 43 base::ThreadChecker thread_checker_; |
| 43 | 44 |
| 44 // Binding of arc::VideoHost. It also takes ownership of |this|. | 45 // Binding of arc::mojom::VideoHost. It also takes ownership of |this|. |
| 45 mojo::StrongBinding<::arc::VideoHost> binding_; | 46 mojo::StrongBinding<::arc::mojom::VideoHost> binding_; |
| 46 | 47 |
| 47 // Bookkeeping all accelerator stubs. | 48 // Bookkeeping all accelerator stubs. |
| 48 std::map<AcceleratorStub*, std::unique_ptr<AcceleratorStub>> | 49 std::map<AcceleratorStub*, std::unique_ptr<AcceleratorStub>> |
| 49 accelerator_stubs_; | 50 accelerator_stubs_; |
| 50 | 51 |
| 51 DISALLOW_COPY_AND_ASSIGN(GpuArcVideoService); | 52 DISALLOW_COPY_AND_ASSIGN(GpuArcVideoService); |
| 52 }; | 53 }; |
| 53 | 54 |
| 54 } // namespace arc | 55 } // namespace arc |
| 55 } // namespace chromeos | 56 } // namespace chromeos |
| 56 | 57 |
| 57 #endif // CHROME_GPU_GPU_ARC_VIDEO_SERVICE_H_ | 58 #endif // CHROME_GPU_GPU_ARC_VIDEO_SERVICE_H_ |
| OLD | NEW |