Skip to content
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

Refactor FileAPI implementation #12406

Merged
merged 1 commit into from Jul 13, 2016
Merged

Refactor FileAPI implementation #12406

merged 1 commit into from Jul 13, 2016

Conversation

@izgzhen
Copy link
Contributor

izgzhen commented Jul 12, 2016

Most are simple refactoring, cleanups and improvements, but still involving two slightly notable changes:

  • In filemanager, now we read the file content based on requested RelativePos by seek and read_exact (rather than read_to_end then do slicing). This strategy might be again adjusted in future performance tuning but certainly better than nothing.
  • Also, I cached more file meta-info in both sides and left a block of comment on filemanager's file reading mentioning the snapshot-state problem (not solved now though).

r? @Manishearth

Part of #11131


This change is Reviewable

@highfive
Copy link

highfive commented Jul 12, 2016

Heads up! This PR modifies the following files:

  • @KiChjang: components/net/filemanager_thread.rs, components/net_traits/blob_url_store.rs, components/net_traits/blob_url_store.rs, components/script/dom/file.rs, components/net/blob_loader.rs, components/net_traits/filemanager_thread.rs, components/net_traits/filemanager_thread.rs, components/script/dom/bindings/trace.rs, components/script/dom/blob.rs
@izgzhen izgzhen force-pushed the izgzhen:refactor-file branch from c525f89 to 97a9706 Jul 12, 2016
@izgzhen izgzhen mentioned this pull request Jul 12, 2016
2 of 4 tasks complete
@Manishearth
Copy link
Member

Manishearth commented Jul 12, 2016

Overall LGTM -- could you add doc comments on all the structs and sprinkled throughout the codebase? The fact that BlobBuf can be a seek'd slice too is a bit non-obvious.

@izgzhen
Copy link
Contributor Author

izgzhen commented Jul 12, 2016

Good, I will have a double-check

@izgzhen izgzhen force-pushed the izgzhen:refactor-file branch from 97a9706 to d32a4d5 Jul 12, 2016
@izgzhen
Copy link
Contributor Author

izgzhen commented Jul 12, 2016

Done

refs: AtomicUsize,
/// UUID key's validity as Blob URL
/// Validity of the UUID key being part of a valid Blob URL

This comment has been minimized.

Copy link
@Manishearth

Manishearth Jul 12, 2016

Member

Better phrased: "UUIDs only become valid blob URIs when explicitly requested by the user with createObjectURI. Validity can be revoked as well."

}
}
}

/// File manager's data store. It maintains a thread-safe mapping
/// from FileID to FileStoreEntry which might have different backend implementation.
/// Access to the content is sealed as methods of this struct.

This comment has been minimized.

Copy link
@Manishearth

Manishearth Jul 12, 2016

Member

s/sealed/encapsulated

@Manishearth
Copy link
Member

Manishearth commented Jul 12, 2016

r=me, minor nits

@izgzhen izgzhen force-pushed the izgzhen:refactor-file branch from d32a4d5 to d678887 Jul 13, 2016
@izgzhen
Copy link
Contributor Author

izgzhen commented Jul 13, 2016

Fixed

@Manishearth
Copy link
Member

Manishearth commented Jul 13, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Jul 13, 2016

📌 Commit d678887 has been approved by Manishearth

@bors-servo
Copy link
Contributor

bors-servo commented Jul 13, 2016

Testing commit d678887 with merge 3b32d1d...

bors-servo added a commit that referenced this pull request Jul 13, 2016
Refactor FileAPI implementation

Most are simple refactoring, cleanups and improvements, but still involving two slightly notable changes:

+ In `filemanager`, now we read the file content based on requested `RelativePos` by `seek` and `read_exact` (rather than `read_to_end` then do slicing). This strategy might be again adjusted in future performance tuning but certainly better than nothing.
+ Also, I cached more file meta-info in both sides and left a block of comment on `filemanager`'s file reading mentioning the snapshot-state problem (not solved now though).

r? @Manishearth

<!-- 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

<!-- 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/12406)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Jul 13, 2016

💔 Test failed - linux-dev

@izgzhen
Copy link
Contributor Author

izgzhen commented Jul 13, 2016

@Manishearth Sorry, I made a mistake in making TFDProvider private. I will r=you when this get fixed

@Manishearth
Copy link
Member

Manishearth commented Jul 13, 2016

Yep, just noticed that 😄

@bors-servo r- delegate+

@bors-servo
Copy link
Contributor

bors-servo commented Jul 13, 2016

✌️ @izgzhen can now approve this pull request

@izgzhen izgzhen force-pushed the izgzhen:refactor-file branch from d678887 to aea99e0 Jul 13, 2016
@izgzhen
Copy link
Contributor Author

izgzhen commented Jul 13, 2016

@bors-servo r=Manishearth

@bors-servo
Copy link
Contributor

bors-servo commented Jul 13, 2016

📌 Commit aea99e0 has been approved by Manishearth

@bors-servo
Copy link
Contributor

bors-servo commented Jul 13, 2016

Testing commit aea99e0 with merge 6655595...

bors-servo added a commit that referenced this pull request Jul 13, 2016
Refactor FileAPI implementation

Most are simple refactoring, cleanups and improvements, but still involving two slightly notable changes:

+ In `filemanager`, now we read the file content based on requested `RelativePos` by `seek` and `read_exact` (rather than `read_to_end` then do slicing). This strategy might be again adjusted in future performance tuning but certainly better than nothing.
+ Also, I cached more file meta-info in both sides and left a block of comment on `filemanager`'s file reading mentioning the snapshot-state problem (not solved now though).

r? @Manishearth

<!-- 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

<!-- 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/12406)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Jul 13, 2016

@bors-servo bors-servo merged commit aea99e0 into servo:master Jul 13, 2016
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.