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