| 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 | 13 |
| 14 class GURL; | 14 class GURL; |
| 15 | 15 |
| 16 namespace dom_storage { | 16 namespace dom_storage { |
| 17 | 17 |
| 18 class DomStorageArea; | 18 class DomStorageArea; |
| 19 class DomStorageTaskRunner; | 19 class DomStorageTaskRunner; |
| 20 class SessionStorageDatabase; |
| 20 | 21 |
| 21 // Container for the set of per-origin Areas. | 22 // Container for the set of per-origin Areas. |
| 22 // See class comments for DomStorageContext for a larger overview. | 23 // See class comments for DomStorageContext for a larger overview. |
| 23 class DomStorageNamespace | 24 class DomStorageNamespace |
| 24 : public base::RefCountedThreadSafe<DomStorageNamespace> { | 25 : public base::RefCountedThreadSafe<DomStorageNamespace> { |
| 25 public: | 26 public: |
| 26 // Constructor for a LocalStorage namespace with id of 0 | 27 // Constructor for a LocalStorage namespace with id of 0 |
| 27 // and an optional backing directory on disk. | 28 // and an optional backing directory on disk. |
| 28 DomStorageNamespace(const FilePath& directory, // may be empty | 29 DomStorageNamespace(const FilePath& directory, // may be empty |
| 29 DomStorageTaskRunner* task_runner); | 30 DomStorageTaskRunner* task_runner); |
| 30 | 31 |
| 31 // Constructor for a SessionStorage namespace with a non-zero id | 32 // Constructor for a SessionStorage namespace with a non-zero id and an |
| 32 // and no backing directory on disk. | 33 // optional backing on disk via |session_storage_database| (may be NULL). |
| 33 DomStorageNamespace(int64 namespace_id, | 34 DomStorageNamespace(int64 namespace_id, |
| 34 const std::string& persistent_namespace_id, | 35 const std::string& persistent_namespace_id, |
| 36 SessionStorageDatabase* session_storage_database, |
| 35 DomStorageTaskRunner* task_runner); | 37 DomStorageTaskRunner* task_runner); |
| 36 | 38 |
| 37 int64 namespace_id() const { return namespace_id_; } | 39 int64 namespace_id() const { return namespace_id_; } |
| 38 const std::string& persistent_namespace_id() const { | 40 const std::string& persistent_namespace_id() const { |
| 39 return persistent_namespace_id_; | 41 return persistent_namespace_id_; |
| 40 } | 42 } |
| 41 | 43 |
| 42 // Returns the storage area for the given origin, | 44 // Returns the storage area for the given origin, |
| 43 // creating instance if needed. Each call to open | 45 // creating instance if needed. Each call to open |
| 44 // must be balanced with a call to CloseStorageArea. | 46 // must be balanced with a call to CloseStorageArea. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 72 ~DomStorageNamespace(); | 74 ~DomStorageNamespace(); |
| 73 | 75 |
| 74 // Returns a pointer to the area holder in our map or NULL. | 76 // Returns a pointer to the area holder in our map or NULL. |
| 75 AreaHolder* GetAreaHolder(const GURL& origin); | 77 AreaHolder* GetAreaHolder(const GURL& origin); |
| 76 | 78 |
| 77 int64 namespace_id_; | 79 int64 namespace_id_; |
| 78 std::string persistent_namespace_id_; | 80 std::string persistent_namespace_id_; |
| 79 FilePath directory_; | 81 FilePath directory_; |
| 80 AreaMap areas_; | 82 AreaMap areas_; |
| 81 scoped_refptr<DomStorageTaskRunner> task_runner_; | 83 scoped_refptr<DomStorageTaskRunner> task_runner_; |
| 84 scoped_refptr<SessionStorageDatabase> session_storage_database_; |
| 82 }; | 85 }; |
| 83 | 86 |
| 84 } // namespace dom_storage | 87 } // namespace dom_storage |
| 85 | 88 |
| 86 | 89 |
| 87 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_NAMESPACE_H_ | 90 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_NAMESPACE_H_ |
| OLD | NEW |