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

Unified Diff: media/base/user_input_monitor_win.cc

Issue 1906423005: Replace scoped_ptr with std::unique_ptr in //media/base. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptr-media-base: android 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
« no previous file with comments | « media/base/user_input_monitor_unittest.cc ('k') | media/base/vector_math_perftest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/user_input_monitor_win.cc
diff --git a/media/base/user_input_monitor_win.cc b/media/base/user_input_monitor_win.cc
index f872b683181e10b4b09227e73fc6af3a08e77b61..12446013f74d3a344e6a65237beb14c1095b5ca7 100644
--- a/media/base/user_input_monitor_win.cc
+++ b/media/base/user_input_monitor_win.cc
@@ -11,6 +11,7 @@
#include "base/location.h"
#include "base/logging.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/stringprintf.h"
@@ -68,7 +69,7 @@ class UserInputMonitorWinCore
UserInputMonitor::MouseEventListener>> mouse_listeners_;
// These members are only accessed on the UI thread.
- scoped_ptr<base::win::MessageWindow> window_;
+ std::unique_ptr<base::win::MessageWindow> window_;
uint8_t events_monitored_;
KeyboardEventCounter counter_;
@@ -139,7 +140,8 @@ void UserInputMonitorWinCore::StartMonitor(EventBitMask type) {
}
// Register to receive raw mouse and/or keyboard input.
- scoped_ptr<RAWINPUTDEVICE> device(GetRawInputDevices(type, RIDEV_INPUTSINK));
+ std::unique_ptr<RAWINPUTDEVICE> device(
+ GetRawInputDevices(type, RIDEV_INPUTSINK));
if (!RegisterRawInputDevices(device.get(), 1, sizeof(*device))) {
PLOG(ERROR) << "RegisterRawInputDevices() failed for RIDEV_INPUTSINK";
window_.reset();
@@ -162,7 +164,8 @@ void UserInputMonitorWinCore::StopMonitor(EventBitMask type) {
// Stop receiving raw input.
DCHECK(window_);
- scoped_ptr<RAWINPUTDEVICE> device(GetRawInputDevices(type, RIDEV_REMOVE));
+ std::unique_ptr<RAWINPUTDEVICE> device(
+ GetRawInputDevices(type, RIDEV_REMOVE));
if (!RegisterRawInputDevices(device.get(), 1, sizeof(*device))) {
PLOG(INFO) << "RegisterRawInputDevices() failed for RIDEV_REMOVE";
@@ -191,7 +194,7 @@ LRESULT UserInputMonitorWinCore::OnInput(HRAWINPUT input_handle) {
DCHECK_EQ(0u, result);
// Retrieve the input record itself.
- scoped_ptr<uint8_t[]> buffer(new uint8_t[size]);
+ std::unique_ptr<uint8_t[]> buffer(new uint8_t[size]);
RAWINPUT* input = reinterpret_cast<RAWINPUT*>(buffer.get());
result = GetRawInputData(
input_handle, RID_INPUT, buffer.get(), &size, sizeof(RAWINPUTHEADER));
@@ -244,7 +247,7 @@ RAWINPUTDEVICE* UserInputMonitorWinCore::GetRawInputDevices(EventBitMask event,
DWORD flags) {
DCHECK(ui_task_runner_->BelongsToCurrentThread());
- scoped_ptr<RAWINPUTDEVICE> device(new RAWINPUTDEVICE());
+ std::unique_ptr<RAWINPUTDEVICE> device(new RAWINPUTDEVICE());
if (event == MOUSE_EVENT_MASK) {
device->dwFlags = flags;
device->usUsagePage = kGenericDesktopPage;
@@ -312,10 +315,10 @@ void UserInputMonitorWin::StopMouseMonitoring() {
} // namespace
-scoped_ptr<UserInputMonitor> UserInputMonitor::Create(
+std::unique_ptr<UserInputMonitor> UserInputMonitor::Create(
const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner,
const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner) {
- return scoped_ptr<UserInputMonitor>(new UserInputMonitorWin(ui_task_runner));
+ return base::WrapUnique(new UserInputMonitorWin(ui_task_runner));
}
} // namespace media
« no previous file with comments | « media/base/user_input_monitor_unittest.cc ('k') | media/base/vector_math_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698