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