New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integration and improvements of File API backends #11875
Conversation
Heads up! This PR modifies the following files:
|
Not complete implementation yet, but the general ideas are as shown in the code. This PR might take a long time to review, and I am considering adding some tests as well. |
Just reviewing style nits and similar as before to speed things up, Manish will still need to review the rest :) +S-needs-code-changes Review status: 0 of 8 files reviewed at latest revision, 7 unresolved discussions, some commit checks failed. components/net_traits/filemanager_thread.rs, line 11 [r1] (raw file):
So the rust standard library has an components/net_traits/filemanager_thread.rs, line 12 [r1] (raw file):
Also, if this isn't negative should be an unsigned integer, like components/net_traits/filemanager_thread.rs, line 19 [r1] (raw file):
Also, thinking about it a bit more, it seems you always want a start, even though it might be components/script/dom/blob.rs, line 293 [r1] (raw file):
We probably should try to use components/script/dom/blob.rs, line 295 [r1] (raw file): Also, I don't know what the requirements about bounds-checking are, but it seems you need to know the size of the blob to make the calculation in case the
If you plan to do all this that lazily (which is smart btw) you might need the negative integer type for indices, but you can always replace the Also, the problem with it being lazy and not having the file in memory, is that the contents of a slice can be different of those from the sliced blob, hence my previous comment. In any case, we should try to check how other browsers handle this. components/script/dom/htmlinputelement.rs, line 1140 [r1] (raw file):
Can't we just send the components/script/dom/url.rs, line 128 [r1] (raw file):
nit: you should be able to do match *blob.get_blob_impl() {
BlobImpl::File(ref f) => { ... which reads a bit nicer IMHO. Comments from Reviewable |
struct FileManager<UI: 'static + UIProvider> { | ||
receiver: IpcReceiver<FileManagerThreadMsg>, | ||
idmap: HashMap<Uuid, PathBuf>, | ||
store: Arc<RwLock<HashMap<Uuid, FileStoreEntry>>>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the entries themselves have some locking mechanism so that you only need to W-lock the store for small operations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean a finer-grained lock per entry?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So on insertion of a buffer entry (which is slow), you insert an empty entry, then downgrade the main lock to a read lock, and take a write lock to the entry and fill it in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be handled later. I'd prefer if there was a nice concurrent hashmap out there (there probably is) that can be used to abstract over the downgrading.
Cool, thanks! Review status: 0 of 8 files reviewed at latest revision, 8 unresolved discussions, some commit checks failed. Comments from Reviewable |
Review status: 0 of 8 files reviewed at latest revision, 8 unresolved discussions, some commit checks failed. components/net_traits/filemanager_thread.rs, line 11 [r1] (raw file):
|
Review status: 0 of 8 files reviewed at latest revision, 8 unresolved discussions, some commit checks failed. components/script/dom/htmlinputelement.rs, line 1140 [r1] (raw file):
|
Review status: 0 of 8 files reviewed at latest revision, 8 unresolved discussions, some commit checks failed. components/script/dom/url.rs, line 128 [r1] (raw file):
|
Review status: 0 of 8 files reviewed at latest revision, 8 unresolved discussions, some commit checks failed. components/script/dom/blob.rs, line 293 [r1] (raw file):
|
Review status: 0 of 8 files reviewed at latest revision, 8 unresolved discussions, some commit checks failed. components/script/dom/blob.rs, line 295 [r1] (raw file):
|
Reviewed 8 of 8 files at r1. components/net/filemanager_thread.rs, line 192 [r1] (raw file):
could we components/net_traits/filemanager_thread.rs, line 11 [r1] (raw file):
|
Review status: all files reviewed at latest revision, 11 unresolved discussions, some commit checks failed. components/net/filemanager_thread.rs, line 192 [r1] (raw file):
|
Review status: all files reviewed at latest revision, 11 unresolved discussions, some commit checks failed. components/script/dom/blob.rs, line 284 [r1] (raw file):
|
Review status: 2 of 13 files reviewed at latest revision, 11 unresolved discussions. components/net/filemanager_thread.rs, line 112 [r1] (raw file):
|
Review status: 2 of 13 files reviewed at latest revision, 9 unresolved discussions. components/net/filemanager_thread.rs, line 112 [r1] (raw file):
|
Review status: 2 of 13 files reviewed at latest revision, 10 unresolved discussions. components/net/filemanager_thread.rs, line 112 [r1] (raw file):
|
Reviewed 13 of 13 files at r2. components/net/filemanager_thread.rs, line 112 [r1] (raw file):
|
Review status: all files reviewed at latest revision, 14 unresolved discussions. components/net/filemanager_thread.rs, line 165 [r2] (raw file):
|
To be clear, I'm okay with having all three of SlicedFile, SlicedMemory, and File, but I'd like to know why we need it 😄 |
Right, don't worry about spawning/threading/etc here. If we do move this to pooling, we probably will do it along with the net stack. |
Review status: all files reviewed at latest revision, 14 unresolved discussions. components/net/filemanager_thread.rs, line 182 [r2] (raw file):
|
Review status: all files reviewed at latest revision, 14 unresolved discussions. components/net/filemanager_thread.rs, line 182 [r2] (raw file):
|
Review status: all files reviewed at latest revision, 14 unresolved discussions. components/script/dom/blob.rs, line 98 [r2] (raw file):
|
Review status: 9 of 13 files reviewed at latest revision, 17 unresolved discussions. components/net/filemanager_thread.rs, line 334 [r5] (raw file):
@Manishearth The destruction is here Comments from Reviewable |
@Manishearth Now all fixed, you can review the change when convenient |
@bors-servo r+ Reviewed 4 of 4 files at r5, 1 of 1 files at r6. Comments from Reviewable |
📌 Commit 1e9992b has been approved by |
Integration and improvements of File API backends Basically three major changes: 1. More complete origin check in `FileManagerThreadMsg` 2. Add reference counting logic to file manage store and script API 3. Integrate the support of slicing r? @Manishearth --- <!-- 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 - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- 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/11875) <!-- Reviewable:end -->
💔 Test failed - mac-dev-unit |
diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock
index 7150e13..949a8e2 100644
--- a/ports/cef/Cargo.lock
+++ b/ports/cef/Cargo.lock
@@ -1359,6 +1359,7 @@ dependencies = [
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1",
+ "num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", |
Please apply that diff and commit 😄 |
1. More complete origin check in FileManagerThreadMsg 2. Add reference counting logic to file manage store and script API 3. Integrate the support of slicing
Pushed |
@bors-servo r+ |
📌 Commit 14d6896 has been approved by |
Integration and improvements of File API backends Basically three major changes: 1. More complete origin check in `FileManagerThreadMsg` 2. Add reference counting logic to file manage store and script API 3. Integrate the support of slicing r? @Manishearth --- <!-- 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 - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- 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/11875) <!-- Reviewable:end -->
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel, mac-dev-unit, mac-rel-css, mac-rel-wpt, windows |
Basically three major changes:
FileManagerThreadMsg
r? @Manishearth
Part of #11131
This change is