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 uptypedarray: Use a Cell for handling interior mutability. #408
Conversation
The typed array wrapper has a "computed" option that uses to cache its data. That means that you need a mutable reference to the typed array in order to read it, which is not great. In particular, it's plain impossible when the typed array is provided as a member of a struct via WebIDL. Use a `Cell` and expose to_vec and as_slice in non-mutable references.
I believe this is non-breaking.
|
r? @jdm
|
|
@bors-servo r+ |
|
|
bors-servo
added a commit
that referenced
this pull request
Mar 24, 2018
typedarray: Use a Cell for handling interior mutability. The typed array wrapper has a "computed" option that uses to cache its data. That means that you need a mutable reference to the typed array in order to read it, which is not great. In particular, it's plain impossible when the typed array is provided as a member of a struct via WebIDL. Use a `Cell` and expose to_vec and as_slice in non-mutable references. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-mozjs/408) <!-- Reviewable:end -->
|
|
bors-servo
added a commit
to servo/servo
that referenced
this pull request
Mar 24, 2018
Update mozjs. Peeks up servo/rust-mozjs#408. <!-- 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/20419) <!-- Reviewable:end -->
bors-servo
added a commit
to servo/servo
that referenced
this pull request
Mar 24, 2018
Update mozjs. Peeks up servo/rust-mozjs#408. <!-- 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/20419) <!-- Reviewable:end -->
moz-v2v-gh
pushed a commit
to mozilla/gecko-dev
that referenced
this pull request
Mar 25, 2018
Peeks up servo/rust-mozjs#408. Source-Repo: https://github.com/servo/servo Source-Revision: b8279b376bb4b6118c5a65fa6aeaf5a08c6e953b --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : c9cece8149aa3005905cad7dd27a58a360e6cd35
gecko-dev-updater
pushed a commit
to marco-c/gecko-dev-wordified-and-comments-removed
that referenced
this pull request
Oct 2, 2019
Peeks up servo/rust-mozjs#408. Source-Repo: https://github.com/servo/servo Source-Revision: b8279b376bb4b6118c5a65fa6aeaf5a08c6e953b UltraBlame original commit: 870708dc30ed7c76e8b7b0516ac51c9994d94389
gecko-dev-updater
pushed a commit
to marco-c/gecko-dev-comments-removed
that referenced
this pull request
Oct 2, 2019
Peeks up servo/rust-mozjs#408. Source-Repo: https://github.com/servo/servo Source-Revision: b8279b376bb4b6118c5a65fa6aeaf5a08c6e953b UltraBlame original commit: 870708dc30ed7c76e8b7b0516ac51c9994d94389
gecko-dev-updater
pushed a commit
to marco-c/gecko-dev-wordified
that referenced
this pull request
Oct 2, 2019
Peeks up servo/rust-mozjs#408. Source-Repo: https://github.com/servo/servo Source-Revision: b8279b376bb4b6118c5a65fa6aeaf5a08c6e953b UltraBlame original commit: 870708dc30ed7c76e8b7b0516ac51c9994d94389
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.
emilio commentedMar 24, 2018
•
edited by larsbergstrom
The typed array wrapper has a "computed" option that uses to cache its data.
That means that you need a mutable reference to the typed array in order to read
it, which is not great.
In particular, it's plain impossible when the typed array is provided as a
member of a struct via WebIDL.
Use a
Celland expose to_vec and as_slice in non-mutable references.This change is