| 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/video/gpu_arc_video_service_host.h" | 5 #include "chrome/browser/chromeos/arc/video/gpu_arc_video_service_host.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
| 14 #include "base/threading/thread_task_runner_handle.h" | 14 #include "base/threading/thread_task_runner_handle.h" |
| 15 #include "components/arc/arc_bridge_service.h" | 15 #include "components/arc/arc_bridge_service.h" |
| 16 #include "components/arc/common/video_accelerator.mojom.h" | 16 #include "components/arc/common/video_decode_accelerator.mojom.h" |
| 17 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
| 18 #include "content/public/browser/gpu_service_registry.h" | 18 #include "content/public/browser/gpu_service_registry.h" |
| 19 #include "mojo/edk/embedder/embedder.h" | 19 #include "mojo/edk/embedder/embedder.h" |
| 20 #include "mojo/edk/embedder/outgoing_broker_client_invitation.h" | 20 #include "mojo/edk/embedder/outgoing_broker_client_invitation.h" |
| 21 #include "mojo/edk/embedder/platform_channel_pair.h" | 21 #include "mojo/edk/embedder/platform_channel_pair.h" |
| 22 #include "mojo/public/cpp/bindings/strong_binding.h" | 22 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 23 #include "services/service_manager/public/cpp/interface_provider.h" | 23 #include "services/service_manager/public/cpp/interface_provider.h" |
| 24 | 24 |
| 25 namespace arc { | 25 namespace arc { |
| 26 | 26 |
| 27 namespace { | 27 namespace { |
| 28 | 28 |
| 29 void ConnectToVideoAcceleratorServiceOnIOThread( | 29 void ConnectToVideoDecodeAcceleratorOnIOThread( |
| 30 mojom::VideoAcceleratorServiceRequest request) { | 30 mojom::VideoDecodeAcceleratorRequest request) { |
| 31 content::BindInterfaceInGpuProcess(std::move(request)); | 31 content::BindInterfaceInGpuProcess(std::move(request)); |
| 32 } | 32 } |
| 33 | 33 |
| 34 } // namespace | 34 } // namespace |
| 35 | 35 |
| 36 class VideoAcceleratorFactoryService : public mojom::VideoAcceleratorFactory { | 36 class VideoAcceleratorFactoryService : public mojom::VideoAcceleratorFactory { |
| 37 public: | 37 public: |
| 38 VideoAcceleratorFactoryService() = default; | 38 VideoAcceleratorFactoryService() = default; |
| 39 | 39 |
| 40 void Create(mojom::VideoAcceleratorServiceRequest request) override { | 40 void CreateDecodeAccelerator( |
| 41 mojom::VideoDecodeAcceleratorRequest request) override { |
| 41 content::BrowserThread::PostTask( | 42 content::BrowserThread::PostTask( |
| 42 content::BrowserThread::IO, FROM_HERE, | 43 content::BrowserThread::IO, FROM_HERE, |
| 43 base::BindOnce(&ConnectToVideoAcceleratorServiceOnIOThread, | 44 base::BindOnce(&ConnectToVideoDecodeAcceleratorOnIOThread, |
| 44 base::Passed(&request))); | 45 base::Passed(&request))); |
| 45 } | 46 } |
| 46 | 47 |
| 47 private: | 48 private: |
| 48 DISALLOW_COPY_AND_ASSIGN(VideoAcceleratorFactoryService); | 49 DISALLOW_COPY_AND_ASSIGN(VideoAcceleratorFactoryService); |
| 49 }; | 50 }; |
| 50 | 51 |
| 51 GpuArcVideoServiceHost::GpuArcVideoServiceHost(ArcBridgeService* bridge_service) | 52 GpuArcVideoServiceHost::GpuArcVideoServiceHost(ArcBridgeService* bridge_service) |
| 52 : ArcService(bridge_service), binding_(this) { | 53 : ArcService(bridge_service), binding_(this) { |
| 53 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 54 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 mojo::ScopedHandle child_handle{mojo::Handle(wrapped_handle)}; | 96 mojo::ScopedHandle child_handle{mojo::Handle(wrapped_handle)}; |
| 96 | 97 |
| 97 callback.Run(std::move(child_handle), token); | 98 callback.Run(std::move(child_handle), token); |
| 98 | 99 |
| 99 mojo::MakeStrongBinding( | 100 mojo::MakeStrongBinding( |
| 100 base::MakeUnique<VideoAcceleratorFactoryService>(), | 101 base::MakeUnique<VideoAcceleratorFactoryService>(), |
| 101 mojom::VideoAcceleratorFactoryRequest(std::move(server_pipe))); | 102 mojom::VideoAcceleratorFactoryRequest(std::move(server_pipe))); |
| 102 } | 103 } |
| 103 | 104 |
| 104 } // namespace arc | 105 } // namespace arc |
| OLD | NEW |