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

Unified Diff: ui/events/ozone/evdev/input_device_factory_evdev.cc

Issue 1868363002: Replace scoped_ptr with std::unique_ptr in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptrcc
Patch Set: scopedptrui: rebase-make_scoped_ptr Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: ui/events/ozone/evdev/input_device_factory_evdev.cc
diff --git a/ui/events/ozone/evdev/input_device_factory_evdev.cc b/ui/events/ozone/evdev/input_device_factory_evdev.cc
index 16ccab2a0a32275ecd18d997c3c39e05c736de53..54b1e8b7ec4705382b5b189e20af2479b8f9aa4f 100644
--- a/ui/events/ozone/evdev/input_device_factory_evdev.cc
+++ b/ui/events/ozone/evdev/input_device_factory_evdev.cc
@@ -7,8 +7,10 @@
#include <fcntl.h>
#include <linux/input.h>
#include <stddef.h>
+
#include <utility>
+#include "base/memory/ptr_util.h"
#include "base/stl_util.h"
#include "base/thread_task_runner_handle.h"
#include "base/threading/worker_pool.h"
@@ -37,7 +39,7 @@ namespace ui {
namespace {
-typedef base::Callback<void(scoped_ptr<EventConverterEvdev>)>
+typedef base::Callback<void(std::unique_ptr<EventConverterEvdev>)>
OpenInputDeviceReplyCallback;
struct OpenInputDeviceParams {
@@ -82,7 +84,7 @@ void SetGestureBoolProperty(GesturePropertyProvider* provider,
#endif
-scoped_ptr<EventConverterEvdev> CreateConverter(
+std::unique_ptr<EventConverterEvdev> CreateConverter(
const OpenInputDeviceParams& params,
int fd,
const EventDeviceInfo& devinfo) {
@@ -90,30 +92,31 @@ scoped_ptr<EventConverterEvdev> CreateConverter(
// Touchpad or mouse: use gestures library.
// EventReaderLibevdevCros -> GestureInterpreterLibevdevCros -> DispatchEvent
if (devinfo.HasTouchpad() || devinfo.HasMouse()) {
- scoped_ptr<GestureInterpreterLibevdevCros> gesture_interp =
- make_scoped_ptr(new GestureInterpreterLibevdevCros(
+ std::unique_ptr<GestureInterpreterLibevdevCros> gesture_interp =
+ base::WrapUnique(new GestureInterpreterLibevdevCros(
params.id, params.cursor, params.gesture_property_provider,
params.dispatcher));
- return make_scoped_ptr(new EventReaderLibevdevCros(
+ return base::WrapUnique(new EventReaderLibevdevCros(
fd, params.path, params.id, devinfo, std::move(gesture_interp)));
}
#endif
// Touchscreen: use TouchEventConverterEvdev.
if (devinfo.HasTouchscreen()) {
- scoped_ptr<TouchEventConverterEvdev> converter(new TouchEventConverterEvdev(
- fd, params.path, params.id, devinfo, params.dispatcher));
+ std::unique_ptr<TouchEventConverterEvdev> converter(
+ new TouchEventConverterEvdev(fd, params.path, params.id, devinfo,
+ params.dispatcher));
converter->Initialize(devinfo);
return std::move(converter);
}
// Graphics tablet
if (devinfo.HasTablet())
- return make_scoped_ptr<EventConverterEvdev>(new TabletEventConverterEvdev(
+ return base::WrapUnique<EventConverterEvdev>(new TabletEventConverterEvdev(
fd, params.path, params.id, params.cursor, devinfo, params.dispatcher));
// Everything else: use EventConverterEvdevImpl.
- return make_scoped_ptr<EventConverterEvdevImpl>(new EventConverterEvdevImpl(
+ return base::WrapUnique<EventConverterEvdevImpl>(new EventConverterEvdevImpl(
fd, params.path, params.id, devinfo, params.cursor, params.dispatcher));
}
@@ -123,11 +126,11 @@ scoped_ptr<EventConverterEvdev> CreateConverter(
//
// This takes a TaskRunner and runs the reply on that thread, so that we
// can hop threads if necessary (back to the UI thread).
-void OpenInputDevice(scoped_ptr<OpenInputDeviceParams> params,
+void OpenInputDevice(std::unique_ptr<OpenInputDeviceParams> params,
scoped_refptr<base::TaskRunner> reply_runner,
const OpenInputDeviceReplyCallback& reply_callback) {
const base::FilePath& path = params->path;
- scoped_ptr<EventConverterEvdev> converter;
+ std::unique_ptr<EventConverterEvdev> converter;
TRACE_EVENT1("evdev", "OpenInputDevice", "path", path.value());
@@ -166,7 +169,7 @@ void OpenInputDevice(scoped_ptr<OpenInputDeviceParams> params,
// therefore should be run on a thread where latency is not critical. We
// run it on the FILE thread.
void CloseInputDevice(const base::FilePath& path,
- scoped_ptr<EventConverterEvdev> converter) {
+ std::unique_ptr<EventConverterEvdev> converter) {
TRACE_EVENT1("evdev", "CloseInputDevice", "path", path.value());
converter.reset();
}
@@ -174,7 +177,7 @@ void CloseInputDevice(const base::FilePath& path,
} // namespace
InputDeviceFactoryEvdev::InputDeviceFactoryEvdev(
- scoped_ptr<DeviceEventDispatcherEvdev> dispatcher,
+ std::unique_ptr<DeviceEventDispatcherEvdev> dispatcher,
CursorDelegateEvdev* cursor)
: task_runner_(base::ThreadTaskRunnerHandle::Get()),
cursor_(cursor),
@@ -191,7 +194,7 @@ InputDeviceFactoryEvdev::~InputDeviceFactoryEvdev() {
void InputDeviceFactoryEvdev::AddInputDevice(int id,
const base::FilePath& path) {
- scoped_ptr<OpenInputDeviceParams> params(new OpenInputDeviceParams);
+ std::unique_ptr<OpenInputDeviceParams> params(new OpenInputDeviceParams);
params->id = id;
params->path = path;
params->cursor = cursor_;
@@ -224,7 +227,7 @@ void InputDeviceFactoryEvdev::OnStartupScanComplete() {
}
void InputDeviceFactoryEvdev::AttachInputDevice(
- scoped_ptr<EventConverterEvdev> converter) {
+ std::unique_ptr<EventConverterEvdev> converter) {
if (converter.get()) {
const base::FilePath& path = converter->path();
@@ -255,7 +258,7 @@ void InputDeviceFactoryEvdev::DetachInputDevice(const base::FilePath& path) {
DCHECK(task_runner_->RunsTasksOnCurrentThread());
// Remove device from map.
- scoped_ptr<EventConverterEvdev> converter(converters_[path]);
+ std::unique_ptr<EventConverterEvdev> converter(converters_[path]);
converters_.erase(path);
if (converter) {
@@ -289,7 +292,7 @@ void InputDeviceFactoryEvdev::UpdateInputDeviceSettings(
void InputDeviceFactoryEvdev::GetTouchDeviceStatus(
const GetTouchDeviceStatusReply& reply) {
- scoped_ptr<std::string> status(new std::string);
+ std::unique_ptr<std::string> status(new std::string);
#if defined(USE_EVDEV_GESTURES)
DumpTouchDeviceStatus(gesture_property_provider_.get(), status.get());
#endif
@@ -299,7 +302,7 @@ void InputDeviceFactoryEvdev::GetTouchDeviceStatus(
void InputDeviceFactoryEvdev::GetTouchEventLog(
const base::FilePath& out_dir,
const GetTouchEventLogReply& reply) {
- scoped_ptr<std::vector<base::FilePath>> log_paths(
+ std::unique_ptr<std::vector<base::FilePath>> log_paths(
new std::vector<base::FilePath>);
#if defined(USE_EVDEV_GESTURES)
DumpTouchEventLog(converters_, gesture_property_provider_.get(), out_dir,
« no previous file with comments | « ui/events/ozone/evdev/input_device_factory_evdev.h ('k') | ui/events/ozone/evdev/input_device_factory_evdev_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698