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 #include "chrome/browser/chromeos/arc/gpu_arc_video_service_host.h" | 5 #include "chrome/browser/chromeos/arc/gpu_arc_video_service_host.h" |
6 | 6 |
7 #include "base/location.h" | 7 #include "base/location.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
11 #include "components/arc/common/video_accelerator.mojom.h" | 11 #include "components/arc/common/video_accelerator.mojom.h" |
12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
13 #include "content/public/browser/gpu_service_registry.h" | 13 #include "content/public/browser/gpu_service_registry.h" |
14 #include "content/public/common/service_registry.h" | |
15 #include "mojo/edk/embedder/embedder.h" | 14 #include "mojo/edk/embedder/embedder.h" |
16 #include "mojo/edk/embedder/platform_channel_pair.h" | 15 #include "mojo/edk/embedder/platform_channel_pair.h" |
| 16 #include "services/shell/public/cpp/interface_provider.h" |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 void ConnectToVideoAcceleratorServiceOnIOThread( | 20 void ConnectToVideoAcceleratorServiceOnIOThread( |
21 arc::mojom::VideoAcceleratorServiceClientRequest request) { | 21 arc::mojom::VideoAcceleratorServiceClientRequest request) { |
22 content::ServiceRegistry* registry = content::GetGpuServiceRegistry(); | |
23 | |
24 // Note |request| is not a ServiceRequest. It is a ClientRequest but doesn't | 22 // Note |request| is not a ServiceRequest. It is a ClientRequest but doesn't |
25 // request for a Client. Instead, it requests for a Service while specified | 23 // request for a Client. Instead, it requests for a Service while specified |
26 // the client. It works this odd way because the interfaces were modeled as | 24 // the client. It works this odd way because the interfaces were modeled as |
27 // arc's "Host notifies to Instance::Init", not mojo's typical "Client | 25 // arc's "Host notifies to Instance::Init", not mojo's typical "Client |
28 // registers to Service". | 26 // registers to Service". |
29 // TODO(kcwu): revise the interface. | 27 // TODO(kcwu): revise the interface. |
30 registry->ConnectToRemoteService(std::move(request)); | 28 content::GetGpuInterfaceProvider()->GetInterface(std::move(request)); |
31 } | 29 } |
32 | 30 |
33 } // namespace | 31 } // namespace |
34 | 32 |
35 namespace arc { | 33 namespace arc { |
36 | 34 |
37 GpuArcVideoServiceHost::GpuArcVideoServiceHost( | 35 GpuArcVideoServiceHost::GpuArcVideoServiceHost( |
38 arc::ArcBridgeService* bridge_service) | 36 arc::ArcBridgeService* bridge_service) |
39 : ArcService(bridge_service), binding_(this) { | 37 : ArcService(bridge_service), binding_(this) { |
40 arc_bridge_service()->AddObserver(this); | 38 arc_bridge_service()->AddObserver(this); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 content::BrowserThread::PostTask( | 85 content::BrowserThread::PostTask( |
88 content::BrowserThread::IO, FROM_HERE, | 86 content::BrowserThread::IO, FROM_HERE, |
89 base::Bind( | 87 base::Bind( |
90 &ConnectToVideoAcceleratorServiceOnIOThread, | 88 &ConnectToVideoAcceleratorServiceOnIOThread, |
91 base::Passed( | 89 base::Passed( |
92 mojo::MakeRequest<::arc::mojom::VideoAcceleratorServiceClient>( | 90 mojo::MakeRequest<::arc::mojom::VideoAcceleratorServiceClient>( |
93 std::move(server_pipe))))); | 91 std::move(server_pipe))))); |
94 } | 92 } |
95 | 93 |
96 } // namespace arc | 94 } // namespace arc |
OLD | NEW |