mirror of
https://github.com/servo/servo.git
synced 2025-08-12 08:55:32 +01:00
Auto merge of #11784 - heycam:atom, r=bholley
Look at nsIAtom.mHash directly rather than call Gecko_HashAtom. <!-- Please describe your changes on the following line: --> We hash Gecko-backed atoms pretty often. Using bindgen to access to the stored hash in nsIAtom helps with perf a little. r? @bholley --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- 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="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11784) <!-- Reviewable:end -->
This commit is contained in:
commit
bc5a52b328
7 changed files with 9 additions and 10 deletions
|
@ -1,4 +1,4 @@
|
|||
use gecko_bindings::bindings::nsIAtom;
|
||||
use gecko_bindings::structs::nsIAtom;
|
||||
|
||||
use Atom;
|
||||
|
||||
|
|
|
@ -10,9 +10,8 @@ use gecko_bindings::bindings::Gecko_AddRefAtom;
|
|||
use gecko_bindings::bindings::Gecko_AtomEqualsUTF8IgnoreCase;
|
||||
use gecko_bindings::bindings::Gecko_Atomize;
|
||||
use gecko_bindings::bindings::Gecko_GetAtomAsUTF16;
|
||||
use gecko_bindings::bindings::Gecko_HashAtom;
|
||||
use gecko_bindings::bindings::Gecko_ReleaseAtom;
|
||||
use gecko_bindings::bindings::nsIAtom;
|
||||
use gecko_bindings::structs::nsIAtom;
|
||||
use heapsize::HeapSizeOf;
|
||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||
use std::borrow::Cow;
|
||||
|
@ -100,7 +99,7 @@ unsafe impl Sync for Atom {}
|
|||
impl Atom {
|
||||
pub fn get_hash(&self) -> u32 {
|
||||
unsafe {
|
||||
Gecko_HashAtom(self.0)
|
||||
(*self.0).mHash
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ with open(objdir_path + "/dist/include/nsGkAtomList.h") as f:
|
|||
atoms = [line_to_atom(line) for line in lines]
|
||||
|
||||
with open("atom_macro.rs", "w") as f:
|
||||
f.write("use gecko_bindings::bindings::nsIAtom;\n\n")
|
||||
f.write("use gecko_bindings::structs::nsIAtom;\n\n")
|
||||
f.write("use Atom;\n\n")
|
||||
f.write("pub fn unsafe_atom_from_static(ptr: *mut nsIAtom) -> Atom { unsafe { Atom::from_static(ptr) } }\n\n")
|
||||
for atom in atoms:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue