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
Split out shared networking code into net_traits crate #4476
Comments
Look at the existing X_traits crates for how this should look for the networking code. |
I'm working on this. |
Great! |
Any news, @jamougha? |
Looks like this is available for taking once more. |
I'd like to work on this please. |
Please do :) |
I started working on this and I am making progress. Just a head's up, this one requires more code to be pulled into the new traits crate than the previous ones. |
You mention the implementation of the loaders as being independent. Actually they are used by I'm currently at the point where I would need to pull the loaders which seem to be simply functions and a lot of the cookie code. At that point I would have pulled more than 85% of net into net_traits and maybe will have to pull more still. I have a feeling:
I will push my local repo to my fork so it is referenced here. At the point I am at right now, I would need to move the loaders, cookie code and sniffer_task to make resource_task compile in the net_traits crate. |
Thanks for doing that investigation! The way I usually break these tasks down is by starting with the list of dependencies from http://mxr.mozilla.org/servo/search?string=use%20net%3A%3A - it's the dependencies for script/, layout/, and gfx/ that we really want to break. Things like ResourceTask, ControlMsg, ImageCacheTask, and LocalImageCache task will need to be moved; it's possible that all of the image-related code should be moved to net_traits for now, if it's a lot of work to split it up. I believe focusing on just those dependencies should avoid many of the problems that you were encountering in your branch. |
I started again with the link you gave me starting at the top of the list, taking everything one step at a time, doing one commit per dependency to extract in a new branch. I'm doing script/, layout/, and gfx/ only for now. Things are going more smootly now, thanks! |
@jdm I have completed removing the net/ dependency from gfx/, layout/, and script/. I have done this in 7 commits (one for each specific dependency). Do you want me to merge squash them in one big commit before I submit a pull request? Once it's done, I'll rebase and submit a pull request. This is a pretty big one, I will probably have some merging to do again after the review modifications are completed. |
I think separate commits sound fine to me! |
Well, under the assumption that they all build independently. If that's not the case, squashing makes more sense. |
Also, I notice the that implementation of the ImageCache and LocalImageCache has moved into net_traits. Is that necessary? It looks to me like it should be possible to keep those in the net crate, and just move the definition of ImageCacheTask into net_traits. |
LocalImageCache is used by layout/context.rs, layout/layout_task.rs and layout/fragments so I moved it to traits. As for ImageCache I will move it back to net as it's only used in net_traits. I think I will squash the commits, will probably try out both and see with seems the easiest to rebase. |
I started moving back ImageCache to net/ and saw it needed to be in net_traits because ImageCacheTask's implementation refers to it and that would create a circular reference. |
Here's my suggestion to avoid the ImageCacheTask problem - make ImageCacheTask::new/new_sync free functions in net/ (create_image_cache_task), and call that instead. Now ImageCacheTask is no more than a wrapper for a Sender. |
I've followed your advice for create_image_cache_task, squashed everything together and rebased. Sadly I still have 2 things to take care off. ./mach test-wpt gives me this:
and ./mach test-unit fails on tests which load
or
I'm thinking it's probably not finding the file correctly since I moved it. I'll probably turn to the mailing list for help if I don't find anything on those errors. |
Use |
I corrected the errors and then rebased on latest master and submitted the pull request. |
There are parts of the net crate that are independent of the rest of Servo (like the implementation of the loaders, the forthcoming HTTP cache, the forthcoming cookie code, etc.) and it is really frustrating to recompile the script crate every time the code in net is touched. We can do better than this if we split the bits that script and layout need into a net_traits crate that the net crate depends upon.
The text was updated successfully, but these errors were encountered: