| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 WEBKIT_DOM_STORAGE_DOM_STORAGE_CONTEXT_H_ | 5 #ifndef WEBKIT_DOM_STORAGE_DOM_STORAGE_CONTEXT_H_ |
| 6 #define WEBKIT_DOM_STORAGE_DOM_STORAGE_CONTEXT_H_ | 6 #define WEBKIT_DOM_STORAGE_DOM_STORAGE_CONTEXT_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 const DomStorageArea* area, | 81 const DomStorageArea* area, |
| 82 const string16& key, | 82 const string16& key, |
| 83 const string16& old_value, | 83 const string16& old_value, |
| 84 const GURL& page_url) = 0; | 84 const GURL& page_url) = 0; |
| 85 virtual void OnDomStorageAreaCleared( | 85 virtual void OnDomStorageAreaCleared( |
| 86 const DomStorageArea* area, | 86 const DomStorageArea* area, |
| 87 const GURL& page_url) = 0; | 87 const GURL& page_url) = 0; |
| 88 virtual ~EventObserver() {} | 88 virtual ~EventObserver() {} |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 DomStorageContext(const FilePath& directory, // empty for incognito profiles | 91 DomStorageContext( |
| 92 quota::SpecialStoragePolicy* special_storage_policy, | 92 const FilePath& localstorage_directory, // empty for incognito profiles |
| 93 DomStorageTaskRunner* task_runner); | 93 const FilePath& sessionstorage_directory, // empty for incognito profiles |
| 94 const FilePath& directory() const { return directory_; } | 94 quota::SpecialStoragePolicy* special_storage_policy, |
| 95 DomStorageTaskRunner* task_runner); |
| 96 |
| 97 // Returns the directory path for localStorage, or an empty directory, if |
| 98 // there is no backing on disk. |
| 99 const FilePath& localstorage_directory() { return localstorage_directory_; } |
| 100 |
| 101 // Returns the directory path for sessionStorage, or an empty directory, if |
| 102 // there is no backing on disk. |
| 103 const FilePath& sessionstorage_directory() { |
| 104 return sessionstorage_directory_; |
| 105 } |
| 106 |
| 95 DomStorageTaskRunner* task_runner() const { return task_runner_; } | 107 DomStorageTaskRunner* task_runner() const { return task_runner_; } |
| 96 DomStorageNamespace* GetStorageNamespace(int64 namespace_id); | 108 DomStorageNamespace* GetStorageNamespace(int64 namespace_id); |
| 97 | 109 |
| 98 void GetUsageInfo(std::vector<UsageInfo>* infos, bool include_file_info); | 110 void GetUsageInfo(std::vector<UsageInfo>* infos, bool include_file_info); |
| 99 void DeleteOrigin(const GURL& origin); | 111 void DeleteOrigin(const GURL& origin); |
| 100 void DeleteDataModifiedSince(const base::Time& cutoff); | 112 void DeleteDataModifiedSince(const base::Time& cutoff); |
| 101 void PurgeMemory(); | 113 void PurgeMemory(); |
| 102 | 114 |
| 103 // Used by content settings to alter the behavior around | 115 // Used by content settings to alter the behavior around |
| 104 // what data to keep and what data to discard at shutdown. | 116 // what data to keep and what data to discard at shutdown. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 StorageNamespaceMap; | 166 StorageNamespaceMap; |
| 155 | 167 |
| 156 ~DomStorageContext(); | 168 ~DomStorageContext(); |
| 157 | 169 |
| 158 void ClearLocalStateInCommitSequence(); | 170 void ClearLocalStateInCommitSequence(); |
| 159 | 171 |
| 160 // Collection of namespaces keyed by id. | 172 // Collection of namespaces keyed by id. |
| 161 StorageNamespaceMap namespaces_; | 173 StorageNamespaceMap namespaces_; |
| 162 | 174 |
| 163 // Where localstorage data is stored, maybe empty for the incognito use case. | 175 // Where localstorage data is stored, maybe empty for the incognito use case. |
| 164 FilePath directory_; | 176 FilePath localstorage_directory_; |
| 177 |
| 178 // Where sessionstorage data is stored, maybe empty for the incognito use |
| 179 // case. Always empty until the file-backed session storage feature is |
| 180 // implemented. |
| 181 FilePath sessionstorage_directory_; |
| 165 | 182 |
| 166 // Used to schedule sequenced background tasks. | 183 // Used to schedule sequenced background tasks. |
| 167 scoped_refptr<DomStorageTaskRunner> task_runner_; | 184 scoped_refptr<DomStorageTaskRunner> task_runner_; |
| 168 | 185 |
| 169 // List of objects observing local storage events. | 186 // List of objects observing local storage events. |
| 170 ObserverList<EventObserver> event_observers_; | 187 ObserverList<EventObserver> event_observers_; |
| 171 | 188 |
| 172 // We use a 32 bit identifier for per tab storage sessions. | 189 // We use a 32 bit identifier for per tab storage sessions. |
| 173 // At a tab per second, this range is large enough for 68 years. | 190 // At a tab per second, this range is large enough for 68 years. |
| 174 base::AtomicSequenceNumber session_id_sequence_; | 191 base::AtomicSequenceNumber session_id_sequence_; |
| 175 | 192 |
| 176 bool is_shutdown_; | 193 bool is_shutdown_; |
| 177 bool clear_local_state_; | 194 bool clear_local_state_; |
| 178 bool save_session_state_; | 195 bool save_session_state_; |
| 179 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; | 196 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; |
| 180 }; | 197 }; |
| 181 | 198 |
| 182 } // namespace dom_storage | 199 } // namespace dom_storage |
| 183 | 200 |
| 184 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_CONTEXT_H_ | 201 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_CONTEXT_H_ |
| OLD | NEW |