Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: chrome/gpu/gpu_arc_video_service.cc

Issue 2026533002: Utilize new mojo::UnwrapPlatformFile function (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix comment Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/threading/thread_task_runner_handle.h" 11 #include "base/threading/thread_task_runner_handle.h"
12 #include "chrome/gpu/arc_gpu_video_decode_accelerator.h" 12 #include "chrome/gpu/arc_gpu_video_decode_accelerator.h"
13 #include "mojo/edk/embedder/embedder.h"
14 #include "mojo/public/cpp/bindings/type_converter.h" 13 #include "mojo/public/cpp/bindings/type_converter.h"
14 #include "mojo/public/cpp/system/platform_handle.h"
15 15
16 namespace { 16 namespace {
17 void OnConnectionError() { 17 void OnConnectionError() {
18 DVLOG(2) << "OnConnectionError"; 18 DVLOG(2) << "OnConnectionError";
19 } 19 }
20 } // namespace 20 } // namespace
21 21
22 namespace mojo { 22 namespace mojo {
23 23
24 template <> 24 template <>
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 146
147 base::ScopedFD GpuArcVideoService::UnwrapFdFromMojoHandle( 147 base::ScopedFD GpuArcVideoService::UnwrapFdFromMojoHandle(
148 mojo::ScopedHandle handle) { 148 mojo::ScopedHandle handle) {
149 if (!handle.is_valid()) { 149 if (!handle.is_valid()) {
150 LOG(ERROR) << "handle is invalid"; 150 LOG(ERROR) << "handle is invalid";
151 client_->OnError( 151 client_->OnError(
152 ::arc::mojom::VideoAcceleratorServiceClient::Error::INVALID_ARGUMENT); 152 ::arc::mojom::VideoAcceleratorServiceClient::Error::INVALID_ARGUMENT);
153 return base::ScopedFD(); 153 return base::ScopedFD();
154 } 154 }
155 155
156 mojo::edk::ScopedPlatformHandle scoped_platform_handle; 156 base::PlatformFile platform_file;
157 MojoResult mojo_result = mojo::edk::PassWrappedPlatformHandle( 157 MojoResult mojo_result =
158 handle.release().value(), &scoped_platform_handle); 158 mojo::UnwrapPlatformFile(std::move(handle), &platform_file);
159 if (mojo_result != MOJO_RESULT_OK) { 159 if (mojo_result != MOJO_RESULT_OK) {
160 LOG(ERROR) << "PassWrappedPlatformHandle failed: " << mojo_result; 160 LOG(ERROR) << "UnwrapPlatformFile failed: " << mojo_result;
161 client_->OnError( 161 client_->OnError(
162 ::arc::mojom::VideoAcceleratorServiceClient::Error::PLATFORM_FAILURE); 162 ::arc::mojom::VideoAcceleratorServiceClient::Error::PLATFORM_FAILURE);
163 return base::ScopedFD(); 163 return base::ScopedFD();
164 } 164 }
165 165
166 return base::ScopedFD(scoped_platform_handle.release().handle); 166 return base::ScopedFD(platform_file);
167 } 167 }
168 168
169 void GpuArcVideoService::BindSharedMemory(::arc::mojom::PortType port, 169 void GpuArcVideoService::BindSharedMemory(::arc::mojom::PortType port,
170 uint32_t index, 170 uint32_t index,
171 mojo::ScopedHandle ashmem_handle, 171 mojo::ScopedHandle ashmem_handle,
172 uint32_t offset, 172 uint32_t offset,
173 uint32_t length) { 173 uint32_t length) {
174 DVLOG(2) << "BindSharedMemoryCallback port=" << port << ", index=" << index 174 DVLOG(2) << "BindSharedMemoryCallback port=" << port << ", index=" << index
175 << ", offset=" << offset << ", length=" << length; 175 << ", offset=" << offset << ", length=" << length;
176 176
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 accelerator_->Reset(); 212 accelerator_->Reset();
213 } 213 }
214 214
215 void GpuArcVideoService::Flush() { 215 void GpuArcVideoService::Flush() {
216 DVLOG(2) << "Flush"; 216 DVLOG(2) << "Flush";
217 accelerator_->Flush(); 217 accelerator_->Flush();
218 } 218 }
219 219
220 } // namespace arc 220 } // namespace arc
221 } // namespace chromeos 221 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698