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

Side by Side Diff: ui/events/platform/x11/x11_hotplug_event_handler.cc

Issue 2860703002: Use TaskScheduler instead of WorkerPool in x11_hotplug_event_handler.cc. (Closed)
Patch Set: Add ScopedTaskEnvironment in SoftwareOutputDeviceOzoneTest Created 3 years, 7 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 | « ui/compositor/test/test_suite.cc ('k') | no next file » | 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/platform/x11/x11_hotplug_event_handler.h" 5 #include "ui/events/platform/x11/x11_hotplug_event_handler.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <X11/extensions/XInput.h> 8 #include <X11/extensions/XInput.h>
9 #include <X11/extensions/XInput2.h> 9 #include <X11/extensions/XInput2.h>
10 #include <X11/Xatom.h> 10 #include <X11/Xatom.h>
11 11
12 #include <algorithm> 12 #include <algorithm>
13 #include <cmath> 13 #include <cmath>
14 #include <set> 14 #include <set>
15 #include <string> 15 #include <string>
16 #include <vector> 16 #include <vector>
17 17
18 #include "base/bind.h" 18 #include "base/bind.h"
19 #include "base/command_line.h" 19 #include "base/command_line.h"
20 #include "base/location.h" 20 #include "base/location.h"
21 #include "base/logging.h" 21 #include "base/logging.h"
22 #include "base/process/launch.h" 22 #include "base/process/launch.h"
23 #include "base/single_thread_task_runner.h" 23 #include "base/single_thread_task_runner.h"
24 #include "base/strings/string_util.h" 24 #include "base/strings/string_util.h"
25 #include "base/sys_info.h" 25 #include "base/sys_info.h"
26 #include "base/task_scheduler/post_task.h"
26 #include "base/threading/thread_task_runner_handle.h" 27 #include "base/threading/thread_task_runner_handle.h"
27 #include "base/threading/worker_pool.h"
28 #include "ui/events/devices/device_data_manager.h" 28 #include "ui/events/devices/device_data_manager.h"
29 #include "ui/events/devices/device_hotplug_event_observer.h" 29 #include "ui/events/devices/device_hotplug_event_observer.h"
30 #include "ui/events/devices/device_util_linux.h" 30 #include "ui/events/devices/device_util_linux.h"
31 #include "ui/events/devices/input_device.h" 31 #include "ui/events/devices/input_device.h"
32 #include "ui/events/devices/touchscreen_device.h" 32 #include "ui/events/devices/touchscreen_device.h"
33 #include "ui/gfx/x/x11_types.h" 33 #include "ui/gfx/x/x11_types.h"
34 34
35 #ifndef XI_PROP_PRODUCT_ID 35 #ifndef XI_PROP_PRODUCT_ID
36 #define XI_PROP_PRODUCT_ID "Device Product ID" 36 #define XI_PROP_PRODUCT_ID "Device Product ID"
37 #endif 37 #endif
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 display_state.mt_position_x = atom_cache_.GetAtom("Abs MT Position X"); 486 display_state.mt_position_x = atom_cache_.GetAtom("Abs MT Position X");
487 display_state.mt_position_y = atom_cache_.GetAtom("Abs MT Position Y"); 487 display_state.mt_position_y = atom_cache_.GetAtom("Abs MT Position Y");
488 488
489 UiCallbacks callbacks; 489 UiCallbacks callbacks;
490 callbacks.keyboard_callback = base::Bind(&OnKeyboardDevices); 490 callbacks.keyboard_callback = base::Bind(&OnKeyboardDevices);
491 callbacks.touchscreen_callback = base::Bind(&OnTouchscreenDevices); 491 callbacks.touchscreen_callback = base::Bind(&OnTouchscreenDevices);
492 callbacks.mouse_callback = base::Bind(&OnMouseDevices); 492 callbacks.mouse_callback = base::Bind(&OnMouseDevices);
493 callbacks.touchpad_callback = base::Bind(&OnTouchpadDevices); 493 callbacks.touchpad_callback = base::Bind(&OnTouchpadDevices);
494 callbacks.hotplug_finished_callback = base::Bind(&OnHotplugFinished); 494 callbacks.hotplug_finished_callback = base::Bind(&OnHotplugFinished);
495 495
496 // Parsing the device information may block, so delegate the operation to a 496 // Parse the device information asynchronously since this operation may block.
497 // worker thread. Once the device information is extracted the parsed devices 497 // Once the device information is extracted the parsed devices will be
498 // will be returned via the callbacks. 498 // returned via the callbacks.
499 base::WorkerPool::PostTask( 499 base::PostTaskWithTraits(
500 FROM_HERE, 500 FROM_HERE,
501 base::Bind(&HandleHotplugEventInWorker, device_infos, display_state, 501 {base::MayBlock(), base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN},
502 base::ThreadTaskRunnerHandle::Get(), callbacks), 502 base::BindOnce(&HandleHotplugEventInWorker, device_infos, display_state,
503 true /* task_is_slow */); 503 base::ThreadTaskRunnerHandle::Get(), callbacks));
504 } 504 }
505 505
506 } // namespace ui 506 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/test/test_suite.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698