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

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

Issue 2593503005: Don't abuse LevelDBObserver interface to pass GetAll result. (Closed)
Patch Set: modify sanity_check test to give async callbacks a chance to cause problems Created 3 years, 12 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 const std::vector<uint8_t>& value, 69 const std::vector<uint8_t>& value,
70 const std::string& source) override; 70 const std::string& source) override;
71 void KeyChanged(const std::vector<uint8_t>& key, 71 void KeyChanged(const std::vector<uint8_t>& key,
72 const std::vector<uint8_t>& new_value, 72 const std::vector<uint8_t>& new_value,
73 const std::vector<uint8_t>& old_value, 73 const std::vector<uint8_t>& old_value,
74 const std::string& source) override; 74 const std::string& source) override;
75 void KeyDeleted(const std::vector<uint8_t>& key, 75 void KeyDeleted(const std::vector<uint8_t>& key,
76 const std::vector<uint8_t>& old_value, 76 const std::vector<uint8_t>& old_value,
77 const std::string& source) override; 77 const std::string& source) override;
78 void AllDeleted(const std::string& source) override; 78 void AllDeleted(const std::string& source) override;
79 void GetAllComplete(const std::string& source) override;
80 79
81 // Common helper for KeyAdded() and KeyChanged() 80 // Common helper for KeyAdded() and KeyChanged()
82 void KeyAddedOrChanged(const std::vector<uint8_t>& key, 81 void KeyAddedOrChanged(const std::vector<uint8_t>& key,
83 const std::vector<uint8_t>& new_value, 82 const std::vector<uint8_t>& new_value,
84 const base::NullableString16& old_value, 83 const base::NullableString16& old_value,
85 const std::string& source); 84 const std::string& source);
86 85
87 // Synchronously fetches the origin's local storage data if it hasn't been 86 // Synchronously fetches the origin's local storage data if it hasn't been
88 // fetched already. 87 // fetched already.
89 void EnsureLoaded(); 88 void EnsureLoaded();
90 89
91 void OnSetItemComplete(const base::string16& key, bool success); 90 void OnSetItemComplete(const base::string16& key, bool success);
92 void OnRemoveItemComplete(const base::string16& key, bool success); 91 void OnRemoveItemComplete(const base::string16& key, bool success);
93 void OnClearComplete(bool success); 92 void OnClearComplete(bool success);
93 void OnGetAllComplete(bool success);
94 94
95 // Resets the object back to its newly constructed state. 95 // Resets the object back to its newly constructed state.
96 void Reset(); 96 void Reset();
97 97
98 url::Origin origin_; 98 url::Origin origin_;
99 scoped_refptr<DOMStorageMap> map_; 99 scoped_refptr<DOMStorageMap> map_;
100 std::map<base::string16, int> ignore_key_mutations_; 100 std::map<base::string16, int> ignore_key_mutations_;
101 bool ignore_all_mutations_ = false; 101 bool ignore_all_mutations_ = false;
102 std::string get_all_request_id_;
103 mojom::LevelDBWrapperPtr leveldb_; 102 mojom::LevelDBWrapperPtr leveldb_;
104 mojo::AssociatedBinding<mojom::LevelDBObserver> binding_; 103 mojo::AssociatedBinding<mojom::LevelDBObserver> binding_;
105 LocalStorageCachedAreas* cached_areas_; 104 LocalStorageCachedAreas* cached_areas_;
106 std::map<std::string, LocalStorageArea*> areas_; 105 std::map<std::string, LocalStorageArea*> areas_;
107 base::WeakPtrFactory<LocalStorageCachedArea> weak_factory_; 106 base::WeakPtrFactory<LocalStorageCachedArea> weak_factory_;
108 107
109 DISALLOW_COPY_AND_ASSIGN(LocalStorageCachedArea); 108 DISALLOW_COPY_AND_ASSIGN(LocalStorageCachedArea);
110 }; 109 };
111 110
112 } // namespace content 111 } // namespace content
113 112
114 #endif // CONTENT_RENDERER_DOM_STORAGE_LOCAL_STORAGE_CACHED_AREA_H_ 113 #endif // CONTENT_RENDERER_DOM_STORAGE_LOCAL_STORAGE_CACHED_AREA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698