New issue
Advanced search Search tips

Issue 838908 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: May 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug



Sign in to add a comment

Add the ability to create private caches

Project Member Reported by rayankans@chromium.org, May 2 2018

Issue description

Projects like background fetch want to use the CacheStorage API, but as things are now the cache internals will be exposed to developers.
 
Project Member

Comment 1 by bugdroid1@chromium.org, May 14 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/20976ed76a78951ac2a65789a03fd275e46af0f9

commit 20976ed76a78951ac2a65789a03fd275e46af0f9
Author: Rayan Kanso <rayankans@chromium.org>
Date: Mon May 14 15:07:34 2018

Add ownership to CacheStorage.

Modify Cache Storage API to include an ownership field. This gives the
ability to create private caches for internal usage, without exposing
the cache entries to developers.

The ownership enum will be part of the key for cache storage map look-ups.
The ownership enum will also be part of the path where the cache is
saved to disk. This way we can have more than one cache for the same
origin, and they are written to different places.

All caches will update the same quota client.

TBR=kenrb@chromium.org,mek@chromium.org

Bug:  838908 
Change-Id: I5494d696d9837abbbe2ef428be0f03e4360f2bda
Reviewed-on: https://chromium-review.googlesource.com/1037264
Commit-Queue: Rayan Kanso <rayankans@chromium.org>
Reviewed-by: Joshua Bell <jsbell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#558309}
[modify] https://crrev.com/20976ed76a78951ac2a65789a03fd275e46af0f9/content/browser/cache_storage/cache_storage_dispatcher_host.cc
[modify] https://crrev.com/20976ed76a78951ac2a65789a03fd275e46af0f9/content/browser/cache_storage/cache_storage_manager.cc
[modify] https://crrev.com/20976ed76a78951ac2a65789a03fd275e46af0f9/content/browser/cache_storage/cache_storage_manager.h
[modify] https://crrev.com/20976ed76a78951ac2a65789a03fd275e46af0f9/content/browser/cache_storage/cache_storage_manager_unittest.cc
[modify] https://crrev.com/20976ed76a78951ac2a65789a03fd275e46af0f9/content/browser/renderer_host/render_message_filter.cc
[modify] https://crrev.com/20976ed76a78951ac2a65789a03fd275e46af0f9/content/browser/service_worker/service_worker_browsertest.cc

Project Member

Comment 2 by bugdroid1@chromium.org, May 21 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/a19d7e5d1454b07423f50b9c45dc52ad97b19a23

commit a19d7e5d1454b07423f50b9c45dc52ad97b19a23
Author: Rayan Kanso <rayankans@chromium.org>
Date: Mon May 21 21:49:39 2018

Create owner-based Quota Clients for Cache Storage.

Bug:  838908 
Change-Id: I6b4e582ec1e572b3c35f105bb5f42f46f70df2d5
Reviewed-on: https://chromium-review.googlesource.com/1064412
Commit-Queue: Rayan Kanso <rayankans@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Joshua Bell <jsbell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#560349}
[modify] https://crrev.com/a19d7e5d1454b07423f50b9c45dc52ad97b19a23/chrome/browser/extensions/api/browsing_data/browsing_data_test.cc
[modify] https://crrev.com/a19d7e5d1454b07423f50b9c45dc52ad97b19a23/content/browser/browsing_data/browsing_data_remover_impl.cc
[modify] https://crrev.com/a19d7e5d1454b07423f50b9c45dc52ad97b19a23/content/browser/cache_storage/cache_storage_context_impl.cc
[modify] https://crrev.com/a19d7e5d1454b07423f50b9c45dc52ad97b19a23/content/browser/cache_storage/cache_storage_manager.cc
[modify] https://crrev.com/a19d7e5d1454b07423f50b9c45dc52ad97b19a23/content/browser/cache_storage/cache_storage_manager.h
[modify] https://crrev.com/a19d7e5d1454b07423f50b9c45dc52ad97b19a23/content/browser/cache_storage/cache_storage_manager_unittest.cc
[modify] https://crrev.com/a19d7e5d1454b07423f50b9c45dc52ad97b19a23/content/browser/cache_storage/cache_storage_quota_client.cc
[modify] https://crrev.com/a19d7e5d1454b07423f50b9c45dc52ad97b19a23/content/browser/cache_storage/cache_storage_quota_client.h
[modify] https://crrev.com/a19d7e5d1454b07423f50b9c45dc52ad97b19a23/content/browser/storage_partition_impl.cc
[modify] https://crrev.com/a19d7e5d1454b07423f50b9c45dc52ad97b19a23/content/public/browser/browsing_data_remover.h
[modify] https://crrev.com/a19d7e5d1454b07423f50b9c45dc52ad97b19a23/content/public/browser/storage_partition.h
[modify] https://crrev.com/a19d7e5d1454b07423f50b9c45dc52ad97b19a23/storage/browser/quota/quota_client.h
[modify] https://crrev.com/a19d7e5d1454b07423f50b9c45dc52ad97b19a23/storage/browser/test/mock_quota_manager_proxy.h

Project Member

Comment 3 by bugdroid1@chromium.org, May 22 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/761033b71c4c6f66d132560996b6eb463fa4dec7

commit 761033b71c4c6f66d132560996b6eb463fa4dec7
Author: Rayan Kanso <rayankans@chromium.org>
Date: Tue May 22 11:21:49 2018

Add a Write member to CacheStorageManager

Expose a "Write" function to CacheStorageManager, which will allow
non-CacheAPI owners to write a request/response pair directly to the
cache. CacheAPI writes will still be handled via the dispatcher using
batch operations.

Bug:  838908 
Change-Id: I7c0212bb1f97e9d5de47161ada636a9c5d1eef14
Reviewed-on: https://chromium-review.googlesource.com/1065999
Commit-Queue: Rayan Kanso <rayankans@chromium.org>
Reviewed-by: Joshua Bell <jsbell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#560533}
[modify] https://crrev.com/761033b71c4c6f66d132560996b6eb463fa4dec7/content/browser/cache_storage/cache_storage.cc
[modify] https://crrev.com/761033b71c4c6f66d132560996b6eb463fa4dec7/content/browser/cache_storage/cache_storage.h
[modify] https://crrev.com/761033b71c4c6f66d132560996b6eb463fa4dec7/content/browser/cache_storage/cache_storage_cache.cc
[modify] https://crrev.com/761033b71c4c6f66d132560996b6eb463fa4dec7/content/browser/cache_storage/cache_storage_cache.h
[modify] https://crrev.com/761033b71c4c6f66d132560996b6eb463fa4dec7/content/browser/cache_storage/cache_storage_manager.cc
[modify] https://crrev.com/761033b71c4c6f66d132560996b6eb463fa4dec7/content/browser/cache_storage/cache_storage_manager.h
[modify] https://crrev.com/761033b71c4c6f66d132560996b6eb463fa4dec7/content/browser/cache_storage/cache_storage_manager_unittest.cc

Project Member

Comment 4 by bugdroid1@chromium.org, May 22 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/6661e55107d6bc85ec770ab35c26a97565b1fb23

commit 6661e55107d6bc85ec770ab35c26a97565b1fb23
Author: Rayan Kanso <rayankans@chromium.org>
Date: Tue May 22 14:26:06 2018

Report correct QuotaClient ID in Cache Storage.

Bug:  838908 
Change-Id: I2846e8fa6e441bb873efb0627e694f774c60b75a
Reviewed-on: https://chromium-review.googlesource.com/1065827
Commit-Queue: Rayan Kanso <rayankans@chromium.org>
Reviewed-by: Joshua Bell <jsbell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#560563}
[modify] https://crrev.com/6661e55107d6bc85ec770ab35c26a97565b1fb23/content/browser/cache_storage/cache_storage.cc
[modify] https://crrev.com/6661e55107d6bc85ec770ab35c26a97565b1fb23/content/browser/cache_storage/cache_storage.h
[modify] https://crrev.com/6661e55107d6bc85ec770ab35c26a97565b1fb23/content/browser/cache_storage/cache_storage_cache.cc
[modify] https://crrev.com/6661e55107d6bc85ec770ab35c26a97565b1fb23/content/browser/cache_storage/cache_storage_cache.h
[modify] https://crrev.com/6661e55107d6bc85ec770ab35c26a97565b1fb23/content/browser/cache_storage/cache_storage_cache_unittest.cc
[modify] https://crrev.com/6661e55107d6bc85ec770ab35c26a97565b1fb23/content/browser/cache_storage/cache_storage_manager.cc
[modify] https://crrev.com/6661e55107d6bc85ec770ab35c26a97565b1fb23/content/browser/cache_storage/cache_storage_quota_client.cc
[modify] https://crrev.com/6661e55107d6bc85ec770ab35c26a97565b1fb23/content/browser/cache_storage/cache_storage_quota_client.h

Status: Fixed (was: Assigned)
Project Member

Comment 6 by bugdroid1@chromium.org, May 23 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/6afd9401efdc7dc050553f0937a8fd5254023543

commit 6afd9401efdc7dc050553f0937a8fd5254023543
Author: Rayan Kanso <rayankans@chromium.org>
Date: Wed May 23 10:51:03 2018

Fix WeakPtr bug when cache is created with a MemoryLoader.

I was writing a unittest where OpenCache is called with a MemoryLoader.
It kept crashing, and it seems to me that this was due to WriteIndex
running without callbacks. The CacheStorageCacheHandle was going out of
scope, and when a new one was being created by NotifyCacheCreated, there
was a crash due to some WeakPtr ref count internals.

This fix makes sure that the ref count is non-zero until all callbacks
consume the CacheStorageCacheHandle.

Bug:  838908 
Change-Id: I610b2cad26d5608bacd18a4daa60edc976093fb4
Reviewed-on: https://chromium-review.googlesource.com/1069350
Reviewed-by: Joshua Bell <jsbell@chromium.org>
Commit-Queue: Rayan Kanso <rayankans@chromium.org>
Cr-Commit-Position: refs/heads/master@{#561028}
[modify] https://crrev.com/6afd9401efdc7dc050553f0937a8fd5254023543/content/browser/cache_storage/cache_storage.cc

Sign in to add a comment