mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-05 18:20:34 +00:00
devices: usb: host: don't use Descriptor as temporary descriptor storage
We can avoid temporarily storing the descriptor by passing a reference to the providing device directly to EventLoop::add_event(). BUG=233968702 TEST=cargo build Change-Id: I78ce17b8a2c7c8a695cf65597459719812c175a5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3670103 Reviewed-by: Dennis Kempin <denniskempin@google.com> Commit-Queue: Alexandre Courbot <acourbot@chromium.org> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-by: Michael Hoyle <mikehoyle@google.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
parent
9be279ca5f
commit
c9a294ced7
1 changed files with 2 additions and 4 deletions
|
@ -13,7 +13,7 @@ use crate::utils::AsyncJobQueue;
|
|||
use crate::utils::{EventHandler, EventLoop, FailHandle};
|
||||
|
||||
use anyhow::Context;
|
||||
use base::{error, AsRawDescriptor, Descriptor, RawDescriptor, Tube, WatchingEvents};
|
||||
use base::{error, AsRawDescriptor, RawDescriptor, Tube, WatchingEvents};
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::time::Duration;
|
||||
|
@ -163,8 +163,6 @@ impl ProviderInner {
|
|||
}
|
||||
};
|
||||
|
||||
let device_descriptor = Descriptor(device.as_raw_descriptor());
|
||||
|
||||
let arc_mutex_device = Arc::new(Mutex::new(device));
|
||||
|
||||
let event_handler: Arc<dyn EventHandler> = Arc::new(UsbUtilEventHandler {
|
||||
|
@ -172,7 +170,7 @@ impl ProviderInner {
|
|||
});
|
||||
|
||||
if let Err(e) = self.event_loop.add_event(
|
||||
&device_descriptor,
|
||||
&*arc_mutex_device.lock(),
|
||||
WatchingEvents::empty().set_read().set_write(),
|
||||
Arc::downgrade(&event_handler),
|
||||
) {
|
||||
|
|
Loading…
Reference in a new issue