| 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_NAMESPACE_H_ | 5 #ifndef WEBKIT_DOM_STORAGE_DOM_STORAGE_NAMESPACE_H_ |
| 6 #define WEBKIT_DOM_STORAGE_DOM_STORAGE_NAMESPACE_H_ | 6 #define WEBKIT_DOM_STORAGE_DOM_STORAGE_NAMESPACE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 // creating instance if needed. Each call to open | 40 // creating instance if needed. Each call to open |
| 41 // must be balanced with a call to CloseStorageArea. | 41 // must be balanced with a call to CloseStorageArea. |
| 42 DomStorageArea* OpenStorageArea(const GURL& origin); | 42 DomStorageArea* OpenStorageArea(const GURL& origin); |
| 43 void CloseStorageArea(DomStorageArea* area); | 43 void CloseStorageArea(DomStorageArea* area); |
| 44 | 44 |
| 45 // Creates a clone of |this| namespace including | 45 // Creates a clone of |this| namespace including |
| 46 // shallow copies of all contained areas. | 46 // shallow copies of all contained areas. |
| 47 // Should only be called for session storage namespaces. | 47 // Should only be called for session storage namespaces. |
| 48 DomStorageNamespace* Clone(int64 clone_namespace_id); | 48 DomStorageNamespace* Clone(int64 clone_namespace_id); |
| 49 | 49 |
| 50 void PurgeMemory(); |
| 51 void Shutdown(); |
| 52 |
| 50 private: | 53 private: |
| 51 friend class base::RefCountedThreadSafe<DomStorageNamespace>; | 54 friend class base::RefCountedThreadSafe<DomStorageNamespace>; |
| 52 | 55 |
| 53 // Struct to hold references to our contained areas and | 56 // Struct to hold references to our contained areas and |
| 54 // to keep track of how many tabs have a given area open. | 57 // to keep track of how many tabs have a given area open. |
| 55 struct AreaHolder { | 58 struct AreaHolder { |
| 56 scoped_refptr<DomStorageArea> area_; | 59 scoped_refptr<DomStorageArea> area_; |
| 57 int open_count_; | 60 int open_count_; |
| 58 AreaHolder(); | 61 AreaHolder(); |
| 59 AreaHolder(DomStorageArea* area, int count); | 62 AreaHolder(DomStorageArea* area, int count); |
| 60 ~AreaHolder(); | 63 ~AreaHolder(); |
| 61 }; | 64 }; |
| 62 typedef std::map<GURL, AreaHolder> AreaMap; | 65 typedef std::map<GURL, AreaHolder> AreaMap; |
| 63 | 66 |
| 64 ~DomStorageNamespace(); | 67 ~DomStorageNamespace(); |
| 65 | 68 |
| 66 // Returns a pointer to the area holder in our map or NULL. | 69 // Returns a pointer to the area holder in our map or NULL. |
| 67 AreaHolder* GetAreaHolder(const GURL& origin); | 70 AreaHolder* GetAreaHolder(const GURL& origin); |
| 68 | 71 |
| 69 int64 namespace_id_; | 72 int64 namespace_id_; |
| 70 FilePath directory_; | 73 FilePath directory_; |
| 71 AreaMap areas_; | 74 AreaMap areas_; |
| 72 scoped_refptr<DomStorageTaskRunner> task_runner_; | 75 scoped_refptr<DomStorageTaskRunner> task_runner_; |
| 73 }; | 76 }; |
| 74 | 77 |
| 75 } // namespace dom_storage | 78 } // namespace dom_storage |
| 76 | 79 |
| 77 | 80 |
| 78 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_NAMESPACE_H_ | 81 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_NAMESPACE_H_ |
| OLD | NEW |