Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Side by Side Diff: trunk/src/content/browser/indexed_db/indexed_db_backing_store.h

Issue 216433007: Revert 260147 "Handling LevelDB errors encountered after open." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | trunk/src/content/browser/indexed_db/indexed_db_backing_store.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/strings/string_piece.h"
16 #include "base/timer/timer.h" 16 #include "base/timer/timer.h"
17 #include "content/browser/indexed_db/indexed_db.h" 17 #include "content/browser/indexed_db/indexed_db.h"
18 #include "content/browser/indexed_db/indexed_db_metadata.h" 18 #include "content/browser/indexed_db/indexed_db_metadata.h"
19 #include "content/browser/indexed_db/leveldb/leveldb_iterator.h" 19 #include "content/browser/indexed_db/leveldb/leveldb_iterator.h"
20 #include "content/browser/indexed_db/leveldb/leveldb_transaction.h" 20 #include "content/browser/indexed_db/leveldb/leveldb_transaction.h"
21 #include "content/common/content_export.h" 21 #include "content/common/content_export.h"
22 #include "content/common/indexed_db/indexed_db_key.h" 22 #include "content/common/indexed_db/indexed_db_key.h"
23 #include "content/common/indexed_db/indexed_db_key_path.h" 23 #include "content/common/indexed_db/indexed_db_key_path.h"
24 #include "content/common/indexed_db/indexed_db_key_range.h" 24 #include "content/common/indexed_db/indexed_db_key_range.h"
25 #include "third_party/leveldatabase/src/include/leveldb/status.h" 25 #include "third_party/leveldatabase/src/include/leveldb/status.h"
26 #include "url/gurl.h" 26 #include "url/gurl.h"
27 27
28 namespace content { 28 namespace content {
29 29
30 class IndexedDBDatabaseError;
31 class LevelDBComparator; 30 class LevelDBComparator;
32 class LevelDBDatabase; 31 class LevelDBDatabase;
33 struct IndexedDBValue; 32 struct IndexedDBValue;
34 33
35 class LevelDBFactory { 34 class LevelDBFactory {
36 public: 35 public:
37 virtual ~LevelDBFactory() {} 36 virtual ~LevelDBFactory() {}
38 virtual leveldb::Status OpenLevelDB(const base::FilePath& file_name, 37 virtual leveldb::Status OpenLevelDB(const base::FilePath& file_name,
39 const LevelDBComparator* comparator, 38 const LevelDBComparator* comparator,
40 scoped_ptr<LevelDBDatabase>* db, 39 scoped_ptr<LevelDBDatabase>* db,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 blink::WebIDBDataLoss* data_loss, 71 blink::WebIDBDataLoss* data_loss,
73 std::string* data_loss_message, 72 std::string* data_loss_message,
74 bool* disk_full, 73 bool* disk_full,
75 LevelDBFactory* factory); 74 LevelDBFactory* factory);
76 static scoped_refptr<IndexedDBBackingStore> OpenInMemory( 75 static scoped_refptr<IndexedDBBackingStore> OpenInMemory(
77 const GURL& origin_url); 76 const GURL& origin_url);
78 static scoped_refptr<IndexedDBBackingStore> OpenInMemory( 77 static scoped_refptr<IndexedDBBackingStore> OpenInMemory(
79 const GURL& origin_url, 78 const GURL& origin_url,
80 LevelDBFactory* factory); 79 LevelDBFactory* factory);
81 80
82 virtual void Compact();
83 virtual std::vector<base::string16> GetDatabaseNames(); 81 virtual std::vector<base::string16> GetDatabaseNames();
84 virtual leveldb::Status GetIDBDatabaseMetaData( 82 virtual leveldb::Status GetIDBDatabaseMetaData(
85 const base::string16& name, 83 const base::string16& name,
86 IndexedDBDatabaseMetadata* metadata, 84 IndexedDBDatabaseMetadata* metadata,
87 bool* success) WARN_UNUSED_RESULT; 85 bool* success) WARN_UNUSED_RESULT;
88 virtual leveldb::Status CreateIDBDatabaseMetaData( 86 virtual leveldb::Status CreateIDBDatabaseMetaData(
89 const base::string16& name, 87 const base::string16& name,
90 const base::string16& version, 88 const base::string16& version,
91 int64 int_version, 89 int64 int_version,
92 int64* row_id); 90 int64* row_id);
93 virtual bool UpdateIDBDatabaseIntVersion( 91 virtual bool UpdateIDBDatabaseIntVersion(
94 IndexedDBBackingStore::Transaction* transaction, 92 IndexedDBBackingStore::Transaction* transaction,
95 int64 row_id, 93 int64 row_id,
96 int64 int_version); 94 int64 int_version);
97 virtual leveldb::Status DeleteDatabase(const base::string16& name); 95 virtual leveldb::Status DeleteDatabase(const base::string16& name);
98 96
99 // Assumes caller has already closed the backing store.
100 static leveldb::Status DestroyBackingStore(const base::FilePath& path_base,
101 const GURL& origin_url);
102 static bool RecordCorruptionInfo(const base::FilePath& path_base,
103 const GURL& origin_url,
104 const std::string& message);
105 leveldb::Status GetObjectStores( 97 leveldb::Status GetObjectStores(
106 int64 database_id, 98 int64 database_id,
107 IndexedDBDatabaseMetadata::ObjectStoreMap* map) WARN_UNUSED_RESULT; 99 IndexedDBDatabaseMetadata::ObjectStoreMap* map) WARN_UNUSED_RESULT;
108 virtual leveldb::Status CreateObjectStore( 100 virtual leveldb::Status CreateObjectStore(
109 IndexedDBBackingStore::Transaction* transaction, 101 IndexedDBBackingStore::Transaction* transaction,
110 int64 database_id, 102 int64 database_id,
111 int64 object_store_id, 103 int64 object_store_id,
112 const base::string16& name, 104 const base::string16& name,
113 const IndexedDBKeyPath& key_path, 105 const IndexedDBKeyPath& key_path,
114 bool auto_increment); 106 bool auto_increment);
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 scoped_ptr<LevelDBDatabase> db, 318 scoped_ptr<LevelDBDatabase> db,
327 scoped_ptr<LevelDBComparator> comparator); 319 scoped_ptr<LevelDBComparator> comparator);
328 virtual ~IndexedDBBackingStore(); 320 virtual ~IndexedDBBackingStore();
329 friend class base::RefCounted<IndexedDBBackingStore>; 321 friend class base::RefCounted<IndexedDBBackingStore>;
330 322
331 private: 323 private:
332 static scoped_refptr<IndexedDBBackingStore> Create( 324 static scoped_refptr<IndexedDBBackingStore> Create(
333 const GURL& origin_url, 325 const GURL& origin_url,
334 scoped_ptr<LevelDBDatabase> db, 326 scoped_ptr<LevelDBDatabase> db,
335 scoped_ptr<LevelDBComparator> comparator); 327 scoped_ptr<LevelDBComparator> comparator);
336 static bool ReadCorruptionInfo(const base::FilePath& path_base,
337 const GURL& origin_url,
338 std::string& message);
339 328
340 leveldb::Status FindKeyInIndex( 329 leveldb::Status FindKeyInIndex(
341 IndexedDBBackingStore::Transaction* transaction, 330 IndexedDBBackingStore::Transaction* transaction,
342 int64 database_id, 331 int64 database_id,
343 int64 object_store_id, 332 int64 object_store_id,
344 int64 index_id, 333 int64 index_id,
345 const IndexedDBKey& key, 334 const IndexedDBKey& key,
346 std::string* found_encoded_primary_key, 335 std::string* found_encoded_primary_key,
347 bool* found); 336 bool* found);
348 leveldb::Status GetIndexes(int64 database_id, 337 leveldb::Status GetIndexes(int64 database_id,
(...skipping 12 matching lines...) Expand all
361 const std::string origin_identifier_; 350 const std::string origin_identifier_;
362 351
363 scoped_ptr<LevelDBDatabase> db_; 352 scoped_ptr<LevelDBDatabase> db_;
364 scoped_ptr<LevelDBComparator> comparator_; 353 scoped_ptr<LevelDBComparator> comparator_;
365 base::OneShotTimer<IndexedDBBackingStore> close_timer_; 354 base::OneShotTimer<IndexedDBBackingStore> close_timer_;
366 }; 355 };
367 356
368 } // namespace content 357 } // namespace content
369 358
370 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ 359 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_
OLDNEW
« no previous file with comments | « no previous file | trunk/src/content/browser/indexed_db/indexed_db_backing_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698