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 |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e3a450cacb43c7fb0c7c725120c827d30addf4e1 |
--- /dev/null |
+++ b/content/browser/service_worker/service_worker_script_cache_map.h |
@@ -0,0 +1,53 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_SCRIPT_CACHE_MAP_H_ |
+#define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_SCRIPT_CACHE_MAP_H_ |
+ |
+#include <map> |
+ |
+#include "base/basictypes.h" |
+ |
+class GURL; |
+ |
+namespace content { |
+ |
+class ServiceWorkerVersion; |
+ |
+// Class that maintains the mapping between urls and a resource id |
+// for a particular versions implicit script resources. |
+class ServiceWorkerScriptCacheMap { |
+ public: |
+ int64 Lookup(const GURL& url); |
+ |
+ // Used during the initial run of a new version to build the map |
nhiroki
2014/05/13 07:44:34
nit: s/"run of"/"run of"/ (there are 2 spaces.)
michaeln
2014/05/13 22:41:11
Done.
|
+ // 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(); |
+ |
+ private: |
+ typedef std::map<GURL, int64> ResourceIDMap; |
+ |
+ // The version objects owns it's script cache and provides a rawptr to it. |
kinuko
2014/05/13 16:14:25
objects owns it's -> object owns its
michaeln
2014/05/13 22:41:11
Done.
|
+ friend class ServiceWorkerVersion; |
+ ServiceWorkerScriptCacheMap(ServiceWorkerVersion* owner); |
nhiroki
2014/05/13 07:44:34
nit: explicit
michaeln
2014/05/13 22:41:11
Done.
|
+ ~ServiceWorkerScriptCacheMap(); |
+ |
+ ServiceWorkerVersion* owner_; |
+ ResourceIDMap resource_ids_; |
+ |
+ // Members used only during intial install. |
nhiroki
2014/05/13 07:44:34
nit: s/intial/initial/
michaeln
2014/05/13 22:41:11
Done.
|
+ bool is_eval_complete_; |
+ int resources_started_; |
+ int resources_finished_; |
+ bool has_error_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ServiceWorkerScriptCacheMap); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_SCRIPT_CACHE_MAP_H_ |