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

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

Issue 16870007: Switch database/file_identifier to std::string, remove createFromDatabaseIdentifier calls (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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
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 <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 24 matching lines...) Expand all
35 bool* is_disk_full = NULL) = 0; 35 bool* is_disk_full = NULL) = 0;
36 virtual bool DestroyLevelDB(const base::FilePath& file_name) = 0; 36 virtual bool DestroyLevelDB(const base::FilePath& file_name) = 0;
37 }; 37 };
38 38
39 class CONTENT_EXPORT IndexedDBBackingStore 39 class CONTENT_EXPORT IndexedDBBackingStore
40 : public base::RefCounted<IndexedDBBackingStore> { 40 : public base::RefCounted<IndexedDBBackingStore> {
41 public: 41 public:
42 class CONTENT_EXPORT Transaction; 42 class CONTENT_EXPORT Transaction;
43 43
44 static scoped_refptr<IndexedDBBackingStore> Open( 44 static scoped_refptr<IndexedDBBackingStore> Open(
45 const string16& database_identifier, 45 const std::string& origin_identifier,
46 const base::FilePath& path_base, 46 const base::FilePath& path_base,
47 const string16& file_identifier); 47 const std::string& file_identifier);
48 static scoped_refptr<IndexedDBBackingStore> Open( 48 static scoped_refptr<IndexedDBBackingStore> Open(
49 const string16& database_identifier, 49 const std::string& origin_identifier,
50 const base::FilePath& path_base, 50 const base::FilePath& path_base,
51 const string16& file_identifier, 51 const std::string& file_identifier,
52 LevelDBFactory* factory); 52 LevelDBFactory* factory);
53 static scoped_refptr<IndexedDBBackingStore> OpenInMemory( 53 static scoped_refptr<IndexedDBBackingStore> OpenInMemory(
54 const string16& identifier); 54 const std::string& file_identifier);
jsbell 2013/06/20 16:38:40 file_identifier for OpenInMemory is a little odd;
55 static scoped_refptr<IndexedDBBackingStore> OpenInMemory( 55 static scoped_refptr<IndexedDBBackingStore> OpenInMemory(
56 const string16& identifier, 56 const std::string& file_identifier,
57 LevelDBFactory* factory); 57 LevelDBFactory* factory);
58 base::WeakPtr<IndexedDBBackingStore> GetWeakPtr() { 58 base::WeakPtr<IndexedDBBackingStore> GetWeakPtr() {
59 return weak_factory_.GetWeakPtr(); 59 return weak_factory_.GetWeakPtr();
60 } 60 }
61 61
62 virtual std::vector<string16> GetDatabaseNames(); 62 virtual std::vector<string16> GetDatabaseNames();
63 virtual bool GetIDBDatabaseMetaData(const string16& name, 63 virtual bool GetIDBDatabaseMetaData(const string16& name,
64 IndexedDBDatabaseMetadata* metadata, 64 IndexedDBDatabaseMetadata* metadata,
65 bool* success) WARN_UNUSED_RESULT; 65 bool* success) WARN_UNUSED_RESULT;
66 virtual bool CreateIDBDatabaseMetaData(const string16& name, 66 virtual bool CreateIDBDatabaseMetaData(const string16& name,
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 Transaction* transaction) { 278 Transaction* transaction) {
279 return transaction->transaction_.get(); 279 return transaction->transaction_.get();
280 } 280 }
281 281
282 private: 282 private:
283 IndexedDBBackingStore* backing_store_; 283 IndexedDBBackingStore* backing_store_;
284 scoped_refptr<LevelDBTransaction> transaction_; 284 scoped_refptr<LevelDBTransaction> transaction_;
285 }; 285 };
286 286
287 protected: 287 protected:
288 IndexedDBBackingStore(const string16& identifier, 288 IndexedDBBackingStore(const std::string& identifier,
289 scoped_ptr<LevelDBDatabase> db, 289 scoped_ptr<LevelDBDatabase> db,
290 scoped_ptr<LevelDBComparator> comparator); 290 scoped_ptr<LevelDBComparator> comparator);
291 virtual ~IndexedDBBackingStore(); 291 virtual ~IndexedDBBackingStore();
292 friend class base::RefCounted<IndexedDBBackingStore>; 292 friend class base::RefCounted<IndexedDBBackingStore>;
293 293
294 private: 294 private:
295 static scoped_refptr<IndexedDBBackingStore> Create( 295 static scoped_refptr<IndexedDBBackingStore> Create(
296 const string16& identifier, 296 const std::string& identifier,
297 scoped_ptr<LevelDBDatabase> db, 297 scoped_ptr<LevelDBDatabase> db,
298 scoped_ptr<LevelDBComparator> comparator); 298 scoped_ptr<LevelDBComparator> comparator);
299 299
300 bool FindKeyInIndex(IndexedDBBackingStore::Transaction* transaction, 300 bool FindKeyInIndex(IndexedDBBackingStore::Transaction* transaction,
301 int64 database_id, 301 int64 database_id,
302 int64 object_store_id, 302 int64 object_store_id,
303 int64 index_id, 303 int64 index_id,
304 const IndexedDBKey& key, 304 const IndexedDBKey& key,
305 std::vector<char>* found_encoded_primary_key, 305 std::vector<char>* found_encoded_primary_key,
306 bool* found); 306 bool* found);
307 bool GetIndexes(int64 database_id, 307 bool GetIndexes(int64 database_id,
308 int64 object_store_id, 308 int64 object_store_id,
309 IndexedDBObjectStoreMetadata::IndexMap* map) 309 IndexedDBObjectStoreMetadata::IndexMap* map)
310 WARN_UNUSED_RESULT; 310 WARN_UNUSED_RESULT;
311 311
312 string16 identifier_; 312 std::string identifier_;
313 313
314 scoped_ptr<LevelDBDatabase> db_; 314 scoped_ptr<LevelDBDatabase> db_;
315 scoped_ptr<LevelDBComparator> comparator_; 315 scoped_ptr<LevelDBComparator> comparator_;
316 base::WeakPtrFactory<IndexedDBBackingStore> weak_factory_; 316 base::WeakPtrFactory<IndexedDBBackingStore> weak_factory_;
317 }; 317 };
318 318
319 } // namespace content 319 } // namespace content
320 320
321 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ 321 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698