Commit 0767c4a2 authored by Egor Pasko's avatar Egor Pasko Committed by Commit Bot

v8 code cache: avoid discarding for sw and inline scripts

CachedMetadataHandlers for inline scripts should not be discarded as
part of the experiment because:
1. they were not found to occupy a lot of memory in local experiments
2. there is no mechanism to prevent them from setting the timestamp
   again and rewriting the cache on disk, which is harder to analyse and
   imples unnecessary CPU/disk usage

Ignoring the discarding for SW scripts just for the reason (1) above and
for consistency, to make it easier to reason about.

Bug: 1045052
Change-Id: I010037fad0a1354e424fa2cab3e0d48db5a033ec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2144107Reviewed-by: default avatarLeszek Swirski <leszeks@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Egor Pasko <pasko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#760142}
parent f54d8328
...@@ -48,6 +48,8 @@ void ServiceWorkerScriptCachedMetadataHandler::SetCachedMetadata( ...@@ -48,6 +48,8 @@ void ServiceWorkerScriptCachedMetadataHandler::SetCachedMetadata(
void ServiceWorkerScriptCachedMetadataHandler::ClearCachedMetadata( void ServiceWorkerScriptCachedMetadataHandler::ClearCachedMetadata(
ClearCacheType type) { ClearCacheType type) {
if (type == kDiscardLocally)
return;
cached_metadata_ = nullptr; cached_metadata_ = nullptr;
if (type != kClearPersistentStorage) if (type != kClearPersistentStorage)
return; return;
......
...@@ -37,6 +37,8 @@ class SourceKeyedCachedMetadataHandler::SingleKeyHandler final ...@@ -37,6 +37,8 @@ class SourceKeyedCachedMetadataHandler::SingleKeyHandler final
} }
void ClearCachedMetadata(ClearCacheType cache_type) override { void ClearCachedMetadata(ClearCacheType cache_type) override {
if (cache_type == kDiscardLocally)
return;
parent_->cached_metadata_map_.erase(key_); parent_->cached_metadata_map_.erase(key_);
if (cache_type == CachedMetadataHandler::kClearPersistentStorage) if (cache_type == CachedMetadataHandler::kClearPersistentStorage)
parent_->SendToPlatform(); parent_->SendToPlatform();
...@@ -104,6 +106,8 @@ SingleCachedMetadataHandler* SourceKeyedCachedMetadataHandler::HandlerForSource( ...@@ -104,6 +106,8 @@ SingleCachedMetadataHandler* SourceKeyedCachedMetadataHandler::HandlerForSource(
void SourceKeyedCachedMetadataHandler::ClearCachedMetadata( void SourceKeyedCachedMetadataHandler::ClearCachedMetadata(
CachedMetadataHandler::ClearCacheType cache_type) { CachedMetadataHandler::ClearCacheType cache_type) {
if (cache_type == kDiscardLocally)
return;
cached_metadata_map_.clear(); cached_metadata_map_.clear();
if (cache_type == CachedMetadataHandler::kClearPersistentStorage) if (cache_type == CachedMetadataHandler::kClearPersistentStorage)
SendToPlatform(); SendToPlatform();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment