Commit 9f0f48cb authored by jkarlin's avatar jkarlin Committed by Commit bot

Change ownership of the parameters to ServiceWorkerCache:: Put and Match.

These functions used to take unowned raw pointers as arguments.  Now the functions own them and they're scoped_ptrs.  This both makes ownership clearer and allows for the functions to terminate early without calling their callbacks (needed for a downstream change to run CreateBackend lazily).

Related CLs:
* 1. https://crrev.com/542703002: Change ownership of the parameters to ServiceWorkerCache:: Put and Match.
2. https://crrev.com/545533002: Move ServiceWorkerCache backend creation to a lazy init function.
3. https://crrev.com/548533002: Make ServiceWorkerCacheStorage::CacheLoader::LoadCache synchronous
4. https://crrev.com/549493002: Expose ServiceWorkerCache objects to ServiceWorkerCacheStorageManager clients.

BUG=392621

Review URL: https://codereview.chromium.org/542703002

Cr-Commit-Position: refs/heads/master@{#294366}
parent 9d84bde1
......@@ -68,21 +68,21 @@ class CONTENT_EXPORT ServiceWorkerCache {
// Returns ErrorTypeNotFound if not found. The callback will always be called.
// |request| must remain valid until the callback is called.
void Match(ServiceWorkerFetchRequest* request,
void Match(scoped_ptr<ServiceWorkerFetchRequest> request,
const ResponseCallback& callback);
// Puts the request and response object in the cache. The response body (if
// present) is stored in the cache, but not the request body. Returns
// ErrorTypeOK on success. The callback will always be called. |request| and
// |response| must remain valid until the callback is called.
void Put(ServiceWorkerFetchRequest* request,
ServiceWorkerResponse* response,
void Put(scoped_ptr<ServiceWorkerFetchRequest> request,
scoped_ptr<ServiceWorkerResponse> response,
const ErrorCallback& callback);
// Returns ErrorNotFound if not found. Otherwise deletes and returns
// ErrorTypeOK. The callback will always be called. |request| must remain
// valid until the callback is called.
void Delete(ServiceWorkerFetchRequest* request,
void Delete(scoped_ptr<ServiceWorkerFetchRequest> request,
const ErrorCallback& callback);
// TODO(jkarlin): Have keys take an optional ServiceWorkerFetchRequest.
......
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