// 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.
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;
ServiceWorkerVersion* owner_;
base::WeakPtr<ServiceWorkerContextCore> context_;
- ResourceIDMap resource_ids_;
+ ResourceMap resource_map_;
net::URLRequestStatus main_script_status_;
DISALLOW_COPY_AND_ASSIGN(ServiceWorkerScriptCacheMap);