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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 virtual ~EventObserver() {} | 88 virtual ~EventObserver() {} |
89 }; | 89 }; |
90 | 90 |
91 DomStorageContext(const FilePath& directory, // empty for incognito profiles | 91 DomStorageContext(const FilePath& directory, // empty for incognito profiles |
92 quota::SpecialStoragePolicy* special_storage_policy, | 92 quota::SpecialStoragePolicy* special_storage_policy, |
93 DomStorageTaskRunner* task_runner); | 93 DomStorageTaskRunner* task_runner); |
94 const FilePath& directory() const { return directory_; } | 94 const FilePath& directory() const { return directory_; } |
95 DomStorageTaskRunner* task_runner() const { return task_runner_; } | 95 DomStorageTaskRunner* task_runner() const { return task_runner_; } |
96 DomStorageNamespace* GetStorageNamespace(int64 namespace_id); | 96 DomStorageNamespace* GetStorageNamespace(int64 namespace_id); |
97 | 97 |
| 98 // Returns the directory path for localStorage, or an empty directory, if |
| 99 // there is no backing on disk. |
| 100 FilePath GetLocalStorageDirectory(); |
| 101 |
98 void GetUsageInfo(std::vector<UsageInfo>* infos, bool include_file_info); | 102 void GetUsageInfo(std::vector<UsageInfo>* infos, bool include_file_info); |
99 void DeleteOrigin(const GURL& origin); | 103 void DeleteOrigin(const GURL& origin); |
100 void DeleteDataModifiedSince(const base::Time& cutoff); | 104 void DeleteDataModifiedSince(const base::Time& cutoff); |
101 void PurgeMemory(); | 105 void PurgeMemory(); |
102 | 106 |
103 // Used by content settings to alter the behavior around | 107 // Used by content settings to alter the behavior around |
104 // what data to keep and what data to discard at shutdown. | 108 // what data to keep and what data to discard at shutdown. |
105 // The policy is not so straight forward to describe, see | 109 // The policy is not so straight forward to describe, see |
106 // the implementation for details. | 110 // the implementation for details. |
107 void SetClearLocalState(bool clear_local_state) { | 111 void SetClearLocalState(bool clear_local_state) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 typedef std::map<int64, scoped_refptr<DomStorageNamespace> > | 157 typedef std::map<int64, scoped_refptr<DomStorageNamespace> > |
154 StorageNamespaceMap; | 158 StorageNamespaceMap; |
155 | 159 |
156 ~DomStorageContext(); | 160 ~DomStorageContext(); |
157 | 161 |
158 void ClearLocalStateInCommitSequence(); | 162 void ClearLocalStateInCommitSequence(); |
159 | 163 |
160 // Collection of namespaces keyed by id. | 164 // Collection of namespaces keyed by id. |
161 StorageNamespaceMap namespaces_; | 165 StorageNamespaceMap namespaces_; |
162 | 166 |
163 // Where localstorage data is stored, maybe empty for the incognito use case. | 167 // Where data is stored, maybe empty for the incognito use case. |
164 FilePath directory_; | 168 FilePath directory_; |
165 | 169 |
166 // Used to schedule sequenced background tasks. | 170 // Used to schedule sequenced background tasks. |
167 scoped_refptr<DomStorageTaskRunner> task_runner_; | 171 scoped_refptr<DomStorageTaskRunner> task_runner_; |
168 | 172 |
169 // List of objects observing local storage events. | 173 // List of objects observing local storage events. |
170 ObserverList<EventObserver> event_observers_; | 174 ObserverList<EventObserver> event_observers_; |
171 | 175 |
172 // We use a 32 bit identifier for per tab storage sessions. | 176 // 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. | 177 // At a tab per second, this range is large enough for 68 years. |
174 base::AtomicSequenceNumber session_id_sequence_; | 178 base::AtomicSequenceNumber session_id_sequence_; |
175 | 179 |
176 bool is_shutdown_; | 180 bool is_shutdown_; |
177 bool clear_local_state_; | 181 bool clear_local_state_; |
178 bool save_session_state_; | 182 bool save_session_state_; |
179 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; | 183 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; |
180 }; | 184 }; |
181 | 185 |
182 } // namespace dom_storage | 186 } // namespace dom_storage |
183 | 187 |
184 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_CONTEXT_H_ | 188 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_CONTEXT_H_ |
OLD | NEW |