net/disk_cache/sql: Support entry creation on write in PersistentStore This CL updates SqlPersistentStore and its internal backend classes to support creating a new entry in the database during write operations. Previously, `WriteEntryData` and `WriteEntryDataAndMetadata` required an existing `ResId`. Now: - `WriteEntryData` accepts a `ResIdOrTime` variant. If a `base::Time` is provided, it creates a new entry with that creation time. - `WriteEntryDataAndMetadata` accepts an `std::optional<ResId>`. If `std::nullopt` is passed, it creates a new entry. This is a foundational step for implementing lazy entry creation in the SQL backend, allowing the actual database insertion to be deferred until data is written or the entry is closed. Lazy entry creation will be implemented in https://crrev.com/c/7532735. Bug: 479348720 Change-Id: I01ce2c6712f629ec0471f4c25faa8b95b4f9e860 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7544748 Reviewed-by: Nidhi Jaju <nidhijaju@chromium.org> Reviewed-by: Maks Orlovich <morlovich@chromium.org> Commit-Queue: Tsuyoshi Horo <horo@chromium.org> Cr-Commit-Position: refs/heads/main@{#1581251} NOKEYCHECK=True GitOrigin-RevId: 2288d17407947287ffa4ebc9ca067296004b439d
diff --git a/metrics/histograms/metadata/net/enums.xml b/metrics/histograms/metadata/net/enums.xml index 6fb543d..a557fd4 100644 --- a/metrics/histograms/metadata/net/enums.xml +++ b/metrics/histograms/metadata/net/enums.xml
@@ -3071,9 +3071,11 @@ <int value="3" label="StartEviction"/> <int value="4" label="DeleteLiveEntry"/> <int value="5" label="DeleteLiveEntriesBetween"/> + <int value="6" label="WriteEntryDataAndMetadata"/> + <int value="7" label="WriteEntryData"/> </enum> -<!-- LINT.ThenChange(//net/disk_cache/sql/sql_persistent_store_backend_shard.cc:IndexMismatchLocation) --> +<!-- LINT.ThenChange(//net/disk_cache/sql/sql_persistent_store_backend_shard.h:IndexMismatchLocation) --> <!-- LINT.IfChange(SqlDiskCacheStoreError) -->