OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CONTENT_BROWSER_DOM_STORAGE_SESSION_STORAGE_DATABASE_H_ | 5 #ifndef CONTENT_BROWSER_DOM_STORAGE_SESSION_STORAGE_DATABASE_H_ |
6 #define CONTENT_BROWSER_DOM_STORAGE_SESSION_STORAGE_DATABASE_H_ | 6 #define CONTENT_BROWSER_DOM_STORAGE_SESSION_STORAGE_DATABASE_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <map> | 10 #include <map> |
9 #include <string> | 11 #include <string> |
10 | 12 |
11 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
14 #include "base/synchronization/lock.h" | 17 #include "base/synchronization/lock.h" |
15 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
16 #include "content/common/dom_storage/dom_storage_types.h" | 19 #include "content/common/dom_storage/dom_storage_types.h" |
17 #include "third_party/leveldatabase/src/include/leveldb/status.h" | 20 #include "third_party/leveldatabase/src/include/leveldb/status.h" |
18 | 21 |
19 class GURL; | 22 class GURL; |
20 | 23 |
21 namespace leveldb { | 24 namespace leveldb { |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 // be empty. | 154 // be empty. |
152 bool ReadMap(const std::string& map_id, | 155 bool ReadMap(const std::string& map_id, |
153 const leveldb::ReadOptions& options, | 156 const leveldb::ReadOptions& options, |
154 DOMStorageValuesMap* result, | 157 DOMStorageValuesMap* result, |
155 bool only_keys); | 158 bool only_keys); |
156 // Writes |values| into the map |map_id|. | 159 // Writes |values| into the map |map_id|. |
157 void WriteValuesToMap(const std::string& map_id, | 160 void WriteValuesToMap(const std::string& map_id, |
158 const DOMStorageValuesMap& values, | 161 const DOMStorageValuesMap& values, |
159 leveldb::WriteBatch* batch); | 162 leveldb::WriteBatch* batch); |
160 | 163 |
161 bool GetMapRefCount(const std::string& map_id, int64* ref_count); | 164 bool GetMapRefCount(const std::string& map_id, int64_t* ref_count); |
162 bool IncreaseMapRefCount(const std::string& map_id, | 165 bool IncreaseMapRefCount(const std::string& map_id, |
163 leveldb::WriteBatch* batch); | 166 leveldb::WriteBatch* batch); |
164 // Decreases the ref count of a map by |decrease|. If the ref count goes to 0, | 167 // Decreases the ref count of a map by |decrease|. If the ref count goes to 0, |
165 // deletes the map. | 168 // deletes the map. |
166 bool DecreaseMapRefCount(const std::string& map_id, | 169 bool DecreaseMapRefCount(const std::string& map_id, |
167 int decrease, | 170 int decrease, |
168 leveldb::WriteBatch* batch); | 171 leveldb::WriteBatch* batch); |
169 | 172 |
170 // Deletes all values in |map_id|. | 173 // Deletes all values in |map_id|. |
171 bool ClearMap(const std::string& map_id, leveldb::WriteBatch* batch); | 174 bool ClearMap(const std::string& map_id, leveldb::WriteBatch* batch); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 // The number of database operations in progress. We need this so that we can | 208 // The number of database operations in progress. We need this so that we can |
206 // delete an inconsistent database at the right moment. | 209 // delete an inconsistent database at the right moment. |
207 int operation_count_; | 210 int operation_count_; |
208 | 211 |
209 DISALLOW_COPY_AND_ASSIGN(SessionStorageDatabase); | 212 DISALLOW_COPY_AND_ASSIGN(SessionStorageDatabase); |
210 }; | 213 }; |
211 | 214 |
212 } // namespace content | 215 } // namespace content |
213 | 216 |
214 #endif // CONTENT_BROWSER_DOM_STORAGE_SESSION_STORAGE_DATABASE_H_ | 217 #endif // CONTENT_BROWSER_DOM_STORAGE_SESSION_STORAGE_DATABASE_H_ |
OLD | NEW |