Index: content/browser/service_worker/service_worker_version.cc |
diff --git a/content/browser/service_worker/service_worker_version.cc b/content/browser/service_worker/service_worker_version.cc |
index 66ca8830756abe28ea8e8b848c9ece3a822a8e9d..8bde3c1c3b24d771cb2b7695b4f5836c42174d0c 100644 |
--- a/content/browser/service_worker/service_worker_version.cc |
+++ b/content/browser/service_worker/service_worker_version.cc |
@@ -88,8 +88,10 @@ ServiceWorkerVersion::ServiceWorkerVersion( |
registration_id_(kInvalidServiceWorkerVersionId), |
status_(NEW), |
context_(context), |
+ script_cache_map_(this), |
weak_factory_(this) { |
DCHECK(context_); |
+ DCHECK(registration); |
if (registration) { |
registration_id_ = registration->id(); |
script_url_ = registration->script_url(); |
@@ -351,6 +353,14 @@ void ServiceWorkerVersion::RemoveListener(Listener* listener) { |
listeners_.RemoveObserver(listener); |
} |
+void ServiceWorkerVersion::NotifyMainScriptCached(bool success) { |
+ FOR_EACH_OBSERVER(Listener, listeners_, OnMainScriptCached(this, success)); |
+} |
+ |
+void ServiceWorkerVersion::NotifyAllScriptsCached(bool success) { |
+ FOR_EACH_OBSERVER(Listener, listeners_, OnAllScriptsCached(this, success)); |
+} |
+ |
void ServiceWorkerVersion::OnStarted() { |
DCHECK_EQ(RUNNING, running_status()); |
// Fire all start callbacks. |
@@ -550,20 +560,6 @@ void ServiceWorkerVersion::OnSyncEventFinished( |
sync_callbacks_.Remove(request_id); |
} |
-void ServiceWorkerVersion::AddToScriptCache( |
- const GURL& url, int64 resource_id) { |
- DCHECK_EQ(kInvalidServiceWorkerResponseId, LookupInScriptCache(url)); |
- DCHECK_EQ(NEW, status_); |
- script_cache_map_[url] = resource_id; |
-} |
- |
-int64 ServiceWorkerVersion::LookupInScriptCache(const GURL& url) { |
- ResourceIDMap::const_iterator found = script_cache_map_.find(url); |
- if (found == script_cache_map_.end()) |
- return kInvalidServiceWorkerResponseId; |
- return found->second; |
-} |
- |
void ServiceWorkerVersion::OnPostMessageToDocument( |
int client_id, |
const base::string16& message, |