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 chromeos { |
| 15 namespace arc { |
| 16 |
| 17 // GpuArcVideoService manages life-cycle and IPC message translation for |
| 18 // ArcVideoAccelerator. |
| 19 // |
| 20 // For each creation request from GpuArcVideoServiceHost, GpuArcVideoService |
| 21 // will create a new IPC channel. |
| 22 class GpuArcVideoService : public ::arc::VideoHost { |
| 23 public: |
| 24 class AcceleratorStub; |
| 25 |
| 26 // |request| is mojo interface request of arc::VideoHost. |
| 27 explicit GpuArcVideoService(mojo::InterfaceRequest<::arc::VideoHost> request); |
| 28 |
| 29 // Upon deletion, all ArcVideoAccelerator will be deleted and the associated |
| 30 // IPC channels are closed. |
| 31 ~GpuArcVideoService() override; |
| 32 |
| 33 // Removes the reference of |stub| (and trigger deletion) from this class. |
| 34 void RemoveClient(AcceleratorStub* stub); |
| 35 |
| 36 private: |
| 37 // arc::VideoHost implementation. |
| 38 void OnRequestArcVideoAcceleratorChannel( |
| 39 uint32_t pid, |
| 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*, scoped_ptr<AcceleratorStub>> accelerator_stubs_; |
| 49 |
| 50 DISALLOW_COPY_AND_ASSIGN(GpuArcVideoService); |
| 51 }; |
| 52 |
| 53 } // namespace arc |
| 54 } // namespace chromeos |
| 55 |
| 56 #endif // CHROME_GPU_GPU_ARC_VIDEO_SERVICE_H_ |
OLD | NEW |