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

Side by Side Diff: components/arc/input/arc_input_bridge_impl.cc

Issue 1554443003: Stop linking in the old Mojo EDK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge and fix new flaky test Created 4 years, 11 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 | « components/arc/arc_bridge_service_unittest.cc ('k') | components/html_viewer/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_impl.h" 5 #include "components/arc/input/arc_input_bridge_impl.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
11 #include <string> 11 #include <string>
12 12
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/posix/eintr_wrapper.h" 14 #include "base/posix/eintr_wrapper.h"
15 #include "base/thread_task_runner_handle.h" 15 #include "base/thread_task_runner_handle.h"
16 #include "base/time/time.h" 16 #include "base/time/time.h"
17 #include "components/arc/arc_bridge_service.h" 17 #include "components/arc/arc_bridge_service.h"
18 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h" 18 #include "mojo/edk/embedder/embedder.h"
19 #include "mojo/edk/embedder/scoped_platform_handle.h"
19 #include "ui/aura/env.h" 20 #include "ui/aura/env.h"
20 #include "ui/aura/env_observer.h" 21 #include "ui/aura/env_observer.h"
21 #include "ui/aura/window.h" 22 #include "ui/aura/window.h"
22 #include "ui/aura/window_observer.h" 23 #include "ui/aura/window_observer.h"
23 #include "ui/events/event.h" 24 #include "ui/events/event.h"
24 #include "ui/events/event_handler.h" 25 #include "ui/events/event_handler.h"
25 #include "ui/events/event_utils.h" 26 #include "ui/events/event_utils.h"
26 #include "ui/events/keycodes/dom/keycode_converter.h" 27 #include "ui/events/keycodes/dom/keycode_converter.h"
27 28
28 namespace { 29 namespace {
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 base::ScopedFD read_fd(fd[0]); 347 base::ScopedFD read_fd(fd[0]);
347 base::ScopedFD write_fd(fd[1]); 348 base::ScopedFD write_fd(fd[1]);
348 349
349 // The read end is sent to the instance, ownership of fd transfers. 350 // The read end is sent to the instance, ownership of fd transfers.
350 InputInstance* input_instance = arc_bridge_service_->input_instance(); 351 InputInstance* input_instance = arc_bridge_service_->input_instance();
351 if (!input_instance) { 352 if (!input_instance) {
352 VLOG(1) << "ArcBridgeService InputInstance disappeared."; 353 VLOG(1) << "ArcBridgeService InputInstance disappeared.";
353 return base::ScopedFD(); 354 return base::ScopedFD();
354 } 355 }
355 MojoHandle wrapped_handle; 356 MojoHandle wrapped_handle;
356 MojoResult wrap_result = mojo::embedder::CreatePlatformHandleWrapper( 357 MojoResult wrap_result = mojo::edk::CreatePlatformHandleWrapper(
357 mojo::embedder::ScopedPlatformHandle( 358 mojo::edk::ScopedPlatformHandle(
358 mojo::embedder::PlatformHandle(read_fd.release())), 359 mojo::edk::PlatformHandle(read_fd.release())),
359 &wrapped_handle); 360 &wrapped_handle);
360 if (wrap_result != MOJO_RESULT_OK) { 361 if (wrap_result != MOJO_RESULT_OK) {
361 LOG(WARNING) << "Pipe failed to wrap handles. Closing: " << wrap_result; 362 LOG(WARNING) << "Pipe failed to wrap handles. Closing: " << wrap_result;
362 return base::ScopedFD(); 363 return base::ScopedFD();
363 } 364 }
364 input_instance->RegisterInputDevice( 365 input_instance->RegisterInputDevice(
365 name, device_type, mojo::ScopedHandle(mojo::Handle(wrapped_handle))); 366 name, device_type, mojo::ScopedHandle(mojo::Handle(wrapped_handle)));
366 367
367 // setup write end as non blocking 368 // setup write end as non blocking
368 int flags = HANDLE_EINTR(fcntl(write_fd.get(), F_GETFL, 0)); 369 int flags = HANDLE_EINTR(fcntl(write_fd.get(), F_GETFL, 0));
369 if (res < 0) { 370 if (res < 0) {
370 VPLOG(1) << "Cannot get file descriptor flags"; 371 VPLOG(1) << "Cannot get file descriptor flags";
371 return base::ScopedFD(); 372 return base::ScopedFD();
372 } 373 }
373 374
374 res = HANDLE_EINTR(fcntl(write_fd.get(), F_SETFL, flags | O_NONBLOCK)); 375 res = HANDLE_EINTR(fcntl(write_fd.get(), F_SETFL, flags | O_NONBLOCK));
375 if (res < 0) { 376 if (res < 0) {
376 VPLOG(1) << "Cannot set file descriptor flags"; 377 VPLOG(1) << "Cannot set file descriptor flags";
377 return base::ScopedFD(); 378 return base::ScopedFD();
378 } 379 }
379 return write_fd; 380 return write_fd;
380 } 381 }
381 382
382 scoped_ptr<ArcInputBridge> ArcInputBridge::Create( 383 scoped_ptr<ArcInputBridge> ArcInputBridge::Create(
383 ArcBridgeService* arc_bridge_service) { 384 ArcBridgeService* arc_bridge_service) {
384 return make_scoped_ptr(new ArcInputBridgeImpl(arc_bridge_service)); 385 return make_scoped_ptr(new ArcInputBridgeImpl(arc_bridge_service));
385 } 386 }
386 387
387 } // namespace arc 388 } // namespace arc
OLDNEW
« no previous file with comments | « components/arc/arc_bridge_service_unittest.cc ('k') | components/html_viewer/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698