| 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 | 10 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 const GURL& page_url); | 93 const GURL& page_url); |
| 94 void NotifyItemRemoved( | 94 void NotifyItemRemoved( |
| 95 const DomStorageArea* area, | 95 const DomStorageArea* area, |
| 96 const string16& key, | 96 const string16& key, |
| 97 const string16& old_value, | 97 const string16& old_value, |
| 98 const GURL& page_url); | 98 const GURL& page_url); |
| 99 void NotifyAreaCleared( | 99 void NotifyAreaCleared( |
| 100 const DomStorageArea* area, | 100 const DomStorageArea* area, |
| 101 const GURL& page_url); | 101 const GURL& page_url); |
| 102 | 102 |
| 103 private: | |
| 104 friend class DomStorageSession; | |
| 105 friend class base::RefCountedThreadSafe<DomStorageContext>; | |
| 106 typedef std::map<int64, scoped_refptr<DomStorageNamespace> > | |
| 107 StorageNamespaceMap; | |
| 108 | |
| 109 ~DomStorageContext(); | |
| 110 | |
| 111 // May be called on any thread. | 103 // May be called on any thread. |
| 112 int64 AllocateSessionId() { | 104 int64 AllocateSessionId() { |
| 113 return session_id_sequence_.GetNext(); | 105 return session_id_sequence_.GetNext(); |
| 114 } | 106 } |
| 115 | 107 |
| 116 // Must be called on the background thread. | 108 // Must be called on the background thread. |
| 117 void CreateSessionNamespace(int64 namespace_id); | 109 void CreateSessionNamespace(int64 namespace_id); |
| 118 void DeleteSessionNamespace(int64 namespace_id); | 110 void DeleteSessionNamespace(int64 namespace_id); |
| 119 void CloneSessionNamespace(int64 existing_id, int64 new_id); | 111 void CloneSessionNamespace(int64 existing_id, int64 new_id); |
| 120 | 112 |
| 113 private: |
| 114 friend class base::RefCountedThreadSafe<DomStorageContext>; |
| 115 typedef std::map<int64, scoped_refptr<DomStorageNamespace> > |
| 116 StorageNamespaceMap; |
| 117 |
| 118 ~DomStorageContext(); |
| 119 |
| 121 // Collection of namespaces keyed by id. | 120 // Collection of namespaces keyed by id. |
| 122 StorageNamespaceMap namespaces_; | 121 StorageNamespaceMap namespaces_; |
| 123 | 122 |
| 124 // Where localstorage data is stored, maybe empty for the incognito use case. | 123 // Where localstorage data is stored, maybe empty for the incognito use case. |
| 125 FilePath directory_; | 124 FilePath directory_; |
| 126 | 125 |
| 127 // Used to schedule sequenced background tasks. | 126 // Used to schedule sequenced background tasks. |
| 128 scoped_refptr<DomStorageTaskRunner> task_runner_; | 127 scoped_refptr<DomStorageTaskRunner> task_runner_; |
| 129 | 128 |
| 130 // List of objects observing local storage events. | 129 // List of objects observing local storage events. |
| 131 ObserverList<EventObserver> event_observers_; | 130 ObserverList<EventObserver> event_observers_; |
| 132 | 131 |
| 133 // We use a 32 bit identifier for per tab storage sessions. | 132 // We use a 32 bit identifier for per tab storage sessions. |
| 134 // At a tab per second, this range is large enough for 68 years. | 133 // At a tab per second, this range is large enough for 68 years. |
| 135 base::AtomicSequenceNumber session_id_sequence_; | 134 base::AtomicSequenceNumber session_id_sequence_; |
| 136 }; | 135 }; |
| 137 | 136 |
| 138 } // namespace dom_storage | 137 } // namespace dom_storage |
| 139 | 138 |
| 140 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_CONTEXT_H_ | 139 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_CONTEXT_H_ |
| OLD | NEW |