| 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 <string> |
| 8 |
| 7 #include "base/location.h" | 9 #include "base/location.h" |
| 8 #include "base/logging.h" | 10 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 12 #include "base/threading/thread_task_runner_handle.h" |
| 11 #include "components/arc/common/video_accelerator.mojom.h" | 13 #include "components/arc/common/video_accelerator.mojom.h" |
| 12 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 13 #include "content/public/browser/gpu_service_registry.h" | 15 #include "content/public/browser/gpu_service_registry.h" |
| 14 #include "mojo/edk/embedder/embedder.h" | 16 #include "mojo/edk/embedder/embedder.h" |
| 15 #include "mojo/edk/embedder/platform_channel_pair.h" | 17 #include "mojo/edk/embedder/platform_channel_pair.h" |
| 16 #include "mojo/public/cpp/bindings/strong_binding.h" | 18 #include "mojo/public/cpp/bindings/strong_binding.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 private: | 56 private: |
| 55 mojo::StrongBinding<VideoAcceleratorFactory> binding_; | 57 mojo::StrongBinding<VideoAcceleratorFactory> binding_; |
| 56 | 58 |
| 57 DISALLOW_COPY_AND_ASSIGN(VideoAcceleratorFactoryService); | 59 DISALLOW_COPY_AND_ASSIGN(VideoAcceleratorFactoryService); |
| 58 }; | 60 }; |
| 59 | 61 |
| 60 GpuArcVideoServiceHost::GpuArcVideoServiceHost( | 62 GpuArcVideoServiceHost::GpuArcVideoServiceHost( |
| 61 arc::ArcBridgeService* bridge_service) | 63 arc::ArcBridgeService* bridge_service) |
| 62 : ArcService(bridge_service), binding_(this) { | 64 : ArcService(bridge_service), binding_(this) { |
| 63 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 65 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 64 arc_bridge_service()->AddObserver(this); | 66 arc_bridge_service()->video()->AddObserver(this); |
| 65 } | 67 } |
| 66 | 68 |
| 67 GpuArcVideoServiceHost::~GpuArcVideoServiceHost() { | 69 GpuArcVideoServiceHost::~GpuArcVideoServiceHost() { |
| 68 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 70 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 69 arc_bridge_service()->RemoveObserver(this); | 71 arc_bridge_service()->video()->RemoveObserver(this); |
| 70 } | 72 } |
| 71 | 73 |
| 72 void GpuArcVideoServiceHost::OnVideoInstanceReady() { | 74 void GpuArcVideoServiceHost::OnInstanceReady() { |
| 73 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 75 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 74 auto video_instance = arc_bridge_service()->video_instance(); | 76 auto video_instance = arc_bridge_service()->video()->instance(); |
| 75 DCHECK(video_instance); | 77 DCHECK(video_instance); |
| 76 video_instance->Init(binding_.CreateInterfacePtrAndBind()); | 78 video_instance->Init(binding_.CreateInterfacePtrAndBind()); |
| 77 } | 79 } |
| 78 | 80 |
| 79 void GpuArcVideoServiceHost::DeprecatedOnRequestArcVideoAcceleratorChannel( | 81 void GpuArcVideoServiceHost::DeprecatedOnRequestArcVideoAcceleratorChannel( |
| 80 const DeprecatedOnRequestArcVideoAcceleratorChannelCallback& callback) { | 82 const DeprecatedOnRequestArcVideoAcceleratorChannelCallback& callback) { |
| 81 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 83 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 82 | 84 |
| 83 // Hardcode pid 0 since it is unused in mojo. | 85 // Hardcode pid 0 since it is unused in mojo. |
| 84 const base::ProcessHandle kUnusedChildProcessHandle = | 86 const base::ProcessHandle kUnusedChildProcessHandle = |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 callback.Run(std::move(child_handle), token); | 151 callback.Run(std::move(child_handle), token); |
| 150 | 152 |
| 151 // The lifetime is managed by the StrongBinding insides the | 153 // The lifetime is managed by the StrongBinding insides the |
| 152 // VideoAcceleratorFactoryService. | 154 // VideoAcceleratorFactoryService. |
| 153 new VideoAcceleratorFactoryService( | 155 new VideoAcceleratorFactoryService( |
| 154 mojo::MakeRequest<mojom::VideoAcceleratorFactory>( | 156 mojo::MakeRequest<mojom::VideoAcceleratorFactory>( |
| 155 std::move(server_pipe))); | 157 std::move(server_pipe))); |
| 156 } | 158 } |
| 157 | 159 |
| 158 } // namespace arc | 160 } // namespace arc |
| OLD | NEW |