1 // Copyright 2020 The Chromium Authors 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/test/test_waitable_event.h" 6 7 #include <utility> 8 9 #include "build/build_config.h" 10 11 namespace base { 12 TestWaitableEvent(ResetPolicy reset_policy,InitialState initial_state)13TestWaitableEvent::TestWaitableEvent(ResetPolicy reset_policy, 14 InitialState initial_state) 15 : WaitableEvent(reset_policy, initial_state) { 16 // Pretending this is only used while idle ensures this WaitableEvent is not 17 // instantiating a ScopedBlockingCallWithBaseSyncPrimitives in Wait(). In 18 // other words, test logic is considered "idle" work (not part of the tested 19 // logic). 20 declare_only_used_while_idle(); 21 } 22 23 #if BUILDFLAG(IS_WIN) TestWaitableEvent(win::ScopedHandle event_handle)24TestWaitableEvent::TestWaitableEvent(win::ScopedHandle event_handle) 25 : WaitableEvent(std::move(event_handle)) { 26 declare_only_used_while_idle(); 27 } 28 #endif 29 30 } // namespace base 31