Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1005)

Unified Diff: content/browser/service_worker/service_worker_script_cache_map.h

Issue 647953003: Service Worker script sizes in database. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Fixed crash where writer_ was null Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/service_worker/service_worker_script_cache_map.h
diff --git a/content/browser/service_worker/service_worker_script_cache_map.h b/content/browser/service_worker/service_worker_script_cache_map.h
index 7bcbf09eca68837229391c71e95c3b7f2704b0cf..de814c210b17d6d579ecd79b4f92b04a02d363ec 100644
--- a/content/browser/service_worker/service_worker_script_cache_map.h
+++ b/content/browser/service_worker/service_worker_script_cache_map.h
@@ -25,12 +25,16 @@ class ServiceWorkerVersion;
// for a particular version's implicit script resources.
class CONTENT_EXPORT ServiceWorkerScriptCacheMap {
public:
- int64 Lookup(const GURL& url);
+ int64 LookupResourceId(const GURL& url);
+ // A size of -1 means that we don't know the size yet
+ // (it has not finished caching).
+ int64 LookupResourceSize(const GURL& url);
// Used during the initial run of a new version to build the map
// of resources ids.
void NotifyStartedCaching(const GURL& url, int64 resource_id);
void NotifyFinishedCaching(const GURL& url,
+ int64 size_bytes,
const net::URLRequestStatus& status);
// Used to retrieve the results of the initial run of a new version.
@@ -41,14 +45,14 @@ class CONTENT_EXPORT ServiceWorkerScriptCacheMap {
void SetResources(
const std::vector<ServiceWorkerDatabase::ResourceRecord>& resources);
- size_t size() const { return resource_ids_.size(); }
+ size_t size() const { return resource_map_.size(); }
const net::URLRequestStatus& main_script_status() const {
return main_script_status_;
}
private:
- typedef std::map<GURL, int64> ResourceIDMap;
+ typedef std::map<GURL, ServiceWorkerDatabase::ResourceRecord> ResourceMap;
// The version objects owns its script cache and provides a rawptr to it.
friend class ServiceWorkerVersion;
@@ -59,7 +63,7 @@ class CONTENT_EXPORT ServiceWorkerScriptCacheMap {
ServiceWorkerVersion* owner_;
base::WeakPtr<ServiceWorkerContextCore> context_;
- ResourceIDMap resource_ids_;
+ ResourceMap resource_map_;
net::URLRequestStatus main_script_status_;
DISALLOW_COPY_AND_ASSIGN(ServiceWorkerScriptCacheMap);

Powered by Google App Engine
This is Rietveld 408576698