| 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/gpu/gpu_arc_video_service.h" | 5 #include "chrome/gpu/gpu_arc_video_service.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/thread_task_runner_handle.h" | 13 #include "base/thread_task_runner_handle.h" |
| 14 #include "chrome/gpu/arc_gpu_video_decode_accelerator.h" |
| 14 #include "chrome/gpu/arc_video_accelerator.h" | 15 #include "chrome/gpu/arc_video_accelerator.h" |
| 15 #include "components/arc/common/video_accelerator.mojom.h" | 16 #include "components/arc/common/video_accelerator.mojom.h" |
| 16 #include "mojo/edk/embedder/embedder.h" | 17 #include "mojo/edk/embedder/embedder.h" |
| 17 #include "mojo/public/cpp/bindings/binding.h" | 18 #include "mojo/public/cpp/bindings/binding.h" |
| 18 #include "mojo/public/cpp/bindings/type_converter.h" | 19 #include "mojo/public/cpp/bindings/type_converter.h" |
| 19 | 20 |
| 20 namespace mojo { | 21 namespace mojo { |
| 21 | 22 |
| 22 template <> | 23 template <> |
| 23 struct TypeConverter<arc::mojom::BufferMetadataPtr, | 24 struct TypeConverter<arc::mojom::BufferMetadataPtr, |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 106 |
| 106 client_.Bind( | 107 client_.Bind( |
| 107 mojo::InterfacePtrInfo<::arc::mojom::VideoAcceleratorServiceClient>( | 108 mojo::InterfacePtrInfo<::arc::mojom::VideoAcceleratorServiceClient>( |
| 108 std::move(server_pipe), 0u)); | 109 std::move(server_pipe), 0u)); |
| 109 | 110 |
| 110 // base::Unretained is safe because we own |client_| | 111 // base::Unretained is safe because we own |client_| |
| 111 client_.set_connection_error_handler( | 112 client_.set_connection_error_handler( |
| 112 base::Bind(&GpuArcVideoService::AcceleratorStub::OnConnectionError, | 113 base::Bind(&GpuArcVideoService::AcceleratorStub::OnConnectionError, |
| 113 base::Unretained(this))); | 114 base::Unretained(this))); |
| 114 | 115 |
| 115 // TODO(kcwu): create ArcGpuVideoDecodeAccelerator here. | 116 accelerator_.reset(new ArcGpuVideoDecodeAccelerator()); |
| 116 // accelerator_.reset(new ArcGpuVideoDecodeAccelerator()); | |
| 117 | 117 |
| 118 ::arc::mojom::VideoAcceleratorServicePtr service; | 118 ::arc::mojom::VideoAcceleratorServicePtr service; |
| 119 binding_.Bind(GetProxy(&service)); | 119 binding_.Bind(GetProxy(&service)); |
| 120 // base::Unretained is safe because we own |binding_| | 120 // base::Unretained is safe because we own |binding_| |
| 121 binding_.set_connection_error_handler( | 121 binding_.set_connection_error_handler( |
| 122 base::Bind(&GpuArcVideoService::AcceleratorStub::OnConnectionError, | 122 base::Bind(&GpuArcVideoService::AcceleratorStub::OnConnectionError, |
| 123 base::Unretained(this))); | 123 base::Unretained(this))); |
| 124 | 124 |
| 125 client_->Init(std::move(service)); | 125 client_->Init(std::move(service)); |
| 126 return true; | 126 return true; |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 | 256 |
| 257 callback.Run(mojo::ScopedHandle(mojo::Handle(wrapped_handle)), token); | 257 callback.Run(mojo::ScopedHandle(mojo::Handle(wrapped_handle)), token); |
| 258 } | 258 } |
| 259 | 259 |
| 260 void GpuArcVideoService::RemoveClient(AcceleratorStub* stub) { | 260 void GpuArcVideoService::RemoveClient(AcceleratorStub* stub) { |
| 261 accelerator_stubs_.erase(stub); | 261 accelerator_stubs_.erase(stub); |
| 262 } | 262 } |
| 263 | 263 |
| 264 } // namespace arc | 264 } // namespace arc |
| 265 } // namespace chromeos | 265 } // namespace chromeos |
| OLD | NEW |