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

Use `Rc` instead of cloning the `DOMString` #27282

Merged
merged 3 commits into from Jul 17, 2020
Merged

Conversation

@camelid
Copy link
Contributor

camelid commented Jul 15, 2020

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.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #27254 (GitHub issue number if applicable)
  • There are tests for these changes OR
  • These changes do not require tests because this doesn't introduce new code and should only need to be checked by the compiler
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
Copy link

highfive commented Jul 15, 2020

Heads up! This PR modifies the following files:

  • @asajeffrey: components/script/dom/htmlscriptelement.rs, components/script/script_module.rs
  • @KiChjang: components/script/dom/htmlscriptelement.rs, components/script/script_module.rs
@highfive
Copy link

highfive commented Jul 15, 2020

warning Warning warning

  • These commits modify script code, but no tests are modified. Please consider adding a test!
@camelid
Copy link
Contributor Author

camelid commented Jul 15, 2020

r? @jdm

This is still work-in-progress, but I wanted to get some feedback about it :)

@highfive highfive assigned jdm and unassigned asajeffrey Jul 15, 2020
Copy link
Member

jdm left a comment

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.

Copy link
@jdm

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.

Copy link
@camelid

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.

Copy link
@camelid

camelid Jul 17, 2020

Author Contributor

Okay, I just did it!

@jdm
jdm approved these changes Jul 17, 2020
@jdm
Copy link
Member

jdm commented Jul 17, 2020

@bors-servo
Copy link
Contributor

bors-servo commented Jul 17, 2020

📌 Commit cdfd4d9 has been approved by jdm

@bors-servo
Copy link
Contributor

bors-servo commented Jul 17, 2020

Testing commit cdfd4d9 with merge f221b00...

@bors-servo
Copy link
Contributor

bors-servo commented Jul 17, 2020

☀️ Test successful - status-taskcluster
Approved by: jdm
Pushing f221b00 to master...

@bors-servo bors-servo merged commit f221b00 into servo:master Jul 17, 2020
2 checks passed
2 checks passed
Community-TC (pull_request) TaskGroup: success
Details
homu Test successful
Details
@bors-servo bors-servo mentioned this pull request Jul 17, 2020
2 of 5 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

5 participants
You can’t perform that action at this time.