| 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> | 7 #include <string> |
| 8 #include <utility> |
| 8 | 9 |
| 9 #include "base/location.h" | 10 #include "base/location.h" |
| 10 #include "base/logging.h" | 11 #include "base/logging.h" |
| 11 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 12 #include "base/threading/thread_task_runner_handle.h" | 13 #include "base/threading/thread_task_runner_handle.h" |
| 13 #include "components/arc/common/video_accelerator.mojom.h" | 14 #include "components/arc/common/video_accelerator.mojom.h" |
| 14 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
| 15 #include "content/public/browser/gpu_service_registry.h" | 16 #include "content/public/browser/gpu_service_registry.h" |
| 16 #include "mojo/edk/embedder/embedder.h" | 17 #include "mojo/edk/embedder/embedder.h" |
| 17 #include "mojo/edk/embedder/platform_channel_pair.h" | 18 #include "mojo/edk/embedder/platform_channel_pair.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 arc_bridge_service()->video()->AddObserver(this); | 63 arc_bridge_service()->video()->AddObserver(this); |
| 63 } | 64 } |
| 64 | 65 |
| 65 GpuArcVideoServiceHost::~GpuArcVideoServiceHost() { | 66 GpuArcVideoServiceHost::~GpuArcVideoServiceHost() { |
| 66 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 67 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 67 arc_bridge_service()->video()->RemoveObserver(this); | 68 arc_bridge_service()->video()->RemoveObserver(this); |
| 68 } | 69 } |
| 69 | 70 |
| 70 void GpuArcVideoServiceHost::OnInstanceReady() { | 71 void GpuArcVideoServiceHost::OnInstanceReady() { |
| 71 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 72 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 72 auto* video_instance = arc_bridge_service()->video()->instance(); | 73 auto* video_instance = |
| 73 DCHECK(video_instance); | 74 arc_bridge_service()->video()->GetInstanceForMethod("Init"); |
| 75 CHECK(video_instance); |
| 74 video_instance->Init(binding_.CreateInterfacePtrAndBind()); | 76 video_instance->Init(binding_.CreateInterfacePtrAndBind()); |
| 75 } | 77 } |
| 76 | 78 |
| 77 void GpuArcVideoServiceHost::DeprecatedOnRequestArcVideoAcceleratorChannel( | 79 void GpuArcVideoServiceHost::DeprecatedOnRequestArcVideoAcceleratorChannel( |
| 78 const DeprecatedOnRequestArcVideoAcceleratorChannelCallback& callback) { | 80 const DeprecatedOnRequestArcVideoAcceleratorChannelCallback& callback) { |
| 79 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 81 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 80 | 82 |
| 81 // Hardcode pid 0 since it is unused in mojo. | 83 // Hardcode pid 0 since it is unused in mojo. |
| 82 const base::ProcessHandle kUnusedChildProcessHandle = | 84 const base::ProcessHandle kUnusedChildProcessHandle = |
| 83 base::kNullProcessHandle; | 85 base::kNullProcessHandle; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 return; | 147 return; |
| 146 } | 148 } |
| 147 callback.Run(std::move(child_handle), token); | 149 callback.Run(std::move(child_handle), token); |
| 148 | 150 |
| 149 mojo::MakeStrongBinding(base::MakeUnique<VideoAcceleratorFactoryService>(), | 151 mojo::MakeStrongBinding(base::MakeUnique<VideoAcceleratorFactoryService>(), |
| 150 mojo::MakeRequest<mojom::VideoAcceleratorFactory>( | 152 mojo::MakeRequest<mojom::VideoAcceleratorFactory>( |
| 151 std::move(server_pipe))); | 153 std::move(server_pipe))); |
| 152 } | 154 } |
| 153 | 155 |
| 154 } // namespace arc | 156 } // namespace arc |
| OLD | NEW |