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 17 matching lines...) Expand all Loading... |
28 namespace quota { | 28 namespace quota { |
29 class SpecialStoragePolicy; | 29 class SpecialStoragePolicy; |
30 } | 30 } |
31 | 31 |
32 namespace dom_storage { | 32 namespace dom_storage { |
33 | 33 |
34 class DomStorageArea; | 34 class DomStorageArea; |
35 class DomStorageNamespace; | 35 class DomStorageNamespace; |
36 class DomStorageSession; | 36 class DomStorageSession; |
37 class DomStorageTaskRunner; | 37 class DomStorageTaskRunner; |
| 38 class SessionStorageDatabase; |
38 | 39 |
39 // The Context is the root of an object containment hierachy for | 40 // The Context is the root of an object containment hierachy for |
40 // Namespaces and Areas related to the owning profile. | 41 // Namespaces and Areas related to the owning profile. |
41 // One instance is allocated in the main process for each profile, | 42 // One instance is allocated in the main process for each profile, |
42 // instance methods should be called serially in the background as | 43 // instance methods should be called serially in the background as |
43 // determined by the task_runner. Specifcally not on chrome's non-blocking | 44 // determined by the task_runner. Specifcally not on chrome's non-blocking |
44 // IO thread since these methods can result in blocking file io. | 45 // IO thread since these methods can result in blocking file io. |
45 // | 46 // |
46 // In general terms, the DomStorage object relationships are... | 47 // In general terms, the DomStorage object relationships are... |
47 // Contexts (per-profile) own Namespaces which own Areas which share Maps. | 48 // Contexts (per-profile) own Namespaces which own Areas which share Maps. |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 friend class DomStorageContextTest; | 163 friend class DomStorageContextTest; |
163 FRIEND_TEST_ALL_PREFIXES(DomStorageContextTest, Basics); | 164 FRIEND_TEST_ALL_PREFIXES(DomStorageContextTest, Basics); |
164 friend class base::RefCountedThreadSafe<DomStorageContext>; | 165 friend class base::RefCountedThreadSafe<DomStorageContext>; |
165 typedef std::map<int64, scoped_refptr<DomStorageNamespace> > | 166 typedef std::map<int64, scoped_refptr<DomStorageNamespace> > |
166 StorageNamespaceMap; | 167 StorageNamespaceMap; |
167 | 168 |
168 ~DomStorageContext(); | 169 ~DomStorageContext(); |
169 | 170 |
170 void ClearLocalStateInCommitSequence(); | 171 void ClearLocalStateInCommitSequence(); |
171 | 172 |
| 173 void DeleteSessionNamespaceInCommitSequence(int64 namespace_id); |
| 174 void DeleteLeftoverDataInCommitSequence(); |
| 175 |
172 // Collection of namespaces keyed by id. | 176 // Collection of namespaces keyed by id. |
173 StorageNamespaceMap namespaces_; | 177 StorageNamespaceMap namespaces_; |
174 | 178 |
175 // Where localstorage data is stored, maybe empty for the incognito use case. | 179 // Where localstorage data is stored, maybe empty for the incognito use case. |
176 FilePath localstorage_directory_; | 180 FilePath localstorage_directory_; |
177 | 181 |
178 // Where sessionstorage data is stored, maybe empty for the incognito use | 182 // Where sessionstorage data is stored, maybe empty for the incognito use |
179 // case. Always empty until the file-backed session storage feature is | 183 // case. Always empty until the file-backed session storage feature is |
180 // implemented. | 184 // implemented. |
181 FilePath sessionstorage_directory_; | 185 FilePath sessionstorage_directory_; |
182 | 186 |
183 // Used to schedule sequenced background tasks. | 187 // Used to schedule sequenced background tasks. |
184 scoped_refptr<DomStorageTaskRunner> task_runner_; | 188 scoped_refptr<DomStorageTaskRunner> task_runner_; |
185 | 189 |
186 // List of objects observing local storage events. | 190 // List of objects observing local storage events. |
187 ObserverList<EventObserver> event_observers_; | 191 ObserverList<EventObserver> event_observers_; |
188 | 192 |
189 // We use a 32 bit identifier for per tab storage sessions. | 193 // We use a 32 bit identifier for per tab storage sessions. |
190 // At a tab per second, this range is large enough for 68 years. | 194 // At a tab per second, this range is large enough for 68 years. |
191 base::AtomicSequenceNumber session_id_sequence_; | 195 base::AtomicSequenceNumber session_id_sequence_; |
192 | 196 |
193 bool is_shutdown_; | 197 bool is_shutdown_; |
194 bool clear_local_state_; | 198 bool clear_local_state_; |
195 bool save_session_state_; | 199 bool save_session_state_; |
196 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; | 200 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; |
| 201 scoped_refptr<SessionStorageDatabase> session_storage_database_; |
197 }; | 202 }; |
198 | 203 |
199 } // namespace dom_storage | 204 } // namespace dom_storage |
200 | 205 |
201 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_CONTEXT_H_ | 206 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_CONTEXT_H_ |
OLD | NEW |