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

Side by Side Diff: ui/events/ozone/evdev/key_event_converter_evdev.cc

Issue 559713004: ozone: evdev: Convert CHECKs to DCHECKs per style guide (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
OLDNEW
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/key_event_converter_evdev.h" 5 #include "ui/events/ozone/evdev/key_event_converter_evdev.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <linux/input.h> 8 #include <linux/input.h>
9 9
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 ssize_t read_size = read(fd, inputs, sizeof(inputs)); 210 ssize_t read_size = read(fd, inputs, sizeof(inputs));
211 if (read_size < 0) { 211 if (read_size < 0) {
212 if (errno == EINTR || errno == EAGAIN) 212 if (errno == EINTR || errno == EAGAIN)
213 return; 213 return;
214 if (errno != ENODEV) 214 if (errno != ENODEV)
215 PLOG(ERROR) << "error reading device " << path_.value(); 215 PLOG(ERROR) << "error reading device " << path_.value();
216 Stop(); 216 Stop();
217 return; 217 return;
218 } 218 }
219 219
220 CHECK_EQ(read_size % sizeof(*inputs), 0u); 220 DCHECK_EQ(read_size % sizeof(*inputs), 0u);
221 ProcessEvents(inputs, read_size / sizeof(*inputs)); 221 ProcessEvents(inputs, read_size / sizeof(*inputs));
222 } 222 }
223 223
224 void KeyEventConverterEvdev::ProcessEvents(const input_event* inputs, 224 void KeyEventConverterEvdev::ProcessEvents(const input_event* inputs,
225 int count) { 225 int count) {
226 for (int i = 0; i < count; ++i) { 226 for (int i = 0; i < count; ++i) {
227 const input_event& input = inputs[i]; 227 const input_event& input = inputs[i];
228 if (input.type == EV_KEY) { 228 if (input.type == EV_KEY) {
229 ConvertKeyEvent(input.code, input.value); 229 ConvertKeyEvent(input.code, input.value);
230 } else if (input.type == EV_SYN) { 230 } else if (input.type == EV_SYN) {
(...skipping 22 matching lines...) Expand all
253 253
254 KeyEvent key_event( 254 KeyEvent key_event(
255 down ? ET_KEY_PRESSED : ET_KEY_RELEASED, 255 down ? ET_KEY_PRESSED : ET_KEY_RELEASED,
256 code, 256 code,
257 KeycodeConverter::NativeKeycodeToCode(key + kXkbKeycodeOffset), 257 KeycodeConverter::NativeKeycodeToCode(key + kXkbKeycodeOffset),
258 flags); 258 flags);
259 callback_.Run(&key_event); 259 callback_.Run(&key_event);
260 } 260 }
261 261
262 } // namespace ui 262 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/ozone/evdev/event_modifiers_evdev.cc ('k') | ui/events/ozone/evdev/key_event_converter_evdev_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698