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