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 e259d59c161d3b6a1c3562e3005f1d09dde560de..4f5a203ff9027714799e19d4cce243c943519c74 100644 |
--- a/content/browser/service_worker/service_worker_script_cache_map.h |
+++ b/content/browser/service_worker/service_worker_script_cache_map.h |
@@ -6,9 +6,10 @@ |
#define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_SCRIPT_CACHE_MAP_H_ |
#include <map> |
+#include <vector> |
#include "base/basictypes.h" |
-#include "base/observer_list.h" |
+#include "content/browser/service_worker/service_worker_database.h" |
class GURL; |
@@ -20,33 +21,21 @@ class ServiceWorkerVersion; |
// for a particular versions implicit script resources. |
class ServiceWorkerScriptCacheMap { |
public: |
- class Observer { |
- public: |
- // 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; |
- |
- // 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; |
- }; |
- |
int64 Lookup(const GURL& url); |
- // Adds and removes Observers. |
- void AddObserver(Observer* observer); |
- void RemoveObserver(Observer* observer); |
- |
// Used during the initial run of a new version to build the map |
// of resources ids. |
- // TODO(michaeln): Need more info about errors in Finished. |
void NotifyStartedCaching(const GURL& url, int64 resource_id); |
void NotifyFinishedCaching(const GURL& url, bool success); |
- void NotifyEvalCompletion(); |
+ |
+ // Used to retrieve the results of the initial run of a new version. |
+ bool HasError() const { return has_error_; } |
+ void GetResources( |
+ std::vector<ServiceWorkerDatabase::ResourceRecord>* resources); |
+ |
+ // Used when loading an existing version. |
+ void SetResources( |
+ const std::vector<ServiceWorkerDatabase::ResourceRecord>& resources); |
private: |
typedef std::map<GURL, int64> ResourceIDMap; |
@@ -58,13 +47,7 @@ class ServiceWorkerScriptCacheMap { |
ServiceWorkerVersion* owner_; |
ResourceIDMap resource_ids_; |
- |
- // Members used only during initial install. |
- bool is_eval_complete_; |
- int resources_started_; |
- int resources_finished_; |
bool has_error_; |
- ObserverList<Observer> observers_; |
DISALLOW_COPY_AND_ASSIGN(ServiceWorkerScriptCacheMap); |
}; |