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:
bors-servo 2019-03-20 20:14:34 -04:00 committed by GitHub
commit 452d2dcdef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 56 deletions

View file

@ -47,6 +47,7 @@ use std::path::Path;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::{Arc, Mutex};
use std::time::{Duration, SystemTime};
use uuid::Uuid;
// TODO write a struct that impls Handler for storing test values
@ -125,7 +126,6 @@ fn test_fetch_aboutblank() {
#[test]
fn test_fetch_blob() {
use ipc_channel::ipc;
use net_traits::blob_url_store::BlobBuf;
struct FetchResponseCollector {
@ -160,11 +160,10 @@ fn test_fetch_blob() {
let origin = ServoUrl::parse("http://www.example.org/").unwrap();
let (sender, receiver) = ipc::channel().unwrap();
let id = Uuid::new_v4();
context
.filemanager
.promote_memory(blob_buf, true, sender, "http://www.example.org".into());
let id = receiver.recv().unwrap().unwrap();
.promote_memory(id.clone(), blob_buf, true, "http://www.example.org".into());
let url = ServoUrl::parse(&format!("blob:{}{}", origin.as_str(), id.to_simple())).unwrap();
let mut request = Request::new(url, Some(Origin::Origin(origin.origin())), None);