Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_SCRIPT_CACHE_MAP_H_ | |
| 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_SCRIPT_CACHE_MAP_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 | |
| 12 class GURL; | |
| 13 | |
| 14 namespace content { | |
| 15 | |
| 16 class ServiceWorkerVersion; | |
| 17 | |
| 18 // Class that maintains the mapping between urls and a resource id | |
| 19 // for a particular versions implicit script resources. | |
| 20 class ServiceWorkerScriptCacheMap { | |
| 21 public: | |
| 22 int64 Lookup(const GURL& url); | |
| 23 | |
| 24 // 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.
| |
| 25 // of resources ids. | |
| 26 // TODO(michaeln): Need more info about errors in Finished(). | |
| 27 void NotifyStartedCaching(const GURL& url, int64 resource_id); | |
| 28 void NotifyFinishedCaching(const GURL& url, bool success); | |
| 29 void NotifyEvalCompletion(); | |
| 30 | |
| 31 private: | |
| 32 typedef std::map<GURL, int64> ResourceIDMap; | |
| 33 | |
| 34 // 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.
| |
| 35 friend class ServiceWorkerVersion; | |
| 36 ServiceWorkerScriptCacheMap(ServiceWorkerVersion* owner); | |
|
nhiroki
2014/05/13 07:44:34
nit: explicit
michaeln
2014/05/13 22:41:11
Done.
| |
| 37 ~ServiceWorkerScriptCacheMap(); | |
| 38 | |
| 39 ServiceWorkerVersion* owner_; | |
| 40 ResourceIDMap resource_ids_; | |
| 41 | |
| 42 // 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.
| |
| 43 bool is_eval_complete_; | |
| 44 int resources_started_; | |
| 45 int resources_finished_; | |
| 46 bool has_error_; | |
| 47 | |
| 48 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerScriptCacheMap); | |
| 49 }; | |
| 50 | |
| 51 } // namespace content | |
| 52 | |
| 53 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_SCRIPT_CACHE_MAP_H_ | |
| OLD | NEW |