Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 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_RENDERER_DOM_STORAGE_LOCAL_STORAGE_CACHED_AREAS_H_ | |
| 6 #define CONTENT_RENDERER_DOM_STORAGE_LOCAL_STORAGE_CACHED_AREAS_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "base/memory/ref_counted.h" | |
| 12 #include "url/origin.h" | |
| 13 | |
| 14 namespace content { | |
| 15 class LocalStorageCachedArea; | |
| 16 class StoragePartitionService; | |
| 17 | |
| 18 // Owns all the LocalStorageCachedArea objects in a renderer. This is needed | |
| 19 // because we can have n LocalStorageArea objects for the same origin but we | |
| 20 // want just one LocalStorageCachedArea to service them (no point in having | |
| 21 // multiple caches of the same data in the same process). | |
| 22 class LocalStorageCachedAreas { | |
| 23 public: | |
| 24 explicit LocalStorageCachedAreas( | |
| 25 StoragePartitionService* storage_partition_service); | |
| 26 ~LocalStorageCachedAreas(); | |
| 27 | |
| 28 scoped_refptr<LocalStorageCachedArea> GetLocalStorageCachedArea( | |
|
michaeln
2016/03/01 01:38:48
naming nit: method names might be shorter are more
| |
| 29 const url::Origin& origin); | |
| 30 | |
| 31 // Called by LocalStorageCachedArea on destruction. | |
| 32 void LocalStorageCacheAreaClosed(LocalStorageCachedArea* cached_area); | |
| 33 | |
| 34 private: | |
| 35 StoragePartitionService* const storage_partition_service_; | |
| 36 | |
| 37 // Maps from an origin to its LocalStorageCachedArea object. The object owns | |
| 38 // itself. | |
| 39 std::map<url::Origin, LocalStorageCachedArea*> cached_areas_; | |
| 40 | |
| 41 DISALLOW_COPY_AND_ASSIGN(LocalStorageCachedAreas); | |
| 42 }; | |
| 43 | |
| 44 } // namespace content | |
| 45 | |
| 46 #endif // CONTENT_RENDERER_DOM_STORAGE_LOCAL_STORAGE_CACHED_AREAS_H_ | |
| OLD | NEW |