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

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

Issue 1832813002: Add mojom module suffix in .mojom files in content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Tom's comment Created 4 years, 8 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_AREA_H_ 5 #ifndef CONTENT_RENDERER_DOM_STORAGE_LOCAL_STORAGE_CACHED_AREA_H_
6 #define CONTENT_RENDERER_DOM_STORAGE_LOCAL_STORAGE_CACHED_AREA_H_ 6 #define CONTENT_RENDERER_DOM_STORAGE_LOCAL_STORAGE_CACHED_AREA_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" 11 #include "base/memory/ref_counted.h"
12 #include "base/strings/nullable_string16.h" 12 #include "base/strings/nullable_string16.h"
13 #include "content/common/leveldb_wrapper.mojom.h" 13 #include "content/common/leveldb_wrapper.mojom.h"
14 #include "mojo/public/cpp/bindings/binding.h" 14 #include "mojo/public/cpp/bindings/binding.h"
15 #include "url/gurl.h" 15 #include "url/gurl.h"
16 #include "url/origin.h" 16 #include "url/origin.h"
17 17
18 namespace content { 18 namespace content {
19 class DOMStorageMap; 19 class DOMStorageMap;
20 class LocalStorageArea; 20 class LocalStorageArea;
21 class LocalStorageCachedAreas; 21 class LocalStorageCachedAreas;
22
23 namespace mojom {
22 class StoragePartitionService; 24 class StoragePartitionService;
25 }
23 26
24 // An in-process implementation of LocalStorage using a LevelDB Mojo service. 27 // An in-process implementation of LocalStorage using a LevelDB Mojo service.
25 // Maintains a complete cache of the origin's Map of key/value pairs for fast 28 // Maintains a complete cache of the origin's Map of key/value pairs for fast
26 // access. The cache is primed on first access and changes are written to the 29 // access. The cache is primed on first access and changes are written to the
27 // backend through the level db interface pointer. Mutations originating in 30 // backend through the level db interface pointer. Mutations originating in
28 // other processes are applied to the cache via LevelDBObserver callbacks. 31 // other processes are applied to the cache via mojom::LevelDBObserver
32 // callbacks.
29 // There is one LocalStorageCachedArea for potentially many LocalStorageArea 33 // There is one LocalStorageCachedArea for potentially many LocalStorageArea
30 // objects. 34 // objects.
31 class LocalStorageCachedArea : public LevelDBObserver, 35 class LocalStorageCachedArea : public mojom::LevelDBObserver,
32 public base::RefCounted<LocalStorageCachedArea> { 36 public base::RefCounted<LocalStorageCachedArea> {
33 public: 37 public:
34 LocalStorageCachedArea(const url::Origin& origin, 38 LocalStorageCachedArea(
35 StoragePartitionService* storage_partition_service, 39 const url::Origin& origin,
36 LocalStorageCachedAreas* cached_areas); 40 mojom::StoragePartitionService* storage_partition_service,
41 LocalStorageCachedAreas* cached_areas);
37 42
38 // These correspond to blink::WebStorageArea. 43 // These correspond to blink::WebStorageArea.
39 unsigned GetLength(); 44 unsigned GetLength();
40 base::NullableString16 GetKey(unsigned index); 45 base::NullableString16 GetKey(unsigned index);
41 base::NullableString16 GetItem(const base::string16& key); 46 base::NullableString16 GetItem(const base::string16& key);
42 bool SetItem(const base::string16& key, 47 bool SetItem(const base::string16& key,
43 const base::string16& value, 48 const base::string16& value,
44 const GURL& page_url, 49 const GURL& page_url,
45 const std::string& storage_area_id); 50 const std::string& storage_area_id);
46 void RemoveItem(const base::string16& key, 51 void RemoveItem(const base::string16& key,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 void OnRemoveItemComplete(const base::string16& key, 83 void OnRemoveItemComplete(const base::string16& key,
79 leveldb::DatabaseError result); 84 leveldb::DatabaseError result);
80 void OnClearComplete(leveldb::DatabaseError result); 85 void OnClearComplete(leveldb::DatabaseError result);
81 86
82 // Resets the object back to its newly constructed state. 87 // Resets the object back to its newly constructed state.
83 void Reset(); 88 void Reset();
84 89
85 url::Origin origin_; 90 url::Origin origin_;
86 scoped_refptr<DOMStorageMap> map_; 91 scoped_refptr<DOMStorageMap> map_;
87 std::map<base::string16, int> ignore_key_mutations_; 92 std::map<base::string16, int> ignore_key_mutations_;
88 LevelDBWrapperPtr leveldb_; 93 mojom::LevelDBWrapperPtr leveldb_;
89 mojo::Binding<LevelDBObserver> binding_; 94 mojo::Binding<mojom::LevelDBObserver> binding_;
90 LocalStorageCachedAreas* cached_areas_; 95 LocalStorageCachedAreas* cached_areas_;
91 std::map<std::string, LocalStorageArea*> areas_; 96 std::map<std::string, LocalStorageArea*> areas_;
92 97
93 DISALLOW_COPY_AND_ASSIGN(LocalStorageCachedArea); 98 DISALLOW_COPY_AND_ASSIGN(LocalStorageCachedArea);
94 }; 99 };
95 100
96 } // namespace content 101 } // namespace content
97 102
98 #endif // CONTENT_RENDERER_DOM_STORAGE_LOCAL_STORAGE_CACHED_AREA_H_ 103 #endif // CONTENT_RENDERER_DOM_STORAGE_LOCAL_STORAGE_CACHED_AREA_H_
OLDNEW
« no previous file with comments | « content/public/test/test_mojo_service.mojom ('k') | content/renderer/dom_storage/local_storage_cached_area.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698