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_AREA_H_ | 5 #ifndef WEBKIT_DOM_STORAGE_DOM_STORAGE_AREA_H_ |
6 #define WEBKIT_DOM_STORAGE_DOM_STORAGE_AREA_H_ | 6 #define WEBKIT_DOM_STORAGE_DOM_STORAGE_AREA_H_ |
7 | 7 |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 class DomStorageTaskRunner; | 22 class DomStorageTaskRunner; |
23 class SessionStorageDatabase; | 23 class SessionStorageDatabase; |
24 | 24 |
25 // Container for a per-origin Map of key/value pairs potentially | 25 // Container for a per-origin Map of key/value pairs potentially |
26 // backed by storage on disk and lazily commits changes to disk. | 26 // backed by storage on disk and lazily commits changes to disk. |
27 // See class comments for DomStorageContext for a larger overview. | 27 // See class comments for DomStorageContext for a larger overview. |
28 class WEBKIT_STORAGE_EXPORT DomStorageArea | 28 class WEBKIT_STORAGE_EXPORT DomStorageArea |
29 : public base::RefCountedThreadSafe<DomStorageArea> { | 29 : public base::RefCountedThreadSafe<DomStorageArea> { |
30 | 30 |
31 public: | 31 public: |
32 static const FilePath::CharType kDatabaseFileExtension[]; | 32 static const base::FilePath::CharType kDatabaseFileExtension[]; |
33 static FilePath DatabaseFileNameFromOrigin(const GURL& origin); | 33 static base::FilePath DatabaseFileNameFromOrigin(const GURL& origin); |
34 static GURL OriginFromDatabaseFileName(const FilePath& file_name); | 34 static GURL OriginFromDatabaseFileName(const base::FilePath& file_name); |
35 | 35 |
36 // Local storage. Backed on disk if directory is nonempty. | 36 // Local storage. Backed on disk if directory is nonempty. |
37 DomStorageArea(const GURL& origin, | 37 DomStorageArea(const GURL& origin, |
38 const FilePath& directory, | 38 const base::FilePath& directory, |
39 DomStorageTaskRunner* task_runner); | 39 DomStorageTaskRunner* task_runner); |
40 | 40 |
41 // Session storage. Backed on disk if |session_storage_backing| is not NULL. | 41 // Session storage. Backed on disk if |session_storage_backing| is not NULL. |
42 DomStorageArea(int64 namespace_id, | 42 DomStorageArea(int64 namespace_id, |
43 const std::string& persistent_namespace_id, | 43 const std::string& persistent_namespace_id, |
44 const GURL& origin, | 44 const GURL& origin, |
45 SessionStorageDatabase* session_storage_backing, | 45 SessionStorageDatabase* session_storage_backing, |
46 DomStorageTaskRunner* task_runner); | 46 DomStorageTaskRunner* task_runner); |
47 | 47 |
48 const GURL& origin() const { return origin_; } | 48 const GURL& origin() const { return origin_; } |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 CommitBatch* CreateCommitBatchIfNeeded(); | 112 CommitBatch* CreateCommitBatchIfNeeded(); |
113 void OnCommitTimer(); | 113 void OnCommitTimer(); |
114 void CommitChanges(const CommitBatch* commit_batch); | 114 void CommitChanges(const CommitBatch* commit_batch); |
115 void OnCommitComplete(); | 115 void OnCommitComplete(); |
116 | 116 |
117 void ShutdownInCommitSequence(); | 117 void ShutdownInCommitSequence(); |
118 | 118 |
119 int64 namespace_id_; | 119 int64 namespace_id_; |
120 std::string persistent_namespace_id_; | 120 std::string persistent_namespace_id_; |
121 GURL origin_; | 121 GURL origin_; |
122 FilePath directory_; | 122 base::FilePath directory_; |
123 scoped_refptr<DomStorageTaskRunner> task_runner_; | 123 scoped_refptr<DomStorageTaskRunner> task_runner_; |
124 scoped_refptr<DomStorageMap> map_; | 124 scoped_refptr<DomStorageMap> map_; |
125 scoped_ptr<DomStorageDatabaseAdapter> backing_; | 125 scoped_ptr<DomStorageDatabaseAdapter> backing_; |
126 scoped_refptr<SessionStorageDatabase> session_storage_backing_; | 126 scoped_refptr<SessionStorageDatabase> session_storage_backing_; |
127 bool is_initial_import_done_; | 127 bool is_initial_import_done_; |
128 bool is_shutdown_; | 128 bool is_shutdown_; |
129 scoped_ptr<CommitBatch> commit_batch_; | 129 scoped_ptr<CommitBatch> commit_batch_; |
130 int commit_batches_in_flight_; | 130 int commit_batches_in_flight_; |
131 }; | 131 }; |
132 | 132 |
133 } // namespace dom_storage | 133 } // namespace dom_storage |
134 | 134 |
135 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_AREA_H_ | 135 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_AREA_H_ |
OLD | NEW |