1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/synchronization/waitable_event_watcher.h"
7 #include "base/compiler_specific.h"
8 #include "base/synchronization/waitable_event.h"
9 #include "base/win/object_watcher.h"
13 WaitableEventWatcher::WaitableEventWatcher()
17 WaitableEventWatcher::~WaitableEventWatcher() {
20 bool WaitableEventWatcher::StartWatching(
22 const EventCallback
& callback
) {
25 return watcher_
.StartWatching(event
->handle(), this);
28 void WaitableEventWatcher::StopWatching() {
31 watcher_
.StopWatching();
34 WaitableEvent
* WaitableEventWatcher::GetWatchedEvent() {
38 void WaitableEventWatcher::OnObjectSignaled(HANDLE h
) {
39 WaitableEvent
* event
= event_
;
40 EventCallback callback
= callback_
;