OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/events/ozone/evdev/libgestures_glue/event_reader_libevdev_cros.h" | 5 #include "ui/events/ozone/evdev/libgestures_glue/event_reader_libevdev_cros.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <libevdev/libevdev.h> | 8 #include <libevdev/libevdev.h> |
9 #include <linux/input.h> | 9 #include <linux/input.h> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
14 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
15 #include "base/trace_event/trace_event.h" | 15 #include "base/trace_event/trace_event.h" |
16 | 16 |
17 namespace ui { | 17 namespace ui { |
18 | 18 |
19 namespace { | 19 namespace { |
20 | 20 |
21 std::string FormatLog(const char* fmt, va_list args) { | 21 std::string FormatLog(const char* fmt, va_list args) { |
22 std::string msg = base::StringPrintV(fmt, args); | 22 std::string msg = base::StringPrintV(fmt, args); |
23 if (!msg.empty() && msg[msg.size() - 1] == '\n') | 23 if (!msg.empty() && msg.back() == '\n') |
24 msg.erase(msg.end() - 1, msg.end()); | 24 msg.pop_back(); |
25 return msg; | 25 return msg; |
26 } | 26 } |
27 | 27 |
28 } // namespace | 28 } // namespace |
29 | 29 |
30 EventReaderLibevdevCros::EventReaderLibevdevCros( | 30 EventReaderLibevdevCros::EventReaderLibevdevCros( |
31 int fd, | 31 int fd, |
32 const base::FilePath& path, | 32 const base::FilePath& path, |
33 int id, | 33 int id, |
34 const EventDeviceInfo& devinfo, | 34 const EventDeviceInfo& devinfo, |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 if (level >= LOGLEVEL_ERROR) | 127 if (level >= LOGLEVEL_ERROR) |
128 LOG(ERROR) << "libevdev: " << FormatLog(fmt, args); | 128 LOG(ERROR) << "libevdev: " << FormatLog(fmt, args); |
129 else if (level >= LOGLEVEL_WARNING) | 129 else if (level >= LOGLEVEL_WARNING) |
130 LOG(WARNING) << "libevdev: " << FormatLog(fmt, args); | 130 LOG(WARNING) << "libevdev: " << FormatLog(fmt, args); |
131 else | 131 else |
132 VLOG(3) << "libevdev: " << FormatLog(fmt, args); | 132 VLOG(3) << "libevdev: " << FormatLog(fmt, args); |
133 va_end(args); | 133 va_end(args); |
134 } | 134 } |
135 | 135 |
136 } // namespace ui | 136 } // namespace ui |
OLD | NEW |