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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 109 |
110 void GetUsageInfo(std::vector<UsageInfo>* infos, bool include_file_info); | 110 void GetUsageInfo(std::vector<UsageInfo>* infos, bool include_file_info); |
111 void DeleteOrigin(const GURL& origin); | 111 void DeleteOrigin(const GURL& origin); |
112 void DeleteDataModifiedSince(const base::Time& cutoff); | 112 void DeleteDataModifiedSince(const base::Time& cutoff); |
113 void PurgeMemory(); | 113 void PurgeMemory(); |
114 | 114 |
115 // Used by content settings to alter the behavior around | 115 // Used by content settings to alter the behavior around |
116 // what data to keep and what data to discard at shutdown. | 116 // what data to keep and what data to discard at shutdown. |
117 // The policy is not so straight forward to describe, see | 117 // The policy is not so straight forward to describe, see |
118 // the implementation for details. | 118 // the implementation for details. |
119 void SetClearLocalState(bool clear_local_state) { | 119 void SetForceKeepSessionState() { |
120 clear_local_state_ = clear_local_state; | 120 force_keep_session_state_ = true; |
121 } | |
122 void SaveSessionState() { | |
123 save_session_state_ = true; | |
124 } | 121 } |
125 | 122 |
126 // Called when the owning BrowserContext is ending. | 123 // Called when the owning BrowserContext is ending. |
127 // Schedules the commit of any unsaved changes and will delete | 124 // Schedules the commit of any unsaved changes and will delete |
128 // and keep data on disk per the content settings and special storage | 125 // and keep data on disk per the content settings and special storage |
129 // policies. Contained areas and namespaces will stop functioning after | 126 // policies. Contained areas and namespaces will stop functioning after |
130 // this method has been called. | 127 // this method has been called. |
131 void Shutdown(); | 128 void Shutdown(); |
132 | 129 |
133 // Methods to add, remove, and notify EventObservers. | 130 // Methods to add, remove, and notify EventObservers. |
(...skipping 26 matching lines...) Expand all Loading... |
160 | 157 |
161 private: | 158 private: |
162 friend class DomStorageContextTest; | 159 friend class DomStorageContextTest; |
163 FRIEND_TEST_ALL_PREFIXES(DomStorageContextTest, Basics); | 160 FRIEND_TEST_ALL_PREFIXES(DomStorageContextTest, Basics); |
164 friend class base::RefCountedThreadSafe<DomStorageContext>; | 161 friend class base::RefCountedThreadSafe<DomStorageContext>; |
165 typedef std::map<int64, scoped_refptr<DomStorageNamespace> > | 162 typedef std::map<int64, scoped_refptr<DomStorageNamespace> > |
166 StorageNamespaceMap; | 163 StorageNamespaceMap; |
167 | 164 |
168 ~DomStorageContext(); | 165 ~DomStorageContext(); |
169 | 166 |
170 void ClearLocalStateInCommitSequence(); | 167 void ClearSessionOnlyOrigins(); |
171 | 168 |
172 // Collection of namespaces keyed by id. | 169 // Collection of namespaces keyed by id. |
173 StorageNamespaceMap namespaces_; | 170 StorageNamespaceMap namespaces_; |
174 | 171 |
175 // Where localstorage data is stored, maybe empty for the incognito use case. | 172 // Where localstorage data is stored, maybe empty for the incognito use case. |
176 FilePath localstorage_directory_; | 173 FilePath localstorage_directory_; |
177 | 174 |
178 // Where sessionstorage data is stored, maybe empty for the incognito use | 175 // Where sessionstorage data is stored, maybe empty for the incognito use |
179 // case. Always empty until the file-backed session storage feature is | 176 // case. Always empty until the file-backed session storage feature is |
180 // implemented. | 177 // implemented. |
181 FilePath sessionstorage_directory_; | 178 FilePath sessionstorage_directory_; |
182 | 179 |
183 // Used to schedule sequenced background tasks. | 180 // Used to schedule sequenced background tasks. |
184 scoped_refptr<DomStorageTaskRunner> task_runner_; | 181 scoped_refptr<DomStorageTaskRunner> task_runner_; |
185 | 182 |
186 // List of objects observing local storage events. | 183 // List of objects observing local storage events. |
187 ObserverList<EventObserver> event_observers_; | 184 ObserverList<EventObserver> event_observers_; |
188 | 185 |
189 // We use a 32 bit identifier for per tab storage sessions. | 186 // 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. | 187 // At a tab per second, this range is large enough for 68 years. |
191 base::AtomicSequenceNumber session_id_sequence_; | 188 base::AtomicSequenceNumber session_id_sequence_; |
192 | 189 |
193 bool is_shutdown_; | 190 bool is_shutdown_; |
194 bool clear_local_state_; | 191 bool force_keep_session_state_; |
195 bool save_session_state_; | |
196 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; | 192 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; |
197 }; | 193 }; |
198 | 194 |
199 } // namespace dom_storage | 195 } // namespace dom_storage |
200 | 196 |
201 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_CONTEXT_H_ | 197 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_CONTEXT_H_ |
OLD | NEW |