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

Introduce nsStaticAtom. #19035

Merged
merged 1 commit into from
Oct 27, 2017
Merged

Introduce nsStaticAtom. #19035

merged 1 commit into from
Oct 27, 2017

Conversation

nnethercote
Copy link
Contributor

@nnethercote nnethercote commented Oct 27, 2017

It's a sub-class of nsAtom, useful for cases where you know you are dealing
exclusively with static atoms. The nice thing about it is that you can use
raw nsStaticAtom pointers instead of RefPtr<>. (In fact, the AddRef/Release
implementations ensure that we'll crash if we use RefPtr.)


  • There are tests for these changes OR
  • These changes do not require tests because tested on the Gecko side.

This change is Reviewable

@highfive
Copy link

Heads up! This PR modifies the following files:

  • @bholley: components/style/gecko/generated/atom_macro.rs, components/style/gecko/regen_atoms.py, components/style/gecko/generated/structs.rs, components/style/gecko/media_queries.rs, components/style/gecko_string_cache/mod.rs
  • @canaltinova: components/style/gecko/generated/atom_macro.rs, components/style/gecko/regen_atoms.py, components/style/gecko/generated/structs.rs, components/style/gecko/media_queries.rs, components/style/gecko_string_cache/mod.rs
  • @emilio: components/style/gecko/generated/atom_macro.rs, components/style/gecko/regen_atoms.py, components/style/gecko/generated/structs.rs, components/style/gecko/media_queries.rs, components/style/gecko_string_cache/mod.rs

@highfive
Copy link

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!
  • These commits modify style code, but no tests are modified. Please consider adding a test!

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Oct 27, 2017
@nnethercote
Copy link
Contributor Author

r? @emilio

@highfive highfive assigned emilio and unassigned glennw Oct 27, 2017
Copy link
Member

@emilio emilio left a comment

Choose a reason for hiding this comment

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

  • impl From<*mut nsStaticAtom> for Atom should re-use Atom::from_static (though not sure it's used).

  • as_static_ptr seems unused.

Those two things fixed, then r=me

@emilio
Copy link
Member

emilio commented Oct 27, 2017

@bors-servo delegate+

@bors-servo
Copy link
Contributor

✌️ @nnethercote can now approve this pull request

@nnethercote
Copy link
Contributor Author

impl From<*mut nsStaticAtom> for Atom should re-use Atom::from_static (though not sure it's used).

True. (And it does have a use.)

as_static_ptr seems unused.

You're right, I will remove that.

It's a sub-class of nsAtom, useful for cases where you know you are dealing
exclusively with static atoms. The nice thing about it is that you can use
raw nsStaticAtom pointers instead of RefPtr<>. (In fact, the AddRef/Release
implementations ensure that we'll crash if we use RefPtr<nsStaticAtom>.)
@nnethercote
Copy link
Contributor Author

@bors-servo r=emilio

@bors-servo
Copy link
Contributor

📌 Commit 5866b82 has been approved by emilio

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Oct 27, 2017
@bors-servo
Copy link
Contributor

⌛ Testing commit 5866b82 with merge 8f17105...

bors-servo pushed a commit that referenced this pull request Oct 27, 2017
Introduce nsStaticAtom.

It's a sub-class of nsAtom, useful for cases where you know you are dealing
exclusively with static atoms. The nice thing about it is that you can use
raw nsStaticAtom pointers instead of RefPtr<>. (In fact, the AddRef/Release
implementations ensure that we'll crash if we use RefPtr<nsStaticAtom>.)

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [ ] These changes fix https://bugzilla.mozilla.org/show_bug.cgi?id=1411893

<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because tested on the Gecko side.

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19035)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, windows-msvc-dev
Approved by: emilio
Pushing 8f17105 to master...

@bors-servo bors-servo merged commit 5866b82 into servo:master Oct 27, 2017
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Oct 27, 2017
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.

5 participants