| OLD | NEW |
| 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 Loading... |
| 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, | 68 void KeyAdded(const std::vector<uint8_t>& key, |
| 69 mojo::Array<uint8_t> value, | 69 const std::vector<uint8_t>& value, |
| 70 const mojo::String& source) override; | 70 const std::string& source) override; |
| 71 void KeyChanged(mojo::Array<uint8_t> key, | 71 void KeyChanged(const std::vector<uint8_t>& key, |
| 72 mojo::Array<uint8_t> new_value, | 72 const std::vector<uint8_t>& new_value, |
| 73 mojo::Array<uint8_t> old_value, | 73 const std::vector<uint8_t>& old_value, |
| 74 const mojo::String& source) override; | 74 const std::string& source) override; |
| 75 void KeyDeleted(mojo::Array<uint8_t> key, | 75 void KeyDeleted(const std::vector<uint8_t>& key, |
| 76 mojo::Array<uint8_t> old_value, | 76 const std::vector<uint8_t>& old_value, |
| 77 const mojo::String& source) override; | 77 const std::string& source) override; |
| 78 void AllDeleted(const mojo::String& source) override; | 78 void AllDeleted(const std::string& source) override; |
| 79 void GetAllComplete(const mojo::String& source) override; | 79 void GetAllComplete(const std::string& source) override; |
| 80 | 80 |
| 81 // Common helper for KeyAdded() and KeyChanged() | 81 // Common helper for KeyAdded() and KeyChanged() |
| 82 void KeyAddedOrChanged(mojo::Array<uint8_t> key, | 82 void KeyAddedOrChanged(const std::vector<uint8_t>& key, |
| 83 mojo::Array<uint8_t> new_value, | 83 const std::vector<uint8_t>& new_value, |
| 84 const base::NullableString16& old_value, | 84 const base::NullableString16& old_value, |
| 85 const mojo::String& source); | 85 const std::string& source); |
| 86 | 86 |
| 87 // 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 |
| 88 // fetched already. | 88 // fetched already. |
| 89 void EnsureLoaded(); | 89 void EnsureLoaded(); |
| 90 | 90 |
| 91 void OnSetItemComplete(const base::string16& key, bool success); | 91 void OnSetItemComplete(const base::string16& key, bool success); |
| 92 void OnRemoveItemComplete(const base::string16& key, bool success); | 92 void OnRemoveItemComplete(const base::string16& key, bool success); |
| 93 void OnClearComplete(bool success); | 93 void OnClearComplete(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_; | 102 std::string get_all_request_id_; |
| 103 mojom::LevelDBWrapperPtr leveldb_; | 103 mojom::LevelDBWrapperPtr leveldb_; |
| 104 mojo::Binding<mojom::LevelDBObserver> binding_; | 104 mojo::Binding<mojom::LevelDBObserver> binding_; |
| 105 LocalStorageCachedAreas* cached_areas_; | 105 LocalStorageCachedAreas* cached_areas_; |
| 106 std::map<std::string, LocalStorageArea*> areas_; | 106 std::map<std::string, LocalStorageArea*> areas_; |
| 107 base::WeakPtrFactory<LocalStorageCachedArea> weak_factory_; | 107 base::WeakPtrFactory<LocalStorageCachedArea> weak_factory_; |
| 108 | 108 |
| 109 DISALLOW_COPY_AND_ASSIGN(LocalStorageCachedArea); | 109 DISALLOW_COPY_AND_ASSIGN(LocalStorageCachedArea); |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 } // namespace content | 112 } // namespace content |
| 113 | 113 |
| 114 #endif // CONTENT_RENDERER_DOM_STORAGE_LOCAL_STORAGE_CACHED_AREA_H_ | 114 #endif // CONTENT_RENDERER_DOM_STORAGE_LOCAL_STORAGE_CACHED_AREA_H_ |
| OLD | NEW |