mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Auto merge of #23045 - miller-time:promote-memory-blob, r=jdm
create uuid before sending PromoteMemory message <!-- Please describe your changes on the following line: --> When `Blob::promote` is promoting a `BlobImpl::Memory`, create uuid and send it with the `FileManagerThreadMsg::PromoteMemory` message rather than blocking until one is received. --- <!-- 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 #23032 (GitHub issue number if applicable) <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- 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/23045) <!-- Reviewable:end -->
This commit is contained in:
commit
452d2dcdef
4 changed files with 20 additions and 56 deletions
|
@ -238,23 +238,17 @@ impl Blob {
|
|||
bytes: bytes.to_vec(),
|
||||
};
|
||||
|
||||
let (tx, rx) = ipc::channel(self.global().time_profiler_chan().clone()).unwrap();
|
||||
let msg = FileManagerThreadMsg::PromoteMemory(blob_buf, set_valid, tx, origin.clone());
|
||||
let id = Uuid::new_v4();
|
||||
let msg = FileManagerThreadMsg::PromoteMemory(id, blob_buf, set_valid, origin.clone());
|
||||
self.send_to_file_manager(msg);
|
||||
|
||||
match rx.recv().unwrap() {
|
||||
Ok(id) => {
|
||||
*self.blob_impl.borrow_mut() = BlobImpl::File(FileBlob {
|
||||
id: id.clone(),
|
||||
name: None,
|
||||
cache: DomRefCell::new(Some(bytes.to_vec())),
|
||||
size: bytes.len() as u64,
|
||||
});
|
||||
id
|
||||
},
|
||||
// Dummy id
|
||||
Err(_) => Uuid::new_v4(),
|
||||
}
|
||||
*self.blob_impl.borrow_mut() = BlobImpl::File(FileBlob {
|
||||
id: id.clone(),
|
||||
name: None,
|
||||
cache: DomRefCell::new(Some(bytes.to_vec())),
|
||||
size: bytes.len() as u64,
|
||||
});
|
||||
id
|
||||
}
|
||||
|
||||
/// Get a FileID representing sliced parent-blob content
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue