servo icon indicating copy to clipboard operation
servo copied to clipboard

[bluetooth] Replace IPC channel with GenericChannel

Open wusyong opened this issue 1 year ago • 6 comments

Describe the new feature: With #32339, Servo now has a generic channel that can select different channel implementation during runtime. This can help servo to use ipc channel if it's in multiprocess mode, and crossbeam channel if not.

There are lost of places that ipc::channel is used. Let's start with Bluetooth crate first since it only has two calls:

Feel free to take one of them above and open the PRs. Or if you are interested in more other crates, open more issues like this. I'll also open some more in the future.

wusyong avatar May 31 '24 04:05 wusyong

@sagudev I couldn't add any label yet. Could you add B-newcomer to it?

wusyong avatar May 31 '24 04:05 wusyong

Hmm, after looking a bit more into GetSelectedBluetoothDevice, it doesn't seem to cross to the content process or service worker. Perhaps it can just be a crossbeam channel.

wusyong avatar May 31 '24 05:05 wusyong

Hmm, after looking a bit more into GetSelectedBluetoothDevice, it doesn't seem to cross to the content process or service worker. Perhaps it can just be a crossbeam channel.

We would likely want to move Bluetooth out of content process for security reasons in the future.

sagudev avatar May 31 '24 05:05 sagudev

I'm not sure we should replace every use of ipc::channel with GenericChannel. There are times that it is really useful to know what kind of channel you are dealing with and abstracting that away makes things a bit confusing.

mrobinson avatar May 31 '24 13:05 mrobinson

Proposal: For now use this for situations when we need to write code that needs to communicate both in-process and out-of-process.

mrobinson avatar May 31 '24 13:05 mrobinson

Proposal: For now use this for situations when we need to write code that needs to communicate both in-process and out-of-process.

I'm not going to replace all ipc::channel. There are places will use more tools other than just sender and receiver. I think it will be difficult to unify those usages in GenericChannel.

For Bluetooth crate, it makes sense to refactor BluetoothThreadFactory because it needs to communicate both in and out of the process. And it seems GetSelectedBluetoothDevice will stay in-process only. I'll open future issues for only those who have both in-process and out-of-process communication.

wusyong avatar Jun 01 '24 03:06 wusyong

This sounds like a problem related to rust generics, perhaps not too hard, and I want to try to deal with it.

lwz23 avatar Sep 24 '24 01:09 lwz23

Can I try this?

willypuzzle avatar Dec 21 '24 14:12 willypuzzle

Can I try this?

I think it was decide that this will not be done per https://github.com/servo/servo/issues/32411#issuecomment-2405681547, but I might be wrong.

sagudev avatar Dec 21 '24 15:12 sagudev

Sorry I should have closed this issue already. We've decided not to do this.

wusyong avatar Dec 21 '24 15:12 wusyong