From c433c9e79648e6fd752a27f642399b80d889afcb Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Wed, 19 Oct 2022 14:15:31 -0700 Subject: [PATCH] base: remove Windows EventExt::new_with_manual_reset() Replace the single new_with_manual_reset() call, which passed false to create an auto-reset event, with a call to the more descriptive new_auto_reset() function. This allows the new_with_manual_reset() API to be removed. BUG=b:231344063 TEST=tools/presubmit --all Change-Id: I51d1fcbab161d10539c44689b31e2d86ad9e1527 Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3966482 Reviewed-by: Noah Gold Commit-Queue: Daniel Verkamp --- base/src/sys/windows/event.rs | 7 +------ win_audio/src/win_audio_impl/mod.rs | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/base/src/sys/windows/event.rs b/base/src/sys/windows/event.rs index 67fb2fe2b3..51663431ba 100644 --- a/base/src/sys/windows/event.rs +++ b/base/src/sys/windows/event.rs @@ -50,19 +50,14 @@ pub(crate) struct PlatformEvent { } pub trait EventExt { - fn new_with_manual_reset(manual_reset: bool) -> Result; fn new_auto_reset() -> Result; fn open(name: &str) -> Result; fn create_event_with_name(name: &str) -> Result; } impl EventExt for Event { - fn new_with_manual_reset(manual_reset: bool) -> Result { - PlatformEvent::new_with_manual_reset(manual_reset).map(Event) - } - fn new_auto_reset() -> Result { - Event::new_with_manual_reset(false) + PlatformEvent::new_with_manual_reset(false).map(Event) } fn open(name: &str) -> Result { diff --git a/win_audio/src/win_audio_impl/mod.rs b/win_audio/src/win_audio_impl/mod.rs index 3b04bef33e..7540fc47c9 100644 --- a/win_audio/src/win_audio_impl/mod.rs +++ b/win_audio/src/win_audio_impl/mod.rs @@ -265,7 +265,7 @@ impl DeviceRenderer { "Audio Client Initialize() failed." )?; - let ready_to_read_event = Event::new_with_manual_reset(false).unwrap(); + let ready_to_read_event = Event::new_auto_reset().unwrap(); // Safe because `ready_to_read_event` will be initialized and also it has the same // lifetime as `audio_client` because they are owned by DeviceRenderer on return let hr = unsafe { audio_client.SetEventHandle(ready_to_read_event.as_raw_descriptor()) };