OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_GPU_ARC_VIDEO_SERVICE_HOST_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_GPU_ARC_VIDEO_SERVICE_HOST_H_ |
6 #define CHROME_BROWSER_CHROMEOS_ARC_GPU_ARC_VIDEO_SERVICE_HOST_H_ | 6 #define CHROME_BROWSER_CHROMEOS_ARC_GPU_ARC_VIDEO_SERVICE_HOST_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/threading/thread_checker.h" | 10 #include "base/threading/thread_checker.h" |
11 #include "components/arc/arc_bridge_service.h" | 11 #include "components/arc/arc_bridge_service.h" |
12 #include "components/arc/arc_service.h" | 12 #include "components/arc/arc_service.h" |
13 #include "components/arc/common/video.mojom.h" | 13 #include "components/arc/common/video.mojom.h" |
14 #include "mojo/public/cpp/bindings/binding.h" | 14 #include "mojo/public/cpp/bindings/binding.h" |
15 #include "mojo/public/cpp/bindings/interface_ptr_info.h" | 15 #include "mojo/public/cpp/bindings/interface_ptr_info.h" |
16 | 16 |
17 namespace arc { | 17 namespace arc { |
18 | 18 |
19 // This class takes requests for creating channels of video accelerators from | 19 // This class takes requests for creating channels of video accelerators from |
20 // arc::VideoInstance and forwards these requests to GpuArcVideoServce. It also | 20 // arc::VideoInstance and forwards these requests to GpuArcVideoServce. It also |
21 // returns the created channels back to the arc::VideoInstance. | 21 // returns the created channels back to the arc::VideoInstance. |
22 // | 22 // |
23 // This class is the proxy end of GpuArcVideoService and runs in the browser | 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. | 24 // process. The corresponding end "GpuArcVideoService" runs in the GPU process. |
25 class GpuArcVideoServiceHost : public arc::ArcService, | 25 class GpuArcVideoServiceHost : public arc::ArcService, |
26 public arc::ArcBridgeService::Observer, | 26 public arc::ArcBridgeService::Observer, |
27 public arc::VideoHost { | 27 public arc::mojom::VideoHost { |
28 public: | 28 public: |
29 explicit GpuArcVideoServiceHost(arc::ArcBridgeService* bridge_service); | 29 explicit GpuArcVideoServiceHost(arc::ArcBridgeService* bridge_service); |
30 ~GpuArcVideoServiceHost() override; | 30 ~GpuArcVideoServiceHost() override; |
31 | 31 |
32 // arc::ArcBridgeService::Observer implementation. | 32 // arc::ArcBridgeService::Observer implementation. |
33 void OnVideoInstanceReady() override; | 33 void OnVideoInstanceReady() override; |
34 void OnVideoInstanceClosed() override; | 34 void OnVideoInstanceClosed() override; |
35 | 35 |
36 // arc::VideoHost implementation. | 36 // arc::mojom::VideoHost implementation. |
37 void OnRequestArcVideoAcceleratorChannel( | 37 void OnRequestArcVideoAcceleratorChannel( |
38 const OnRequestArcVideoAcceleratorChannelCallback& callback) override; | 38 const OnRequestArcVideoAcceleratorChannelCallback& callback) override; |
39 | 39 |
40 private: | 40 private: |
41 void BindServiceAndCreateChannel( | 41 void BindServiceAndCreateChannel( |
42 const OnRequestArcVideoAcceleratorChannelCallback& callback, | 42 const OnRequestArcVideoAcceleratorChannelCallback& callback, |
43 mojo::InterfacePtrInfo<arc::VideoHost> ptr_info); | 43 mojo::InterfacePtrInfo<arc::mojom::VideoHost> ptr_info); |
44 | 44 |
45 base::ThreadChecker thread_checker_; | 45 base::ThreadChecker thread_checker_; |
46 | 46 |
47 mojo::Binding<arc::VideoHost> binding_; | 47 mojo::Binding<arc::mojom::VideoHost> binding_; |
48 | 48 |
49 arc::VideoHostPtr service_ptr_; | 49 arc::mojom::VideoHostPtr service_ptr_; |
50 | 50 |
51 base::WeakPtrFactory<GpuArcVideoServiceHost> weak_factory_; | 51 base::WeakPtrFactory<GpuArcVideoServiceHost> weak_factory_; |
52 | 52 |
53 DISALLOW_COPY_AND_ASSIGN(GpuArcVideoServiceHost); | 53 DISALLOW_COPY_AND_ASSIGN(GpuArcVideoServiceHost); |
54 }; | 54 }; |
55 | 55 |
56 } // namespace arc | 56 } // namespace arc |
57 | 57 |
58 #endif // CHROME_BROWSER_CHROMEOS_ARC_GPU_ARC_VIDEO_SERVICE_HOST_H_ | 58 #endif // CHROME_BROWSER_CHROMEOS_ARC_GPU_ARC_VIDEO_SERVICE_HOST_H_ |
OLD | NEW |