Index: content/browser/service_worker/service_worker_version.h |
diff --git a/content/browser/service_worker/service_worker_version.h b/content/browser/service_worker/service_worker_version.h |
index 84ecc011ad01a8ac62416fc1f35d59198dba6a5a..2bfc1306586c2b778fecd123ca5fff1dcac1bea9 100644 |
--- a/content/browser/service_worker/service_worker_version.h |
+++ b/content/browser/service_worker/service_worker_version.h |
@@ -15,6 +15,7 @@ |
#include "base/memory/scoped_ptr.h" |
#include "base/observer_list.h" |
#include "content/browser/service_worker/embedded_worker_instance.h" |
+#include "content/browser/service_worker/service_worker_script_cache_map.h" |
#include "content/common/content_export.h" |
#include "content/common/service_worker/service_worker_status_code.h" |
#include "content/common/service_worker/service_worker_types.h" |
@@ -86,6 +87,18 @@ class CONTENT_EXPORT ServiceWorkerVersion |
const base::string16& message, |
int line_number, |
const GURL& source_url) = 0; |
+ |
+ // Notification that the main script resource has been written to |
+ // the disk cache. Only called when a version is being initially |
+ // installed. |
+ virtual void OnMainScriptCached(ServiceWorkerVersion* version, |
+ bool success) = 0; |
michaeln
2014/05/13 06:51:00
i'll have to track down derivatives in tests and f
kinuko
2014/05/13 16:14:25
Looks like these can be in a separate listener cla
kinuko
2014/05/13 16:14:25
Is this where we compare scripts to see if it's th
michaeln
2014/05/13 22:41:11
Yes. In the first time and update cases, a version
michaeln
2014/05/13 22:41:11
Done, ServiceWorkerScriptCacheMap::Observer.
|
+ |
+ // Notification that the main script resource and all imports have |
+ // been written to the disk cache. Only called when a version is |
+ // being initially installed. |
+ virtual void OnAllScriptsCached(ServiceWorkerVersion* version, |
+ bool success) = 0; |
kinuko
2014/05/13 16:14:25
Is this where we actually commit the registration
michaeln
2014/05/13 22:41:11
I think so. There are at least two things of inter
|
}; |
ServiceWorkerVersion( |
@@ -96,6 +109,9 @@ class CONTENT_EXPORT ServiceWorkerVersion |
int64 version_id() const { return version_id_; } |
int64 registration_id() const { return registration_id_; } |
+ const GURL& script_url() const { return script_url_; } |
+ const GURL& scope() const { return scope_; } |
nhiroki
2014/05/13 07:44:34
scope() doesn't seem to be neccessary for this cha
michaeln
2014/05/13 22:41:11
Done.
|
+ |
RunningStatus running_status() const { |
return static_cast<RunningStatus>(embedded_worker_->status()); |
} |
@@ -196,8 +212,22 @@ class CONTENT_EXPORT ServiceWorkerVersion |
void AddListener(Listener* listener); |
void RemoveListener(Listener* listener); |
+ // Propagates script caching progress to listneners. |
nhiroki
2014/05/13 07:44:34
nit: s/listneners/listeners/
michaeln
2014/05/13 22:41:11
removed these methods
|
+ void NotifyMainScriptCached(bool success); |
+ void NotifyAllScriptsCached(bool success); |
+ |
+ ServiceWorkerScriptCacheMap* script_cache_map() { return &script_cache_map_; } |
+ |
EmbeddedWorkerInstance* embedded_worker() { return embedded_worker_.get(); } |
+ private: |
+ typedef ServiceWorkerVersion self; |
+ typedef std::map<ServiceWorkerProviderHost*, int> ControlleeMap; |
+ typedef IDMap<ServiceWorkerProviderHost> ControlleeByIDMap; |
+ friend class base::RefCounted<ServiceWorkerVersion>; |
+ |
+ virtual ~ServiceWorkerVersion(); |
+ |
// EmbeddedWorkerInstance::Listener overrides: |
virtual void OnStarted() OVERRIDE; |
virtual void OnStopped() OVERRIDE; |
@@ -212,18 +242,6 @@ class CONTENT_EXPORT ServiceWorkerVersion |
const GURL& source_url) OVERRIDE; |
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
- void AddToScriptCache(const GURL& url, int64 resource_id); |
- int64 LookupInScriptCache(const GURL& url); |
- |
- private: |
- typedef ServiceWorkerVersion self; |
- typedef std::map<ServiceWorkerProviderHost*, int> ControlleeMap; |
- typedef IDMap<ServiceWorkerProviderHost> ControlleeByIDMap; |
- typedef std::map<GURL, int64> ResourceIDMap; |
- friend class base::RefCounted<ServiceWorkerVersion>; |
- |
- virtual ~ServiceWorkerVersion(); |
- |
void RunStartWorkerCallbacksOnError(ServiceWorkerStatusCode status); |
void DispatchInstallEventAfterStartWorker(int active_version_id, |
@@ -264,8 +282,7 @@ class CONTENT_EXPORT ServiceWorkerVersion |
ControlleeByIDMap controllee_by_id_; |
base::WeakPtr<ServiceWorkerContextCore> context_; |
ObserverList<Listener> listeners_; |
- |
- ResourceIDMap script_cache_map_; |
+ ServiceWorkerScriptCacheMap script_cache_map_; |
base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; |