[workstation_session] Revert shutdown code
This code is being reverted until fxr/370681 lands. When that is
merged we can revert this and take a dependency on the shared
library instead of the one in bluetooth.
See fxb/48349 for more information.
Change-Id: I3773f6e2e6ab313d46cba158f810489708953cf5
diff --git a/session_shells/ermine/session/BUILD.gn b/session_shells/ermine/session/BUILD.gn
index 3211b80..926c723 100644
--- a/session_shells/ermine/session/BUILD.gn
+++ b/session_shells/ermine/session/BUILD.gn
@@ -44,9 +44,6 @@
"//third_party/rust_crates:async-trait",
"//third_party/rust_crates:futures",
"//third_party/rust_crates:rand",
-
- # TODO: use the shared library when fxb/370681 lands
- "//src/connectivity/bluetooth/lib/async-helpers",
]
test_deps = []
diff --git a/session_shells/ermine/session/src/element_repository/event_handler.rs b/session_shells/ermine/session/src/element_repository/event_handler.rs
index a6220fb..8a90b17 100644
--- a/session_shells/ermine/session/src/element_repository/event_handler.rs
+++ b/session_shells/ermine/session/src/element_repository/event_handler.rs
@@ -32,7 +32,6 @@
pub struct ElementEventHandler {
proxy: GraphicalPresenterProxy,
- termination_event: async_helpers::event::Event,
}
/// The ElementEventHandler is a concrete implementation of the EventHandler trait which
@@ -40,7 +39,7 @@
impl ElementEventHandler {
/// Creates a new instance of the ElementEventHandler.
pub fn new(proxy: GraphicalPresenterProxy) -> ElementEventHandler {
- ElementEventHandler { proxy, termination_event: async_helpers::event::Event::new() }
+ ElementEventHandler { proxy }
}
/// Attempts to connect to the element's view provider and if it does
@@ -83,19 +82,12 @@
// future we will want to communicate the failure back to the proposer.
let view_controller_proxy = self.present_view_for_element(&mut element).ok();
- let termination_event = self.termination_event.clone();
// Hold the element in the spawn_local here. when the call closes all
// of the proxies will be closed.
fasync::spawn_local(async move {
- let element_close_fut =
- Box::pin(run_until_closed(element, stream, view_controller_proxy));
- futures::future::select(element_close_fut, termination_event.wait()).await;
+ run_until_closed(element, stream, view_controller_proxy).await;
});
}
-
- fn shutdown(&mut self) {
- self.termination_event.signal();
- }
}
/// Runs the Element until it receives a signal to shutdown.
@@ -367,31 +359,6 @@
expect_element_wait_fut_completion!(element_wait_fut);
}
- #[fasync::run_singlethreaded(test)]
- async fn calling_shutdown_on_the_handler_kills_elements() {
- init_logger();
- let (element, channel) = make_mock_element();
- let (proxy, _stream) =
- create_proxy_and_stream::<GraphicalPresenterMarker>().expect("failed to create proxy");
-
- let mut handler = ElementEventHandler::new(proxy);
- handler.add_element(element, None);
-
- // shutdown should kill elements
- handler.shutdown();
-
- let timeout = Timer::new(500_i64.millis().after_now());
- let handle_ref = channel.as_handle_ref();
- let element_close_fut =
- fasync::OnSignals::new(&handle_ref, zx::Signals::CHANNEL_PEER_CLOSED);
-
- let either = futures::future::select(timeout, element_close_fut);
- let resolved = either.await;
- match resolved {
- Either::Left(_) => panic!("element should have closed before timeout"),
- Either::Right(_) => (),
- }
- }
#[fasync::run_singlethreaded(test)]
async fn spawn_element_controller_stream_set_annotations_updates_element() {