Skip to content

Move webgl_channel into base crate#32339

Merged
mrobinson merged 5 commits intoservo:mainfrom
wusyong:runtime_ch
May 24, 2024
Merged

Move webgl_channel into base crate#32339
mrobinson merged 5 commits intoservo:mainfrom
wusyong:runtime_ch

Conversation

@wusyong
Copy link
Copy Markdown
Member

@wusyong wusyong commented May 22, 2024

WebGL channels are interesting because they can select different channel implementations in runtime based on multiprocess or not.
There's a Zulip discussion around multiprocess, and I feel like this is a potential improvement if other places using ipc::channel could also use this.

I named this crate process because I hope it will also add other types related to processes and threads in the future, such as moving net's async runtime to here. So we have better control over how they spawn and communicate. Any name suggestion is welcome.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • There are tests for these changes in WPT. WebGL tests should be passed.

Copy link
Copy Markdown
Member

@mrobinson mrobinson left a comment

Choose a reason for hiding this comment

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

This is a nice start. This generic sender seems like a very basic type, unlikely to change and widely useful. Can you move this to components/base/generic_channel.rs instead of making a new crate? process is a bit odd, because crossbeam channels don't have anything to do with processes.

In addition, please use this new data structure to replace OpaqueSender in components/shared/profile/mem.rs.

Thanks!

@wusyong
Copy link
Copy Markdown
Member Author

wusyong commented May 23, 2024

@mrobinson I couldn't move it to base because base and servo_config would create a circular dependency.
How about rename to runtime or move to profile?

@mrobinson
Copy link
Copy Markdown
Member

@mrobinson I couldn't move it to base because base and servo_config would create a circular dependency. How about rename to runtime or move to profile?

Please move fn channel() to the WebGL crate in this case. Even though there is a generic channel implementation it isn't always just the multiprocess option that might be controlling whether or not we want an IPC channel or a crossbeam channel.

@wusyong
Copy link
Copy Markdown
Member Author

wusyong commented May 23, 2024

Please move fn channel() to the WebGL crate in this case. Even though there is a generic channel implementation it isn't always just the multiprocess option that might be controlling whether or not we want an IPC channel or a crossbeam channel.

Ah I think I can add a parameter to check instead. So we can still have a create channel function in this module.

In addition, please use this new data structure to replace OpaqueSender in components/shared/profile/mem.rs.

Do you mean type alias OpaqueSender to GenericSender? Because ``OpaqueSender` seems to be a trait. There are other places will need to update I think.

@mrobinson
Copy link
Copy Markdown
Member

Do you mean type alias OpaqueSender to GenericSender? Because ``OpaqueSender` seems to be a trait. There are other places will need to update I think.

Since OpaqueSender is solving the same sort of problem, I think you could modify the code that was using it to use GenericSender instead.

@wusyong
Copy link
Copy Markdown
Member Author

wusyong commented May 23, 2024

Since OpaqueSender is solving the same sort of problem, I think you could modify the code that was using it to use GenericSender instead.

After looking into it further, I found there are more types passed in profile's run_with_memory_reporting function. Some types are more than just a sender field. I think we still need to keep OpaqueSender for these types.

@wusyong wusyong changed the title Move webgl_channel into a shared crate Move webgl_channel into base crate May 23, 2024
@mrobinson mrobinson added this pull request to the merge queue May 24, 2024
Merged via the queue into servo:main with commit b1031d6 May 24, 2024
@wusyong wusyong deleted the runtime_ch branch May 24, 2024 08:28
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