| 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 <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/files/scoped_file.h" | 10 #include "base/files/scoped_file.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "chrome/gpu/arc_video_accelerator.h" | 12 #include "chrome/gpu/arc_video_accelerator.h" |
| 13 #include "components/arc/common/video_accelerator.mojom.h" | 13 #include "components/arc/common/video_accelerator.mojom.h" |
| 14 #include "gpu/command_buffer/service/gpu_preferences.h" |
| 14 #include "mojo/public/cpp/bindings/strong_binding.h" | 15 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 15 | 16 |
| 16 namespace chromeos { | 17 namespace chromeos { |
| 17 namespace arc { | 18 namespace arc { |
| 18 | 19 |
| 19 // GpuArcVideoService manages life-cycle and IPC message translation for | 20 // GpuArcVideoService manages life-cycle and IPC message translation for |
| 20 // ArcVideoAccelerator. | 21 // ArcVideoAccelerator. |
| 21 // | 22 // |
| 22 // For each creation request from GpuArcVideoServiceHost, GpuArcVideoService | 23 // For each creation request from GpuArcVideoServiceHost, GpuArcVideoService |
| 23 // will create a new IPC channel. | 24 // will create a new IPC channel. |
| 24 class GpuArcVideoService : public ::arc::mojom::VideoAcceleratorService, | 25 class GpuArcVideoService : public ::arc::mojom::VideoAcceleratorService, |
| 25 public ArcVideoAccelerator::Client { | 26 public ArcVideoAccelerator::Client { |
| 26 public: | 27 public: |
| 27 explicit GpuArcVideoService( | 28 GpuArcVideoService( |
| 28 ::arc::mojom::VideoAcceleratorServiceRequest request); | 29 ::arc::mojom::VideoAcceleratorServiceRequest request, |
| 29 GpuArcVideoService(); | 30 const gpu::GpuPreferences& gpu_preferences); |
| 31 explicit GpuArcVideoService(const gpu::GpuPreferences& gpu_preferences); |
| 30 ~GpuArcVideoService() override; | 32 ~GpuArcVideoService() override; |
| 31 | 33 |
| 32 // Connects to VideoAcceleratorServiceClient. | 34 // Connects to VideoAcceleratorServiceClient. |
| 33 // |request| specified the message pipe of client to use. | 35 // |request| specified the message pipe of client to use. |
| 34 void Connect(::arc::mojom::VideoAcceleratorServiceClientRequest request); | 36 void Connect(::arc::mojom::VideoAcceleratorServiceClientRequest request); |
| 35 | 37 |
| 36 private: | 38 private: |
| 37 // ArcVideoAccelerator::Client implementation. | 39 // ArcVideoAccelerator::Client implementation. |
| 38 void OnError(ArcVideoAccelerator::Result error) override; | 40 void OnError(ArcVideoAccelerator::Result error) override; |
| 39 void OnBufferDone(PortType port, | 41 void OnBufferDone(PortType port, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 68 uint32_t index, | 70 uint32_t index, |
| 69 ::arc::mojom::BufferMetadataPtr metadata) override; | 71 ::arc::mojom::BufferMetadataPtr metadata) override; |
| 70 void SetNumberOfOutputBuffers(uint32_t number) override; | 72 void SetNumberOfOutputBuffers(uint32_t number) override; |
| 71 void Flush() override; | 73 void Flush() override; |
| 72 void Reset() override; | 74 void Reset() override; |
| 73 | 75 |
| 74 base::ScopedFD UnwrapFdFromMojoHandle(mojo::ScopedHandle handle); | 76 base::ScopedFD UnwrapFdFromMojoHandle(mojo::ScopedHandle handle); |
| 75 | 77 |
| 76 base::ThreadChecker thread_checker_; | 78 base::ThreadChecker thread_checker_; |
| 77 | 79 |
| 80 gpu::GpuPreferences gpu_preferences_; |
| 78 std::unique_ptr<ArcVideoAccelerator> accelerator_; | 81 std::unique_ptr<ArcVideoAccelerator> accelerator_; |
| 79 ::arc::mojom::VideoAcceleratorServiceClientPtr client_; | 82 ::arc::mojom::VideoAcceleratorServiceClientPtr client_; |
| 80 | 83 |
| 81 // Binding of arc::mojom::VideoAcceleratorService. It also takes ownership of | 84 // Binding of arc::mojom::VideoAcceleratorService. It also takes ownership of |
| 82 // |this|. | 85 // |this|. |
| 83 mojo::StrongBinding<::arc::mojom::VideoAcceleratorService> binding_; | 86 mojo::StrongBinding<::arc::mojom::VideoAcceleratorService> binding_; |
| 84 | 87 |
| 85 DISALLOW_COPY_AND_ASSIGN(GpuArcVideoService); | 88 DISALLOW_COPY_AND_ASSIGN(GpuArcVideoService); |
| 86 }; | 89 }; |
| 87 | 90 |
| 88 } // namespace arc | 91 } // namespace arc |
| 89 } // namespace chromeos | 92 } // namespace chromeos |
| 90 | 93 |
| 91 #endif // CHROME_GPU_GPU_ARC_VIDEO_SERVICE_H_ | 94 #endif // CHROME_GPU_GPU_ARC_VIDEO_SERVICE_H_ |
| OLD | NEW |