Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/arc/input/arc_input_bridge.h" | 5 #include "components/arc/input/arc_input_bridge.h" |
| 6 | 6 |
| 7 #include <linux/input.h> | 7 #include <linux/input.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 | 10 |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 333 int fd[2]; | 333 int fd[2]; |
| 334 int res = HANDLE_EINTR(pipe(fd)); | 334 int res = HANDLE_EINTR(pipe(fd)); |
| 335 if (res < 0) { | 335 if (res < 0) { |
| 336 VPLOG(1) << "Cannot create pipe"; | 336 VPLOG(1) << "Cannot create pipe"; |
| 337 return base::ScopedFD(); | 337 return base::ScopedFD(); |
| 338 } | 338 } |
| 339 base::ScopedFD read_fd(fd[0]); | 339 base::ScopedFD read_fd(fd[0]); |
| 340 base::ScopedFD write_fd(fd[1]); | 340 base::ScopedFD write_fd(fd[1]); |
| 341 | 341 |
| 342 // The read end is sent to the instance, ownership of fd transfers. | 342 // The read end is sent to the instance, ownership of fd transfers. |
| 343 InputInstance* input_instance = arc_bridge_service()->input_instance(); | 343 mojom::InputInstance* input_instance = arc_bridge_service()->input_instance(); |
| 344 if (!input_instance) { | 344 if (!input_instance) { |
| 345 VLOG(1) << "ArcBridgeService InputInstance disappeared."; | 345 VLOG(1) << "ArcBridgeService mojom::InputInstance disappeared."; |
|
Luis Héctor Chávez
2016/04/14 17:26:54
nit: Leave this log as-is.
leonhsl(Using Gerrit)
2016/04/15 06:33:25
Done.
| |
| 346 return base::ScopedFD(); | 346 return base::ScopedFD(); |
| 347 } | 347 } |
| 348 MojoHandle wrapped_handle; | 348 MojoHandle wrapped_handle; |
| 349 MojoResult wrap_result = mojo::edk::CreatePlatformHandleWrapper( | 349 MojoResult wrap_result = mojo::edk::CreatePlatformHandleWrapper( |
| 350 mojo::edk::ScopedPlatformHandle( | 350 mojo::edk::ScopedPlatformHandle( |
| 351 mojo::edk::PlatformHandle(read_fd.release())), | 351 mojo::edk::PlatformHandle(read_fd.release())), |
| 352 &wrapped_handle); | 352 &wrapped_handle); |
| 353 if (wrap_result != MOJO_RESULT_OK) { | 353 if (wrap_result != MOJO_RESULT_OK) { |
| 354 LOG(WARNING) << "Pipe failed to wrap handles. Closing: " << wrap_result; | 354 LOG(WARNING) << "Pipe failed to wrap handles. Closing: " << wrap_result; |
| 355 return base::ScopedFD(); | 355 return base::ScopedFD(); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 366 | 366 |
| 367 res = HANDLE_EINTR(fcntl(write_fd.get(), F_SETFL, flags | O_NONBLOCK)); | 367 res = HANDLE_EINTR(fcntl(write_fd.get(), F_SETFL, flags | O_NONBLOCK)); |
| 368 if (res < 0) { | 368 if (res < 0) { |
| 369 VPLOG(1) << "Cannot set file descriptor flags"; | 369 VPLOG(1) << "Cannot set file descriptor flags"; |
| 370 return base::ScopedFD(); | 370 return base::ScopedFD(); |
| 371 } | 371 } |
| 372 return write_fd; | 372 return write_fd; |
| 373 } | 373 } |
| 374 | 374 |
| 375 } // namespace arc | 375 } // namespace arc |
| OLD | NEW |