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 arc { |
| 18 |
| 19 // This class takes requests for creating channels of video accelerators from |
| 20 // arc::VideoInstance and forwards these requests to GpuArcVideoServce. It also |
| 21 // returns the created channels back to the arc::VideoInstance. |
| 22 // |
| 23 // This class is the proxy end of GpuArcVideoService and runs in the browser |
| 24 // process. The corresponding end "GpuArcVideoService" runs in the GPU process. |
| 25 class GpuArcVideoServiceHost : public arc::ArcService, |
| 26 public arc::ArcBridgeService::Observer, |
| 27 public arc::VideoHost { |
| 28 public: |
| 29 explicit GpuArcVideoServiceHost(arc::ArcBridgeService* bridge_service); |
| 30 ~GpuArcVideoServiceHost() override; |
| 31 |
| 32 // arc::ArcBridgeService::Observer implementation. |
| 33 void OnVideoInstanceReady() override; |
| 34 void OnVideoInstanceClosed() override; |
| 35 |
| 36 // arc::VideoHost implementation. |
| 37 void OnRequestArcVideoAcceleratorChannel( |
| 38 const OnRequestArcVideoAcceleratorChannelCallback& callback) override; |
| 39 |
| 40 private: |
| 41 void BindServiceAndCreateChannel( |
| 42 const OnRequestArcVideoAcceleratorChannelCallback& callback, |
| 43 mojo::InterfacePtrInfo<arc::VideoHost> ptr_info); |
| 44 |
| 45 base::ThreadChecker thread_checker_; |
| 46 |
| 47 mojo::Binding<arc::VideoHost> binding_; |
| 48 |
| 49 arc::VideoHostPtr service_ptr_; |
| 50 |
| 51 base::WeakPtrFactory<GpuArcVideoServiceHost> weak_factory_; |
| 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(GpuArcVideoServiceHost); |
| 54 }; |
| 55 |
| 56 } // namespace arc |
| 57 |
| 58 #endif // CHROME_BROWSER_CHROMEOS_ARC_GPU_ARC_VIDEO_SERVICE_HOST_H_ |
OLD | NEW |