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

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

Issue 2020043002: Make WaitableEvent's constructor enum-based. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move enum constructor in _posix.cc Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « base/synchronization/waitable_event_posix.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/synchronization/waitable_event.h" 5 #include "base/synchronization/waitable_event.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/numerics/safe_conversions.h" 13 #include "base/numerics/safe_conversions.h"
14 #include "base/threading/thread_restrictions.h" 14 #include "base/threading/thread_restrictions.h"
15 #include "base/time/time.h" 15 #include "base/time/time.h"
16 16
17 namespace base { 17 namespace base {
18 18
19 WaitableEvent::WaitableEvent(ResetPolicy reset_policy,
20 InitialState initial_state)
21 : WaitableEvent(reset_policy == ResetPolicy::MANUAL,
22 initial_state == InitialState::SIGNALED) {}
23
19 WaitableEvent::WaitableEvent(bool manual_reset, bool signaled) 24 WaitableEvent::WaitableEvent(bool manual_reset, bool signaled)
20 : handle_(CreateEvent(NULL, manual_reset, signaled, NULL)) { 25 : handle_(CreateEvent(NULL, manual_reset, signaled, NULL)) {
21 // We're probably going to crash anyways if this is ever NULL, so we might as 26 // We're probably going to crash anyways if this is ever NULL, so we might as
22 // well make our stack reports more informative by crashing here. 27 // well make our stack reports more informative by crashing here.
23 CHECK(handle_.IsValid()); 28 CHECK(handle_.IsValid());
24 } 29 }
25 30
26 WaitableEvent::WaitableEvent(win::ScopedHandle handle) 31 WaitableEvent::WaitableEvent(win::ScopedHandle handle)
27 : handle_(std::move(handle)) { 32 : handle_(std::move(handle)) {
28 CHECK(handle_.IsValid()) << "Tried to create WaitableEvent from NULL handle"; 33 CHECK(handle_.IsValid()) << "Tried to create WaitableEvent from NULL handle";
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 INFINITE); // no timeout 95 INFINITE); // no timeout
91 if (result >= WAIT_OBJECT_0 + count) { 96 if (result >= WAIT_OBJECT_0 + count) {
92 DPLOG(FATAL) << "WaitForMultipleObjects failed"; 97 DPLOG(FATAL) << "WaitForMultipleObjects failed";
93 return 0; 98 return 0;
94 } 99 }
95 100
96 return result - WAIT_OBJECT_0; 101 return result - WAIT_OBJECT_0;
97 } 102 }
98 103
99 } // namespace base 104 } // namespace base
OLDNEW
« no previous file with comments | « base/synchronization/waitable_event_posix.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698