| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 55 |
| 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 arc_bridge_service()->AddObserver(this); | 65 arc_bridge_service()->video()->AddObserver(this); |
| 64 } | 66 } |
| 65 | 67 |
| 66 GpuArcVideoServiceHost::~GpuArcVideoServiceHost() { | 68 GpuArcVideoServiceHost::~GpuArcVideoServiceHost() { |
| 67 DCHECK(thread_checker_.CalledOnValidThread()); | 69 DCHECK(thread_checker_.CalledOnValidThread()); |
| 68 arc_bridge_service()->RemoveObserver(this); | 70 arc_bridge_service()->video()->RemoveObserver(this); |
| 69 } | 71 } |
| 70 | 72 |
| 71 void GpuArcVideoServiceHost::OnVideoInstanceReady() { | 73 void GpuArcVideoServiceHost::OnInstanceReady() { |
| 72 DCHECK(thread_checker_.CalledOnValidThread()); | 74 DCHECK(thread_checker_.CalledOnValidThread()); |
| 73 auto video_instance = arc_bridge_service()->video_instance(); | 75 auto video_instance = arc_bridge_service()->video()->instance(); |
| 74 DCHECK(video_instance); | 76 DCHECK(video_instance); |
| 75 video_instance->Init(binding_.CreateInterfacePtrAndBind()); | 77 video_instance->Init(binding_.CreateInterfacePtrAndBind()); |
| 76 } | 78 } |
| 77 | 79 |
| 78 void GpuArcVideoServiceHost::DeprecatedOnRequestArcVideoAcceleratorChannel( | 80 void GpuArcVideoServiceHost::DeprecatedOnRequestArcVideoAcceleratorChannel( |
| 79 const DeprecatedOnRequestArcVideoAcceleratorChannelCallback& callback) { | 81 const DeprecatedOnRequestArcVideoAcceleratorChannelCallback& callback) { |
| 80 DCHECK(thread_checker_.CalledOnValidThread()); | 82 DCHECK(thread_checker_.CalledOnValidThread()); |
| 81 | 83 |
| 82 // Hardcode pid 0 since it is unused in mojo. | 84 // Hardcode pid 0 since it is unused in mojo. |
| 83 const base::ProcessHandle kUnusedChildProcessHandle = | 85 const base::ProcessHandle kUnusedChildProcessHandle = |
| (...skipping 65 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<::arc::mojom::VideoAcceleratorFactory>( | 156 mojo::MakeRequest<::arc::mojom::VideoAcceleratorFactory>( |
| 155 std::move(server_pipe))); | 157 std::move(server_pipe))); |
| 156 } | 158 } |
| 157 | 159 |
| 158 } // namespace arc | 160 } // namespace arc |
| OLD | NEW |