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 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 FilePath sessionstorage_directory() { return sessionstorage_directory_; } | |
michaeln
2012/04/12 18:35:38
can these be const FilePath& return values instead
marja
2012/04/13 07:56:10
Afaics yes. Done.
| |
104 | |
95 DomStorageTaskRunner* task_runner() const { return task_runner_; } | 105 DomStorageTaskRunner* task_runner() const { return task_runner_; } |
96 DomStorageNamespace* GetStorageNamespace(int64 namespace_id); | 106 DomStorageNamespace* GetStorageNamespace(int64 namespace_id); |
97 | 107 |
98 void GetUsageInfo(std::vector<UsageInfo>* infos, bool include_file_info); | 108 void GetUsageInfo(std::vector<UsageInfo>* infos, bool include_file_info); |
99 void DeleteOrigin(const GURL& origin); | 109 void DeleteOrigin(const GURL& origin); |
100 void DeleteDataModifiedSince(const base::Time& cutoff); | 110 void DeleteDataModifiedSince(const base::Time& cutoff); |
101 void PurgeMemory(); | 111 void PurgeMemory(); |
102 | 112 |
103 // Used by content settings to alter the behavior around | 113 // Used by content settings to alter the behavior around |
104 // what data to keep and what data to discard at shutdown. | 114 // 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; | 164 StorageNamespaceMap; |
155 | 165 |
156 ~DomStorageContext(); | 166 ~DomStorageContext(); |
157 | 167 |
158 void ClearLocalStateInCommitSequence(); | 168 void ClearLocalStateInCommitSequence(); |
159 | 169 |
160 // Collection of namespaces keyed by id. | 170 // Collection of namespaces keyed by id. |
161 StorageNamespaceMap namespaces_; | 171 StorageNamespaceMap namespaces_; |
162 | 172 |
163 // Where localstorage data is stored, maybe empty for the incognito use case. | 173 // Where localstorage data is stored, maybe empty for the incognito use case. |
164 FilePath directory_; | 174 FilePath localstorage_directory_; |
175 | |
176 // Where sessionstorage data is stored, maybe empty for the incognito use | |
177 // case. Always empty until the file-backed session storage feature is | |
178 // implemented. | |
179 FilePath sessionstorage_directory_; | |
165 | 180 |
166 // Used to schedule sequenced background tasks. | 181 // Used to schedule sequenced background tasks. |
167 scoped_refptr<DomStorageTaskRunner> task_runner_; | 182 scoped_refptr<DomStorageTaskRunner> task_runner_; |
168 | 183 |
169 // List of objects observing local storage events. | 184 // List of objects observing local storage events. |
170 ObserverList<EventObserver> event_observers_; | 185 ObserverList<EventObserver> event_observers_; |
171 | 186 |
172 // We use a 32 bit identifier for per tab storage sessions. | 187 // 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. | 188 // At a tab per second, this range is large enough for 68 years. |
174 base::AtomicSequenceNumber session_id_sequence_; | 189 base::AtomicSequenceNumber session_id_sequence_; |
175 | 190 |
176 bool is_shutdown_; | 191 bool is_shutdown_; |
177 bool clear_local_state_; | 192 bool clear_local_state_; |
178 bool save_session_state_; | 193 bool save_session_state_; |
179 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; | 194 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; |
180 }; | 195 }; |
181 | 196 |
182 } // namespace dom_storage | 197 } // namespace dom_storage |
183 | 198 |
184 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_CONTEXT_H_ | 199 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_CONTEXT_H_ |
OLD | NEW |