Commit e6e2cff8 authored by Michael Spang's avatar Michael Spang Committed by Commit Bot

ozone: evdev: Add more const where possible

Many data members are not const but can be, especially pointers. Make
them so.

Change-Id: I82a1e3ab26507eaa88e239847eff84b24f7198b9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1876984Reviewed-by: default avatarSean O'Brien <seobrien@chromium.org>
Commit-Queue: Michael Spang <spang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#714379}
parent a645d854
......@@ -127,10 +127,10 @@ class EVENTS_OZONE_EVDEV_EXPORT EventConverterEvdev
void OnFileCanWriteWithoutBlocking(int fd) override;
// File descriptor to read.
int fd_;
const int fd_;
// Path to input device.
base::FilePath path_;
const base::FilePath path_;
// Input device information, including id (which uniquely identifies an
// event converter) and type.
......
......@@ -66,7 +66,7 @@ class EVENTS_OZONE_EVDEV_EXPORT EventConverterEvdevImpl
void FlushEvents(const input_event& input);
// Input device file descriptor.
base::ScopedFD input_device_fd_;
const base::ScopedFD input_device_fd_;
// Input modalities for this device.
bool has_keyboard_;
......@@ -95,10 +95,10 @@ class EVENTS_OZONE_EVDEV_EXPORT EventConverterEvdevImpl
std::bitset<kMouseButtonCount> mouse_button_state_;
// Shared cursor state.
CursorDelegateEvdev* cursor_;
CursorDelegateEvdev* const cursor_;
// Callbacks for dispatching events.
DeviceEventDispatcherEvdev* dispatcher_;
DeviceEventDispatcherEvdev* const dispatcher_;
DISALLOW_COPY_AND_ASSIGN(EventConverterEvdevImpl);
};
......
......@@ -118,7 +118,7 @@ class TestEventFactoryEvdev : public EventFactoryEvdev {
return POST_DISPATCH_NONE;
}
EventDispatchCallback callback_;
const EventDispatchCallback callback_;
};
} // namespace
......
......@@ -115,10 +115,10 @@ class EVENTS_OZONE_EVDEV_EXPORT EventFactoryEvdev : public DeviceEventObserver,
int last_device_id_ = 0;
// Interface for scanning & monitoring input devices.
DeviceManager* device_manager_; // Not owned.
DeviceManager* const device_manager_; // Not owned.
// Gamepad provider to dispatch gamepad events.
GamepadProviderOzone* gamepad_provider_;
GamepadProviderOzone* const gamepad_provider_;
// Proxy for input device factory (manages device I/O objects).
// The real object lives on a different thread.
......@@ -134,7 +134,7 @@ class EVENTS_OZONE_EVDEV_EXPORT EventFactoryEvdev : public DeviceEventObserver,
KeyboardEvdev keyboard_;
// Cursor movement.
CursorDelegateEvdev* cursor_;
CursorDelegateEvdev* const cursor_;
// Object for controlling input devices.
InputControllerEvdev input_controller_;
......
......@@ -73,10 +73,10 @@ class EVENTS_OZONE_EVDEV_EXPORT GamepadEventConverterEvdev
base::flat_set<unsigned int> pressed_buttons_;
// Input device file descriptor.
base::ScopedFD input_device_fd_;
const base::ScopedFD input_device_fd_;
// Callbacks for dispatching events.
DeviceEventDispatcherEvdev* dispatcher_;
DeviceEventDispatcherEvdev* const dispatcher_;
DISALLOW_COPY_AND_ASSIGN(GamepadEventConverterEvdev);
};
......
......@@ -94,10 +94,10 @@ class EVENTS_OZONE_EVDEV_EXPORT InputControllerEvdev : public InputController {
InputDeviceFactoryEvdevProxy* input_device_factory_ = nullptr;
// Keyboard state.
KeyboardEvdev* keyboard_;
KeyboardEvdev* const keyboard_;
// Mouse button map.
MouseButtonMapEvdev* button_map_;
MouseButtonMapEvdev* const button_map_;
// Device presence.
bool has_mouse_ = false;
......
......@@ -107,10 +107,10 @@ class EVENTS_OZONE_EVDEV_EXPORT InputDeviceFactoryEvdev {
void EnableDevices();
// Task runner for our thread.
scoped_refptr<base::TaskRunner> task_runner_;
const scoped_refptr<base::TaskRunner> task_runner_;
// Cursor movement.
CursorDelegateEvdev* cursor_;
CursorDelegateEvdev* const cursor_;
// Shared Palm state.
const std::unique_ptr<SharedPalmDetectionFilterState> shared_palm_state_;
......@@ -122,7 +122,7 @@ class EVENTS_OZONE_EVDEV_EXPORT InputDeviceFactoryEvdev {
#endif
// Dispatcher for events.
std::unique_ptr<DeviceEventDispatcherEvdev> dispatcher_;
const std::unique_ptr<DeviceEventDispatcherEvdev> dispatcher_;
// Number of pending device additions & device classes.
int pending_device_changes_ = 0;
......
......@@ -33,10 +33,10 @@ class EVENTS_OZONE_EVDEV_EXPORT InputInjectorEvdev
private:
// Shared cursor state.
CursorDelegateEvdev* cursor_;
CursorDelegateEvdev* const cursor_;
// Interface for dispatching events.
std::unique_ptr<DeviceEventDispatcherEvdev> dispatcher_;
const std::unique_ptr<DeviceEventDispatcherEvdev> dispatcher_;
DISALLOW_COPY_AND_ASSIGN(InputInjectorEvdev);
};
......
......@@ -80,7 +80,7 @@ class InputInjectorEvdevTest : public testing::Test {
void ExpectClick(int x, int y, int button, int count);
EventObserver event_observer_;
EventDispatchCallback dispatch_callback_;
const EventDispatchCallback dispatch_callback_;
FakeCursorDelegateEvdev cursor_;
std::unique_ptr<DeviceManager> device_manager_;
......
......@@ -86,13 +86,13 @@ class EVENTS_OZONE_EVDEV_EXPORT KeyboardEvdev
std::bitset<KEY_CNT> key_state_;
// Callback for dispatching events.
EventDispatchCallback callback_;
const EventDispatchCallback callback_;
// Shared modifier state.
EventModifiers* modifiers_;
EventModifiers* const modifiers_;
// Shared layout engine.
KeyboardLayoutEngine* keyboard_layout_engine_;
KeyboardLayoutEngine* const keyboard_layout_engine_;
// Key repeat handler.
EventAutoRepeatHandler auto_repeat_handler_;
......
......@@ -50,16 +50,16 @@ class EVENTS_OZONE_EVDEV_EXPORT TabletEventConverterEvdev
void FlushEvents(const input_event& input);
// Input device file descriptor.
base::ScopedFD input_device_fd_;
const base::ScopedFD input_device_fd_;
// Controller for watching the input fd.
base::MessagePumpLibevent::FdWatchController controller_;
// Shared cursor state.
CursorDelegateEvdev* cursor_;
CursorDelegateEvdev* const cursor_;
// Dispatcher for events.
DeviceEventDispatcherEvdev* dispatcher_;
DeviceEventDispatcherEvdev* const dispatcher_;
int y_abs_location_ = 0;
int x_abs_location_ = 0;
......
......@@ -113,10 +113,10 @@ class EVENTS_OZONE_EVDEV_EXPORT TouchEventConverterEvdev
int NextTrackingId();
// Input device file descriptor.
base::ScopedFD input_device_fd_;
const base::ScopedFD input_device_fd_;
// Dispatcher for events.
DeviceEventDispatcherEvdev* dispatcher_;
DeviceEventDispatcherEvdev* const dispatcher_;
// Set if we drop events in kernel (SYN_DROPPED) or in process.
bool dropped_events_ = false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment