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