Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow using IPC to handle navigations #222

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

Legend-Master
Copy link
Contributor

No description provided.

@Legend-Master Legend-Master marked this pull request as ready for review November 8, 2024 05:10
This was referenced Nov 8, 2024
@wusyong
Copy link
Member

wusyong commented Nov 11, 2024

I think before we start dealing with bi-direction communication API, there should be a dedicated IPC channel that could send from core crate to verso crate. Could you test if this could be done upon we start the IPC channel here?

@Legend-Master
Copy link
Contributor Author

I thought about it before, but now I think I would like to go with the event listener approach that we only send an IPC sender to the core crate when we need info from it, instead of always listen to messages from the core crate

Comment on lines +297 to +307
if let Some(ref sender) = *self.event_listeners.on_navigation_starting.lock().unwrap() {
let (result_sender, receiver) =
ipc::channel::<bool>().map_err(|e| ipc::IpcError::Io(e))?;
sender
.send((url.into_url(), result_sender))
.map_err(|e| ipc::IpcError::Bincode(e))?;
let result = receiver.recv()?;
Ok(result)
} else {
Ok(true)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still believe there needs to be a dedicated channel for communicating asynchronously. The lock and recv here are strong deadlock material.

Copy link
Contributor Author

@Legend-Master Legend-Master Nov 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lock and recv here are strong deadlock material.

I can clone the sender out here to prevent potential dead lock

for communicating asynchronously.

We can do this asynchronously though if you want it that way

I still believe there needs to be a dedicated channel

About a dedicated channel, do you mean an unified sender for all info we need to send to the core? I don't think it works well here to be honest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants