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

feat(scheme-handler): Improve memory usage & Range support #1481

Merged
merged 2 commits into from
Aug 29, 2024

Conversation

dpogue
Copy link
Member

@dpogue dpogue commented Aug 28, 2024

Platforms affected

iOS

Motivation and Context

Improve memory usage and support range requests for resources loaded via a custom scheme.

Description

Changed the implementation of CDVURLSchemeHandler to do file reading on a background thread in 4MiB chunks rather than trying to load entire files into memory. 4MiB should be sufficient for most HTML/CSS/JS files, while still being low enough to not cause iOS to freak out about memory usage.

Improved URL building for file paths to ensure that things like query strings don't end up affecting which file gets loaded from the filesystem. Closes GH-909.

Also, implement support for the Range header to load subsections of files (mostly used for audio/video files) to further improve memory usage. Closes GH-1033.

Testing

Existing tests pass. All content for the mobile spec testcase loaded properly with these changes.

Checklist

  • I've run the tests to see all new and existing tests pass
  • If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)

@dpogue dpogue changed the title Scheme handler feat(scheme-handler): Improve memory usage & Range support Aug 28, 2024
@dpogue dpogue added this to the 8.0.0 milestone Aug 28, 2024
@codecov-commenter
Copy link

codecov-commenter commented Aug 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.22%. Comparing base (b6ae567) to head (82f9267).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1481   +/-   ##
=======================================
  Coverage   80.22%   80.22%           
=======================================
  Files          16       16           
  Lines        1871     1871           
=======================================
  Hits         1501     1501           
  Misses        370      370           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dpogue dpogue force-pushed the scheme-handler branch 2 times, most recently from b9eab6c to de4dd9c Compare August 28, 2024 10:35
@dpogue dpogue marked this pull request as ready for review August 29, 2024 02:19
Copy link
Member

@erisu erisu left a comment

Choose a reason for hiding this comment

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

LGTM

Ran a test against a project that overrides scheme, project that contains all Apache Cordova plugins, & the Cordova's sample application.

@dpogue dpogue merged commit 2cc8678 into apache:master Aug 29, 2024
10 checks passed
@dpogue dpogue deleted the scheme-handler branch August 29, 2024 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants