Index: base/synchronization/waitable_event_watcher_win.cc |
diff --git a/base/synchronization/waitable_event_watcher_win.cc b/base/synchronization/waitable_event_watcher_win.cc |
index a3eb73b10e081cae2ab8f5d94a20ffd1d5a9226c..f3e114e3966149c610d5579ec69fddaf32555c5f 100644 |
--- a/base/synchronization/waitable_event_watcher_win.cc |
+++ b/base/synchronization/waitable_event_watcher_win.cc |
@@ -15,10 +15,9 @@ WaitableEventWatcher::WaitableEventWatcher() = default; |
WaitableEventWatcher::~WaitableEventWatcher() { |
} |
-bool WaitableEventWatcher::StartWatching( |
- WaitableEvent* event, |
- const EventCallback& callback) { |
- callback_ = callback; |
+bool WaitableEventWatcher::StartWatching(WaitableEvent* event, |
+ EventCallback callback) { |
+ callback_ = std::move(callback); |
event_ = event; |
return watcher_.StartWatchingOnce(event->handle(), this); |
} |
@@ -31,12 +30,11 @@ void WaitableEventWatcher::StopWatching() { |
void WaitableEventWatcher::OnObjectSignaled(HANDLE h) { |
WaitableEvent* event = event_; |
- EventCallback callback = callback_; |
+ EventCallback callback = std::move(callback_); |
event_ = NULL; |
- callback_.Reset(); |
DCHECK(event); |
- callback.Run(event); |
+ std::move(callback).Run(event); |
} |
} // namespace base |