OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CACHE_MAP_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CACHE_MAP_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CACHE_MAP_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CACHE_MAP_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 // Used to retrieve the results of the initial run of a new version. | 34 // Used to retrieve the results of the initial run of a new version. |
35 bool HasError() const { return has_error_; } | 35 bool HasError() const { return has_error_; } |
36 void GetResources( | 36 void GetResources( |
37 std::vector<ServiceWorkerDatabase::ResourceRecord>* resources); | 37 std::vector<ServiceWorkerDatabase::ResourceRecord>* resources); |
38 | 38 |
39 // Used when loading an existing version. | 39 // Used when loading an existing version. |
40 void SetResources( | 40 void SetResources( |
41 const std::vector<ServiceWorkerDatabase::ResourceRecord>& resources); | 41 const std::vector<ServiceWorkerDatabase::ResourceRecord>& resources); |
42 | 42 |
| 43 size_t size() const { return resource_ids_.size(); } |
| 44 |
43 private: | 45 private: |
44 typedef std::map<GURL, int64> ResourceIDMap; | 46 typedef std::map<GURL, int64> ResourceIDMap; |
45 | 47 |
46 // The version objects owns its script cache and provides a rawptr to it. | 48 // The version objects owns its script cache and provides a rawptr to it. |
47 friend class ServiceWorkerVersion; | 49 friend class ServiceWorkerVersion; |
48 ServiceWorkerScriptCacheMap( | 50 ServiceWorkerScriptCacheMap( |
49 ServiceWorkerVersion* owner, | 51 ServiceWorkerVersion* owner, |
50 base::WeakPtr<ServiceWorkerContextCore> context); | 52 base::WeakPtr<ServiceWorkerContextCore> context); |
51 ~ServiceWorkerScriptCacheMap(); | 53 ~ServiceWorkerScriptCacheMap(); |
52 | 54 |
53 ServiceWorkerVersion* owner_; | 55 ServiceWorkerVersion* owner_; |
54 base::WeakPtr<ServiceWorkerContextCore> context_; | 56 base::WeakPtr<ServiceWorkerContextCore> context_; |
55 ResourceIDMap resource_ids_; | 57 ResourceIDMap resource_ids_; |
56 bool has_error_; | 58 bool has_error_; |
57 | 59 |
58 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerScriptCacheMap); | 60 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerScriptCacheMap); |
59 }; | 61 }; |
60 | 62 |
61 } // namespace content | 63 } // namespace content |
62 | 64 |
63 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CACHE_MAP_H_ | 65 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CACHE_MAP_H_ |
OLD | NEW |