OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ | 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ |
6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ | 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "content/browser/indexed_db/indexed_db.h" | 15 #include "content/browser/indexed_db/indexed_db.h" |
16 #include "content/browser/indexed_db/indexed_db_metadata.h" | 16 #include "content/browser/indexed_db/indexed_db_metadata.h" |
17 #include "content/browser/indexed_db/leveldb/leveldb_iterator.h" | 17 #include "content/browser/indexed_db/leveldb/leveldb_iterator.h" |
18 #include "content/browser/indexed_db/leveldb/leveldb_transaction.h" | 18 #include "content/browser/indexed_db/leveldb/leveldb_transaction.h" |
19 #include "content/common/content_export.h" | 19 #include "content/common/content_export.h" |
20 #include "content/common/indexed_db/indexed_db_key.h" | 20 #include "content/common/indexed_db/indexed_db_key.h" |
21 #include "content/common/indexed_db/indexed_db_key_path.h" | 21 #include "content/common/indexed_db/indexed_db_key_path.h" |
22 #include "content/common/indexed_db/indexed_db_key_range.h" | 22 #include "content/common/indexed_db/indexed_db_key_range.h" |
| 23 #include "third_party/WebKit/public/platform/WebIDBCallbacks.h" |
23 | 24 |
24 namespace content { | 25 namespace content { |
25 | 26 |
26 class LevelDBComparator; | 27 class LevelDBComparator; |
27 class LevelDBDatabase; | 28 class LevelDBDatabase; |
28 | 29 |
29 class LevelDBFactory { | 30 class LevelDBFactory { |
30 public: | 31 public: |
31 virtual ~LevelDBFactory() {} | 32 virtual ~LevelDBFactory() {} |
32 virtual scoped_ptr<LevelDBDatabase> OpenLevelDB( | 33 virtual scoped_ptr<LevelDBDatabase> OpenLevelDB( |
33 const base::FilePath& file_name, | 34 const base::FilePath& file_name, |
34 const LevelDBComparator* comparator, | 35 const LevelDBComparator* comparator, |
35 bool* is_disk_full = NULL) = 0; | 36 bool* is_disk_full = NULL) = 0; |
36 virtual bool DestroyLevelDB(const base::FilePath& file_name) = 0; | 37 virtual bool DestroyLevelDB(const base::FilePath& file_name) = 0; |
37 }; | 38 }; |
38 | 39 |
39 class CONTENT_EXPORT IndexedDBBackingStore | 40 class CONTENT_EXPORT IndexedDBBackingStore |
40 : public base::RefCounted<IndexedDBBackingStore> { | 41 : public base::RefCounted<IndexedDBBackingStore> { |
41 public: | 42 public: |
42 class CONTENT_EXPORT Transaction; | 43 class CONTENT_EXPORT Transaction; |
43 | 44 |
44 static scoped_refptr<IndexedDBBackingStore> Open( | 45 static scoped_refptr<IndexedDBBackingStore> Open( |
45 const string16& database_identifier, | 46 const string16& database_identifier, |
46 const base::FilePath& path_base, | 47 const base::FilePath& path_base, |
47 const string16& file_identifier); | |
48 static scoped_refptr<IndexedDBBackingStore> Open( | |
49 const string16& database_identifier, | |
50 const base::FilePath& path_base, | |
51 const string16& file_identifier, | 48 const string16& file_identifier, |
| 49 WebKit::WebIDBCallbacks::DataLoss* data_loss); |
| 50 static scoped_refptr<IndexedDBBackingStore> Open( |
| 51 const string16& database_identifier, |
| 52 const base::FilePath& path_base, |
| 53 const string16& file_identifier, |
| 54 WebKit::WebIDBCallbacks::DataLoss* data_loss, |
52 LevelDBFactory* factory); | 55 LevelDBFactory* factory); |
53 static scoped_refptr<IndexedDBBackingStore> OpenInMemory( | 56 static scoped_refptr<IndexedDBBackingStore> OpenInMemory( |
54 const string16& identifier); | 57 const string16& identifier); |
55 static scoped_refptr<IndexedDBBackingStore> OpenInMemory( | 58 static scoped_refptr<IndexedDBBackingStore> OpenInMemory( |
56 const string16& identifier, | 59 const string16& identifier, |
57 LevelDBFactory* factory); | 60 LevelDBFactory* factory); |
58 base::WeakPtr<IndexedDBBackingStore> GetWeakPtr() { | 61 base::WeakPtr<IndexedDBBackingStore> GetWeakPtr() { |
59 return weak_factory_.GetWeakPtr(); | 62 return weak_factory_.GetWeakPtr(); |
60 } | 63 } |
61 | 64 |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 string16 identifier_; | 315 string16 identifier_; |
313 | 316 |
314 scoped_ptr<LevelDBDatabase> db_; | 317 scoped_ptr<LevelDBDatabase> db_; |
315 scoped_ptr<LevelDBComparator> comparator_; | 318 scoped_ptr<LevelDBComparator> comparator_; |
316 base::WeakPtrFactory<IndexedDBBackingStore> weak_factory_; | 319 base::WeakPtrFactory<IndexedDBBackingStore> weak_factory_; |
317 }; | 320 }; |
318 | 321 |
319 } // namespace content | 322 } // namespace content |
320 | 323 |
321 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ | 324 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ |
OLD | NEW |