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 upMake Blob store an Arc<Vec<u8>> #8801
Closed
Comments
|
I'd like to take this one. |
|
Go for it! |
|
Should this be |
|
I'm not sure how to create the |
bors-servo
added a commit
that referenced
this issue
Jan 7, 2016
Changing blob to use arc pointers in order to limit wasteful copying … Fixes #8801. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8860) <!-- Reviewable:end -->
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The point of Blob values is that they're immutable buffers, and sometimes they're even slices of immutable buffers, and they're often used as sources of data that will be sent between threads internally. We should support this properly by making the underlying buffer threadsafe, allowing us to pass around references to it rather than cloning it. This will allow us to:
read_out_buffermethod, and renameclone_bytestoget_bytesBlob::Slice) share the original buffer, by storing the offset and length of the slice in the new Blob objectCode: components/script/dom/blob.rs