Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: content/renderer/dom_storage/local_storage_cached_areas.h

Issue 1814003002: Implement the renderer side of the mojo based local storage implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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_RENDERER_DOM_STORAGE_LOCAL_STORAGE_CACHED_AREAS_H_ 5 #ifndef CONTENT_RENDERER_DOM_STORAGE_LOCAL_STORAGE_CACHED_AREAS_H_
6 #define CONTENT_RENDERER_DOM_STORAGE_LOCAL_STORAGE_CACHED_AREAS_H_ 6 #define CONTENT_RENDERER_DOM_STORAGE_LOCAL_STORAGE_CACHED_AREAS_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h"
12 #include "url/origin.h" 11 #include "url/origin.h"
13 12
14 namespace content { 13 namespace content {
15 class LocalStorageCachedArea; 14 class LocalStorageCachedArea;
16 class StoragePartitionService; 15 class StoragePartitionService;
17 16
18 // Owns all the LocalStorageCachedArea objects in a renderer. This is needed 17 // 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 18 // 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 19 // want just one LocalStorageCachedArea to service them (no point in having
21 // multiple caches of the same data in the same process). 20 // multiple caches of the same data in the same process).
22 class LocalStorageCachedAreas { 21 class LocalStorageCachedAreas {
23 public: 22 public:
24 explicit LocalStorageCachedAreas( 23 explicit LocalStorageCachedAreas(
25 StoragePartitionService* storage_partition_service); 24 StoragePartitionService* storage_partition_service);
26 ~LocalStorageCachedAreas(); 25 ~LocalStorageCachedAreas();
27 26
28 scoped_refptr<LocalStorageCachedArea> GetLocalStorageCachedArea( 27 // Returns, creating if necessary, a cached storage area for the given origin.
29 const url::Origin& origin); 28 // The object owns itself, and self-destructs when there no storage areas for
29 // the origin left.
30 LocalStorageCachedArea* GetLocalStorageCachedArea(const url::Origin& origin);
michaeln 2016/03/18 01:05:17 naming nit: since these are in a class named Local
jam 2016/03/18 16:48:33 Done.
30 31
31 // Called by LocalStorageCachedArea on destruction. 32 // Called by LocalStorageCachedArea on destruction.
32 void LocalStorageCacheAreaClosed(LocalStorageCachedArea* cached_area); 33 void LocalStorageCacheAreaClosed(LocalStorageCachedArea* cached_area);
33 34
34 private: 35 private:
35 StoragePartitionService* const storage_partition_service_; 36 StoragePartitionService* const storage_partition_service_;
michaeln 2016/03/18 01:05:17 I'm a wary about the assumption that Blink is well
jam 2016/03/18 16:48:33 in this specific case, I prefer to not do this unl
36 37
37 // Maps from an origin to its LocalStorageCachedArea object. The object owns 38 // Maps from an origin to its LocalStorageCachedArea object. The object owns
38 // itself. 39 // itself.
39 std::map<url::Origin, LocalStorageCachedArea*> cached_areas_; 40 std::map<url::Origin, LocalStorageCachedArea*> cached_areas_;
40 41
41 DISALLOW_COPY_AND_ASSIGN(LocalStorageCachedAreas); 42 DISALLOW_COPY_AND_ASSIGN(LocalStorageCachedAreas);
42 }; 43 };
43 44
44 } // namespace content 45 } // namespace content
45 46
46 #endif // CONTENT_RENDERER_DOM_STORAGE_LOCAL_STORAGE_CACHED_AREAS_H_ 47 #endif // CONTENT_RENDERER_DOM_STORAGE_LOCAL_STORAGE_CACHED_AREAS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698