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

Side by Side Diff: ui/events/devices/device_util_linux.cc

Issue 688163004: Move X11 device processing to worker threads (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix-blocking-touchscreen
Patch Set: Add null Created 6 years, 1 month 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 | ui/events/platform/x11/x11_event_source.h » ('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 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/devices/device_util_linux.h" 5 #include "ui/events/devices/device_util_linux.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/files/file_enumerator.h" 9 #include "base/files/file_enumerator.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/message_loop/message_loop.h"
11 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
12 13
13 namespace ui { 14 namespace ui {
14 15
16 // We consider the touchscreen to be internal if it is an I2c device. We search
17 // all the dev input nodes registered by I2C devices to see if we can find
18 // eventXXX.
15 bool IsTouchscreenInternal(const base::FilePath& path) { 19 bool IsTouchscreenInternal(const base::FilePath& path) {
20 DCHECK(!base::MessageLoopForUI::IsCurrent());
16 std::string event_node = path.BaseName().value(); 21 std::string event_node = path.BaseName().value();
17 if (event_node.empty() || !StartsWithASCII(event_node, "event", false)) 22 if (event_node.empty() || !StartsWithASCII(event_node, "event", false))
18 return false; 23 return false;
19 24
20 // Extract id "XXX" from "eventXXX" 25 // Extract id "XXX" from "eventXXX"
21 std::string event_node_id = event_node.substr(5); 26 std::string event_node_id = event_node.substr(5);
22 27
23 // I2C input device registers its dev input node at 28 // I2C input device registers its dev input node at
24 // /sys/bus/i2c/devices/*/input/inputXXX/eventXXX 29 // /sys/bus/i2c/devices/*/input/inputXXX/eventXXX
25 base::FileEnumerator i2c_enum( 30 base::FileEnumerator i2c_enum(
(...skipping 11 matching lines...) Expand all
37 input = input_enum.Next()) { 42 input = input_enum.Next()) {
38 if (input.BaseName().value().substr(5) == event_node_id) 43 if (input.BaseName().value().substr(5) == event_node_id)
39 return true; 44 return true;
40 } 45 }
41 } 46 }
42 47
43 return false; 48 return false;
44 } 49 }
45 50
46 } // namespace 51 } // namespace
OLDNEW
« no previous file with comments | « no previous file | ui/events/platform/x11/x11_event_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698