Repository navigation
Set service worker/cachestorage quota to 6 MiB - #12441
Merged
Merged
Conversation
Contributor
🤖 Gemini Suggested Commit Message💡 Pro Tips for a Better Commit Message:
|
Contributor
|
sacuff
force-pushed
the
cache
branch
2 times, most recently
from
September 29, 2026 19:46
ed3977d to
9ff7327
Compare
sacuff
force-pushed
the
cache
branch
2 times, most recently
from
October 13, 2026 19:53
247d1dd to
ae3db13
Compare
sacuff
force-pushed
the
cache
branch
3 times, most recently
from
October 26, 2026 23:32
153c29c to
3584e26
Compare
sacuff
marked this pull request as ready for review
October 26, 2026 23:55
Contributor
There was a problem hiding this comment.
Code Review
This pull request implements custom cache quota settings for Cobalt, enforcing a 6 MiB CacheStorage quota pool and sizing the HTTP cache around this reservation. It adds the GetCacheQuotaSettings method to CobaltContentBrowserClient, along with corresponding unit tests and integration tests to verify quota enforcement. The review feedback suggests adding a defensive null check for device_info_helper to prevent potential null pointer dereferences, and calculating must_remain_available before pool_size to ensure the quota pool does not exceed actual writable space on small disks, aligning with standard Chromium behavior.
Caps the Service Worker and CacheStorage per-origin quota at 6 MiB, since Cobalt should only need to cache from youtube.com. Previously the quota was 60% of the cache volume (80% pool x 75% per origin). CobaltContentBrowserClient::GetCacheQuotaSettings overrides the default quota calculation and also prevents QuotaManager from evicting the YouTube bucket, which deletes CacheStorage and unregisters the Service Worker: - pool_size is 12 MiB (2x the quota), so usage-based eviction, which starts at 70% of pool_size (8.4 MiB), cannot trigger below the quota. - should_remain_available is 0, which disables disk-pressure eviction. The default (10% of the volume, 2.4 MiB on a 24 MiB cache partition) exceeds the 1 MiB headroom in the cache directory budget. The non-HTTP cache budgets (5 MiB code cache, 6 MiB CacheStorage, 1 MiB headroom) are now shared constants so the HTTP cache reserve and the CacheStorage quota cannot drift apart. CacheStorage browsertests now use the same 6 MiB quota and verify that writes beyond it fail with QuotaExceededError. Bug: 576737712
andrewsavage1
approved these changes
Oct 27, 2026
sacuff
enabled auto-merge (squash)
October 27, 2026 21:02
cobalt-github-releaser-bot
pushed a commit
that referenced
this pull request
Oct 27, 2026
Refer to original PR: #12441 Caps the Service Worker and CacheStorage per-origin quota at 6 MiB, since Cobalt should only need to cache from youtube.com. Previously the quota was 60% of the cache volume (80% pool x 75% per origin). CobaltContentBrowserClient::GetCacheQuotaSettings overrides the default quota calculation and also prevents QuotaManager from evicting the YouTube bucket, which deletes CacheStorage and unregisters the Service Worker: - pool_size is 12 MiB (2x the quota), so usage-based eviction, which starts at 70% of pool_size (8.4 MiB), cannot trigger below the quota. - should_remain_available is 0, which disables disk-pressure eviction. The default (10% of the volume, 2.4 MiB on a 24 MiB cache partition) exceeds the 1 MiB headroom in the cache directory budget. The non-HTTP cache budgets (5 MiB code cache, 6 MiB CacheStorage, 1 MiB headroom) are now shared constants so the HTTP cache reserve and the CacheStorage quota cannot drift apart. CacheStorage browsertests now use the same 6 MiB quota and verify that writes beyond it fail with QuotaExceededError. Bug: 576737712 (cherry picked from commit a49334a)
This was referenced Oct 29, 2026
briantting
pushed a commit
that referenced
this pull request
Nov 3, 2026
Refer to original PR: #12441 Caps the Service Worker and CacheStorage per-origin quota at 6 MiB, since Cobalt should only need to cache from youtube.com. Previously the quota was 60% of the cache volume (80% pool x 75% per origin). CobaltContentBrowserClient::GetCacheQuotaSettings overrides the default quota calculation and also prevents QuotaManager from evicting the YouTube bucket, which deletes CacheStorage and unregisters the Service Worker: - pool_size is 12 MiB (2x the quota), so usage-based eviction, which starts at 70% of pool_size (8.4 MiB), cannot trigger below the quota. - should_remain_available is 0, which disables disk-pressure eviction. The default (10% of the volume, 2.4 MiB on a 24 MiB cache partition) exceeds the 1 MiB headroom in the cache directory budget. The non-HTTP cache budgets (5 MiB code cache, 6 MiB CacheStorage, 1 MiB headroom) are now shared constants so the HTTP cache reserve and the CacheStorage quota cannot drift apart. CacheStorage browsertests now use the same 6 MiB quota and verify that writes beyond it fail with QuotaExceededError. Bug: 576737712 (cherry picked from commit a49334a)
This was referenced Nov 9, 2026
briantting
pushed a commit
that referenced
this pull request
Nov 11, 2026
… to 6 MiB Refer to original PR: #12441 Caps the Service Worker and CacheStorage per-origin quota at 6 MiB, since Cobalt should only need to cache from youtube.com. Previously the quota was 60% of the cache volume (80% pool x 75% per origin). CobaltContentBrowserClient::GetCacheQuotaSettings overrides the default quota calculation and also prevents QuotaManager from evicting the YouTube bucket, which deletes CacheStorage and unregisters the Service Worker: - pool_size is 12 MiB (2x the quota), so usage-based eviction, which starts at 70% of pool_size (8.4 MiB), cannot trigger below the quota. - should_remain_available is 0, which disables disk-pressure eviction. The default (10% of the volume, 2.4 MiB on a 24 MiB cache partition) exceeds the 1 MiB headroom in the cache directory budget. The non-HTTP cache budgets (5 MiB code cache, 6 MiB CacheStorage, 1 MiB headroom) are now shared constants so the HTTP cache reserve and the CacheStorage quota cannot drift apart. CacheStorage browsertests now use the same 6 MiB quota and verify that writes beyond it fail with QuotaExceededError. Bug: 576737712 (cherry picked from commit a49334a)
briantting
pushed a commit
that referenced
this pull request
Nov 12, 2026
…ta to 6 MiB (#13938) Automated cherry-pick roll to staging. Original pull requests: - #12441 CONFLICTED files: ``` cobalt/browser/cache_storage_browsertest.cc ```⚠️ This PR has conflicts that must be resolved manually (don't forget to update the `.github/AUTOROLL` file). Use the following commands to checkout the branch locally and resolve the conflicts in a separate commit: ```bash gh pr checkout <pull_request_number> -R youtube/cobalt # Resolve conflicts and update .github/AUTOROLL then git add <resolved_files> # Copy CONFLICTED commit's message and metadata # Replace CONFLICTED in title with RESOLVED git commit -c <conflicted_sha> git push origin autoroll-main-to-staging ``` --------- Co-authored-by: Sean Cuff <sacuff@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Caps the Service Worker and CacheStorage per-origin quota at 6 MiB,
since Cobalt should only need to cache from youtube.com. Previously the
quota was 60% of the cache volume (80% pool x 75% per origin).
CobaltContentBrowserClient::GetCacheQuotaSettings overrides the default
quota calculation and also prevents QuotaManager from evicting the
YouTube bucket, which deletes CacheStorage and unregisters the Service
Worker:
starts at 70% of pool_size (8.4 MiB), cannot trigger below the quota.
The default (10% of the volume, 2.4 MiB on a 24 MiB cache partition)
exceeds the 1 MiB headroom in the cache directory budget.
The non-HTTP cache budgets (5 MiB code cache, 6 MiB CacheStorage, 1 MiB
headroom) are now shared constants so the HTTP cache reserve and the
CacheStorage quota cannot drift apart.
CacheStorage browsertests now use the same 6 MiB quota and verify that
writes beyond it fail with QuotaExceededError.
Bug: 576737712