Skip to content

Add blob loader - #11536

Merged
bors-servo merged 1 commit into
servo:masterfrom
izgzhen:add-blob-loader
Jun 8, 2016
Merged

bors-servo merged 1 commit into
servo:masterfrom
izgzhen:add-blob-loader

Conversation

@izgzhen

@izgzhen izgzhen commented Jun 1, 2016 •

Copy link
Copy Markdown
Contributor

Add a blob loader to implement Blob URL. The related interfaces to script thread are also declared.

Progressing in parallel with PR #11534. Related to #11131.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix part of Implement Blob URLs #10539
  • These changes do not require tests because not integrated yet.

This change is Reviewable

@highfive

highfive commented Jun 1, 2016

Copy link
Copy Markdown

Heads up! This PR modifies the following files:

  • @KiChjang: components/net_traits/blob_url_store.rs, components/net_traits/blob_url_store.rs, components/net/lib.rs, components/net/blob_loader.rs, components/net_traits/lib.rs, components/net_traits/lib.rs

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Jun 1, 2016
@highfive

highfive commented Jun 1, 2016

Copy link
Copy Markdown

warning Warning warning

  • These commits modify net code, but no tests are modified. Please consider adding a test!

@izgzhen

izgzhen commented Jun 1, 2016

Copy link
Copy Markdown
Contributor Author

cc @Manishearth. BTW, I have not plug the loader into the core_resource_thread or file_manager or something else yet. It would be more convenient to let CoreResourceManager::load to attach the proposed loader and dispatch request to it, since I almost mimicked the way about_loader::factory and friends works. But I still remember the clogging possibility you mentioned and might put it under file_manager (which might require us to factor the more general functionality from resource_thread.rs out.)

@highfive

highfive commented Jun 3, 2016

Copy link
Copy Markdown

New code was committed to pull request.

@izgzhen

izgzhen commented Jun 3, 2016

Copy link
Copy Markdown
Contributor Author

r? @Manishearth

@highfive highfive assigned Manishearth and unassigned asajeffrey Jun 3, 2016
Comment thread components/net/blob_loader.rs Outdated
}
Some((uuid, _fragment)) => {
let (tx, rx) = ipc::channel().unwrap();
let _ = blob_url_store.send(BlobURLStoreMsg::Request(uuid, tx)).unwrap();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be messaging the blob store or directly accessing it?

Direct access means that you may have to put synchronization primitives on your blob store, so perhaps this is better.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I observe, it is more natural to let threads in net task to handle the requests (instead of directly consume it inside script), so I need to somehow message script thread to fetch the content of blob. Not sure if it makes a lot of sense

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(we discussed this and fixing it will be done in a future PR)

@Manishearth Manishearth added S-needs-code-changes Changes have not yet been made that were requested by a reviewer. S-awaiting-answer Someone asked a question that requires an answer. and removed S-awaiting-review There is new code that needs to be reviewed. labels Jun 4, 2016
@highfive highfive removed the S-needs-code-changes Changes have not yet been made that were requested by a reviewer. label Jun 6, 2016
@highfive

highfive commented Jun 6, 2016

Copy link
Copy Markdown

New code was committed to pull request.

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Jun 6, 2016
pub fn load(load_data: LoadData, consumer: LoadConsumer,
blob_url_store: Arc<RwLock<BlobURLStore>>,
classifier: Arc<MIMEClassifier>) { // XXX: Move it into net process later

@izgzhen izgzhen Jun 6, 2016 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Manishearth Regarding factory, it is totally gone here. And load is just a function that will be called with the extended FileManager's attributes.

@highfive

highfive commented Jun 6, 2016

Copy link
Copy Markdown

New code was committed to pull request.

/// Size of content in bytes
pub size: u64,
/// Content of blob
pub bytes: Vec<u8>,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will eventually become an enum between bytes, on-disk file name, and slice, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the Optioned filename looks awkward itself :P

@Manishearth

Copy link
Copy Markdown
Member

@bors-servo r+

This looks good to me! Next up we need to add ways for script to insert blobs into the store, and make script smart as to when it stores blobs locally and when it forwards them to net (though I recommend talking with the gecko folks first)

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 679cf0a has been approved by Manishearth

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. S-awaiting-answer Someone asked a question that requires an answer. labels Jun 8, 2016
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 679cf0a with merge 3977128...

bors-servo pushed a commit that referenced this pull request Jun 8, 2016
Add blob loader

Add a blob loader to implement [Blob URL](https://w3c.github.io/FileAPI/#url). The related interfaces to script thread are also declared.

Progressing in parallel with PR #11534. Related to #11131.

<!-- Please describe your changes on the following line: -->

---
<!-- 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 part of #10539

<!-- Either: -->
- [x] These changes do not require tests because not integrated yet.

<!-- 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="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11536)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel, mac-dev-unit, mac-rel-css, mac-rel-wpt, windows

@bors-servo
bors-servo merged commit 679cf0a into servo:master Jun 8, 2016
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Jun 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants