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

Side by Side Diff: base/synchronization/waitable_event_watcher_win.cc

Issue 1446363003: Deleted OS_WIN and all Windows specific files from base. (Closed) Base URL: https://github.com/domokit/mojo.git@base_tests
Patch Set: Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #include "base/synchronization/waitable_event_watcher.h"
6
7 #include "base/compiler_specific.h"
8 #include "base/synchronization/waitable_event.h"
9 #include "base/win/object_watcher.h"
10
11 namespace base {
12
13 WaitableEventWatcher::WaitableEventWatcher()
14 : event_(NULL) {
15 }
16
17 WaitableEventWatcher::~WaitableEventWatcher() {
18 }
19
20 bool WaitableEventWatcher::StartWatching(
21 WaitableEvent* event,
22 const EventCallback& callback) {
23 callback_ = callback;
24 event_ = event;
25 return watcher_.StartWatching(event->handle(), this);
26 }
27
28 void WaitableEventWatcher::StopWatching() {
29 callback_.Reset();
30 event_ = NULL;
31 watcher_.StopWatching();
32 }
33
34 WaitableEvent* WaitableEventWatcher::GetWatchedEvent() {
35 return event_;
36 }
37
38 void WaitableEventWatcher::OnObjectSignaled(HANDLE h) {
39 WaitableEvent* event = event_;
40 EventCallback callback = callback_;
41 event_ = NULL;
42 callback_.Reset();
43 DCHECK(event);
44
45 callback.Run(event);
46 }
47
48 } // namespace base
OLDNEW
« no previous file with comments | « base/synchronization/waitable_event_watcher_unittest.cc ('k') | base/synchronization/waitable_event_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698