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