Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upUse `Rc` instead of cloning the `DOMString` #27282
Merged
Conversation
Specifically, I changed the `text` field of `ScriptOrigin` from a `DOMString` to an `Rc<DOMString>`. Then I updated all the related code to work with an `Rc`. This is just a first pass to get the code to compile. There are probably more things I can do that will improve the code and further reduce cloning.
highfive
commented
Jul 15, 2020
|
Heads up! This PR modifies the following files:
|
highfive
commented
Jul 15, 2020
|
r? @jdm This is still work-in-progress, but I wanted to get some feedback about it :) |
|
Looks good! |
| @@ -647,7 +649,7 @@ impl HTMLScriptElement { | |||
|
|
|||
| fetch_inline_module_script( | |||
| ModuleOwner::Window(Trusted::new(self)), | |||
| text.clone(), | |||
| Rc::new(text.clone()), | |||
This comment has been minimized.
This comment has been minimized.
jdm
Jul 15, 2020
Member
Can we use the earlier Rc that was created instead of making a new one here?
This comment has been minimized.
This comment has been minimized.
camelid
Jul 15, 2020
Author
Contributor
I'm guessing yes; I was just trying to get the compiler to stop yelling at me :)
I'll look into it tomorrow
This comment has been minimized.
This comment has been minimized.
|
@bors-servo r+ |
|
|
|
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
camelid commentedJul 15, 2020
•
edited
I changed the
textfield ofScriptOriginfrom aDOMStringto anRc<DOMString>. Then I updated all the related code to work with anRc../mach build -ddoes not report any errors./mach test-tidydoes not report any errors