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_BROWSER_CHROMEOS_ARC_GPU_ARC_VIDEO_SERVICE_HOST_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_ARC_GPU_ARC_VIDEO_SERVICE_HOST_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/threading/thread_checker.h" |
| 11 #include "components/arc/arc_bridge_service.h" |
| 12 #include "components/arc/arc_service.h" |
| 13 #include "components/arc/common/video.mojom.h" |
| 14 #include "mojo/public/cpp/bindings/binding.h" |
| 15 #include "mojo/public/cpp/bindings/interface_ptr_info.h" |
| 16 |
| 17 namespace base { |
| 18 class SingleThreadTaskRunner; |
| 19 } |
| 20 |
| 21 namespace arc { |
| 22 |
| 23 // This class takes requests for creating channels of video accelerators from |
| 24 // arc::VideoInstance and forwards these requests to GpuArcVideoServce. It also |
| 25 // returns the created channels back to the arc::VideoInstance. |
| 26 // |
| 27 // This class is the proxy end of GpuArcVideoService and runs in the browser |
| 28 // process. The corresponding end "GpuArcVideoService" runs in the GPU process. |
| 29 class GpuArcVideoServiceHost : public arc::ArcService, |
| 30 public arc::ArcBridgeService::Observer, |
| 31 public arc::VideoHost { |
| 32 public: |
| 33 explicit GpuArcVideoServiceHost(arc::ArcBridgeService* bridge_service); |
| 34 ~GpuArcVideoServiceHost() override; |
| 35 |
| 36 // arc::ArcBridgeService::Observer implementation. |
| 37 void OnVideoInstanceReady() override; |
| 38 void OnVideoInstanceClosed() override; |
| 39 |
| 40 // arc::VideoHost implementation. |
| 41 void OnRequestArcVideoAcceleratorChannel( |
| 42 uint32_t pid, |
| 43 const OnRequestArcVideoAcceleratorChannelCallback& callback) override; |
| 44 |
| 45 private: |
| 46 void BindServiceAndCreateChannel( |
| 47 uint32_t pid, |
| 48 const OnRequestArcVideoAcceleratorChannelCallback& callback, |
| 49 mojo::InterfacePtrInfo<arc::VideoHost>* ptr_info); |
| 50 |
| 51 base::ThreadChecker thread_checker_; |
| 52 |
| 53 mojo::Binding<arc::VideoHost> binding_; |
| 54 |
| 55 // IO task runner, where GpuProcessHost tasks run. |
| 56 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
| 57 |
| 58 arc::VideoHostPtr service_ptr_; |
| 59 |
| 60 base::WeakPtrFactory<GpuArcVideoServiceHost> weak_factory_; |
| 61 |
| 62 DISALLOW_COPY_AND_ASSIGN(GpuArcVideoServiceHost); |
| 63 }; |
| 64 |
| 65 } // namespace arc |
| 66 |
| 67 #endif // CHROME_BROWSER_CHROMEOS_ARC_GPU_ARC_VIDEO_SERVICE_HOST_H_ |
OLD | NEW |