Auto merge of #28248 - delosrogers:issue-#28243, r=emilio

Use swap() instead of load()/store() in get_and_reset_text_shaping_performance_counter()

<!-- Please describe your changes on the following line: -->
Replaced usage of `.load()` then `.store()` with `.swap()` to prevent possible atomicity issues.

---
<!-- 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
- [X] These changes fix #28245

<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because: They do not change function of the code.

<!-- 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. -->
This commit is contained in:
bors-servo 2021-03-07 18:42:04 -05:00 committed by GitHub
commit eb7588be38
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -522,8 +522,7 @@ impl RunMetrics {
} }
pub fn get_and_reset_text_shaping_performance_counter() -> usize { pub fn get_and_reset_text_shaping_performance_counter() -> usize {
let value = TEXT_SHAPING_PERFORMANCE_COUNTER.load(Ordering::SeqCst); let value = TEXT_SHAPING_PERFORMANCE_COUNTER.swap(0, Ordering::SeqCst);
TEXT_SHAPING_PERFORMANCE_COUNTER.store(0, Ordering::SeqCst);
value value
} }