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

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

Issue 1837883003: Some fleshing out the mojo based localstorage implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 void AreaCreated(LocalStorageArea* area); 58 void AreaCreated(LocalStorageArea* area);
59 void AreaDestroyed(LocalStorageArea* area); 59 void AreaDestroyed(LocalStorageArea* area);
60 60
61 const url::Origin& origin() { return origin_; } 61 const url::Origin& origin() { return origin_; }
62 62
63 private: 63 private:
64 friend class base::RefCounted<LocalStorageCachedArea>; 64 friend class base::RefCounted<LocalStorageCachedArea>;
65 ~LocalStorageCachedArea() override; 65 ~LocalStorageCachedArea() override;
66 66
67 // LevelDBObserver: 67 // LevelDBObserver:
68 void KeyAdded(mojo::Array<uint8_t> key,
69 mojo::Array<uint8_t> value,
70 const mojo::String& source) override;
68 void KeyChanged(mojo::Array<uint8_t> key, 71 void KeyChanged(mojo::Array<uint8_t> key,
69 mojo::Array<uint8_t> new_value, 72 mojo::Array<uint8_t> new_value,
70 mojo::Array<uint8_t> old_value, 73 mojo::Array<uint8_t> old_value,
71 const mojo::String& source) override; 74 const mojo::String& source) override;
72 void KeyDeleted(mojo::Array<uint8_t> key, 75 void KeyDeleted(mojo::Array<uint8_t> key,
73 mojo::Array<uint8_t> old_value, 76 mojo::Array<uint8_t> old_value,
74 const mojo::String& source) override; 77 const mojo::String& source) override;
75 void AllDeleted(const mojo::String& source) override; 78 void AllDeleted(const mojo::String& source) override;
79 void GetAllComplete(const mojo::String& source) override;
80
81 // Common helper for KeyAdded() and KeyChanged()
82 void KeyAddedOrChanged(mojo::Array<uint8_t> key,
83 mojo::Array<uint8_t> new_value,
84 const base::NullableString16& old_value,
85 const mojo::String& source);
76 86
77 // Synchronously fetches the origin's local storage data if it hasn't been 87 // Synchronously fetches the origin's local storage data if it hasn't been
78 // fetched already. 88 // fetched already.
79 void EnsureLoaded(); 89 void EnsureLoaded();
80 90
81 void OnSetItemComplete(const base::string16& key, 91 void OnSetItemComplete(const base::string16& key, bool success);
82 leveldb::DatabaseError result); 92 void OnRemoveItemComplete(const base::string16& key, bool success);
83 void OnRemoveItemComplete(const base::string16& key, 93 void OnClearComplete(bool success);
84 leveldb::DatabaseError result);
85 void OnClearComplete(leveldb::DatabaseError result);
86 94
87 // Resets the object back to its newly constructed state. 95 // Resets the object back to its newly constructed state.
88 void Reset(); 96 void Reset();
89 97
90 url::Origin origin_; 98 url::Origin origin_;
91 scoped_refptr<DOMStorageMap> map_; 99 scoped_refptr<DOMStorageMap> map_;
92 std::map<base::string16, int> ignore_key_mutations_; 100 std::map<base::string16, int> ignore_key_mutations_;
101 bool ignore_all_mutations_ = false;
102 std::string get_all_request_id_;
93 mojom::LevelDBWrapperPtr leveldb_; 103 mojom::LevelDBWrapperPtr leveldb_;
94 mojo::Binding<mojom::LevelDBObserver> binding_; 104 mojo::Binding<mojom::LevelDBObserver> binding_;
95 LocalStorageCachedAreas* cached_areas_; 105 LocalStorageCachedAreas* cached_areas_;
96 std::map<std::string, LocalStorageArea*> areas_; 106 std::map<std::string, LocalStorageArea*> areas_;
107 base::WeakPtrFactory<LocalStorageCachedArea> weak_factory_;
97 108
98 DISALLOW_COPY_AND_ASSIGN(LocalStorageCachedArea); 109 DISALLOW_COPY_AND_ASSIGN(LocalStorageCachedArea);
99 }; 110 };
100 111
101 } // namespace content 112 } // namespace content
102 113
103 #endif // CONTENT_RENDERER_DOM_STORAGE_LOCAL_STORAGE_CACHED_AREA_H_ 114 #endif // CONTENT_RENDERER_DOM_STORAGE_LOCAL_STORAGE_CACHED_AREA_H_
OLDNEW
« no previous file with comments | « content/common/storage_partition_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