| 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 <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/strings/string_piece.h" |
| 15 #include "base/timer/timer.h" | 16 #include "base/timer/timer.h" |
| 16 #include "content/browser/indexed_db/indexed_db.h" | 17 #include "content/browser/indexed_db/indexed_db.h" |
| 17 #include "content/browser/indexed_db/indexed_db_metadata.h" | 18 #include "content/browser/indexed_db/indexed_db_metadata.h" |
| 18 #include "content/browser/indexed_db/leveldb/leveldb_iterator.h" | 19 #include "content/browser/indexed_db/leveldb/leveldb_iterator.h" |
| 19 #include "content/browser/indexed_db/leveldb/leveldb_transaction.h" | 20 #include "content/browser/indexed_db/leveldb/leveldb_transaction.h" |
| 20 #include "content/common/content_export.h" | 21 #include "content/common/content_export.h" |
| 21 #include "content/common/indexed_db/indexed_db_key.h" | 22 #include "content/common/indexed_db/indexed_db_key.h" |
| 22 #include "content/common/indexed_db/indexed_db_key_path.h" | 23 #include "content/common/indexed_db/indexed_db_key_path.h" |
| 23 #include "content/common/indexed_db/indexed_db_key_range.h" | 24 #include "content/common/indexed_db/indexed_db_key_range.h" |
| 24 #include "third_party/leveldatabase/src/include/leveldb/status.h" | 25 #include "third_party/leveldatabase/src/include/leveldb/status.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 38 scoped_ptr<LevelDBDatabase>* db, | 39 scoped_ptr<LevelDBDatabase>* db, |
| 39 bool* is_disk_full) = 0; | 40 bool* is_disk_full) = 0; |
| 40 virtual leveldb::Status DestroyLevelDB(const base::FilePath& file_name) = 0; | 41 virtual leveldb::Status DestroyLevelDB(const base::FilePath& file_name) = 0; |
| 41 }; | 42 }; |
| 42 | 43 |
| 43 class CONTENT_EXPORT IndexedDBBackingStore | 44 class CONTENT_EXPORT IndexedDBBackingStore |
| 44 : public base::RefCounted<IndexedDBBackingStore> { | 45 : public base::RefCounted<IndexedDBBackingStore> { |
| 45 public: | 46 public: |
| 46 class CONTENT_EXPORT Transaction; | 47 class CONTENT_EXPORT Transaction; |
| 47 | 48 |
| 49 class Comparator : public LevelDBComparator { |
| 50 public: |
| 51 virtual int Compare(const base::StringPiece& a, |
| 52 const base::StringPiece& b) const OVERRIDE; |
| 53 virtual const char* Name() const OVERRIDE; |
| 54 }; |
| 55 |
| 48 const GURL& origin_url() const { return origin_url_; } | 56 const GURL& origin_url() const { return origin_url_; } |
| 49 base::OneShotTimer<IndexedDBBackingStore>* close_timer() { | 57 base::OneShotTimer<IndexedDBBackingStore>* close_timer() { |
| 50 return &close_timer_; | 58 return &close_timer_; |
| 51 } | 59 } |
| 52 | 60 |
| 53 static scoped_refptr<IndexedDBBackingStore> Open( | 61 static scoped_refptr<IndexedDBBackingStore> Open( |
| 54 const GURL& origin_url, | 62 const GURL& origin_url, |
| 55 const base::FilePath& path_base, | 63 const base::FilePath& path_base, |
| 56 blink::WebIDBDataLoss* data_loss, | 64 blink::WebIDBDataLoss* data_loss, |
| 57 std::string* data_loss_message, | 65 std::string* data_loss_message, |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 const std::string origin_identifier_; | 350 const std::string origin_identifier_; |
| 343 | 351 |
| 344 scoped_ptr<LevelDBDatabase> db_; | 352 scoped_ptr<LevelDBDatabase> db_; |
| 345 scoped_ptr<LevelDBComparator> comparator_; | 353 scoped_ptr<LevelDBComparator> comparator_; |
| 346 base::OneShotTimer<IndexedDBBackingStore> close_timer_; | 354 base::OneShotTimer<IndexedDBBackingStore> close_timer_; |
| 347 }; | 355 }; |
| 348 | 356 |
| 349 } // namespace content | 357 } // namespace content |
| 350 | 358 |
| 351 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ | 359 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ |
| OLD | NEW |