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 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "webkit/storage/webkit_storage_export.h" | 13 #include "webkit/storage/webkit_storage_export.h" |
14 | 14 |
15 class GURL; | 15 class GURL; |
16 | 16 |
17 namespace dom_storage { | 17 namespace dom_storage { |
18 | 18 |
19 class DomStorageArea; | 19 class DomStorageArea; |
20 class DomStorageTaskRunner; | 20 class DomStorageTaskRunner; |
21 class SessionStorageDatabase; | 21 class SessionStorageDatabase; |
22 | 22 |
23 // Container for the set of per-origin Areas. | 23 // Container for the set of per-origin Areas. |
24 // See class comments for DomStorageContext for a larger overview. | 24 // See class comments for DomStorageContext for a larger overview. |
25 class WEBKIT_STORAGE_EXPORT DomStorageNamespace | 25 class WEBKIT_STORAGE_EXPORT DomStorageNamespace |
26 : public base::RefCountedThreadSafe<DomStorageNamespace> { | 26 : public base::RefCountedThreadSafe<DomStorageNamespace> { |
27 public: | 27 public: |
28 // Constructor for a LocalStorage namespace with id of 0 | 28 // Constructor for a LocalStorage namespace with id of 0 |
29 // and an optional backing directory on disk. | 29 // and an optional backing directory on disk. |
30 DomStorageNamespace(const FilePath& directory, // may be empty | 30 DomStorageNamespace(const base::FilePath& directory, // may be empty |
31 DomStorageTaskRunner* task_runner); | 31 DomStorageTaskRunner* task_runner); |
32 | 32 |
33 // Constructor for a SessionStorage namespace with a non-zero id and an | 33 // Constructor for a SessionStorage namespace with a non-zero id and an |
34 // optional backing on disk via |session_storage_database| (may be NULL). | 34 // optional backing on disk via |session_storage_database| (may be NULL). |
35 DomStorageNamespace(int64 namespace_id, | 35 DomStorageNamespace(int64 namespace_id, |
36 const std::string& persistent_namespace_id, | 36 const std::string& persistent_namespace_id, |
37 SessionStorageDatabase* session_storage_database, | 37 SessionStorageDatabase* session_storage_database, |
38 DomStorageTaskRunner* task_runner); | 38 DomStorageTaskRunner* task_runner); |
39 | 39 |
40 int64 namespace_id() const { return namespace_id_; } | 40 int64 namespace_id() const { return namespace_id_; } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 }; | 76 }; |
77 typedef std::map<GURL, AreaHolder> AreaMap; | 77 typedef std::map<GURL, AreaHolder> AreaMap; |
78 | 78 |
79 ~DomStorageNamespace(); | 79 ~DomStorageNamespace(); |
80 | 80 |
81 // Returns a pointer to the area holder in our map or NULL. | 81 // Returns a pointer to the area holder in our map or NULL. |
82 AreaHolder* GetAreaHolder(const GURL& origin); | 82 AreaHolder* GetAreaHolder(const GURL& origin); |
83 | 83 |
84 int64 namespace_id_; | 84 int64 namespace_id_; |
85 std::string persistent_namespace_id_; | 85 std::string persistent_namespace_id_; |
86 FilePath directory_; | 86 base::FilePath directory_; |
87 AreaMap areas_; | 87 AreaMap areas_; |
88 scoped_refptr<DomStorageTaskRunner> task_runner_; | 88 scoped_refptr<DomStorageTaskRunner> task_runner_; |
89 scoped_refptr<SessionStorageDatabase> session_storage_database_; | 89 scoped_refptr<SessionStorageDatabase> session_storage_database_; |
90 }; | 90 }; |
91 | 91 |
92 } // namespace dom_storage | 92 } // namespace dom_storage |
93 | 93 |
94 | 94 |
95 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_NAMESPACE_H_ | 95 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_NAMESPACE_H_ |
OLD | NEW |