| Index: content/browser/indexed_db/indexed_db_backing_store.cc
|
| diff --git a/content/browser/indexed_db/indexed_db_backing_store.cc b/content/browser/indexed_db/indexed_db_backing_store.cc
|
| index e3b6a43369b235807614276dd7c349a372e01ed1..25694e5bd9162a480bfde4d8a8aeb8b641bfb0cb 100644
|
| --- a/content/browser/indexed_db/indexed_db_backing_store.cc
|
| +++ b/content/browser/indexed_db/indexed_db_backing_store.cc
|
| @@ -231,8 +231,9 @@ WARN_UNUSED_RESULT static bool IsSchemaKnown(LevelDBDatabase* db, bool* known) {
|
| return true;
|
| }
|
|
|
| -WARN_UNUSED_RESULT static bool SetUpMetadata(LevelDBDatabase* db,
|
| - const string16& origin) {
|
| +WARN_UNUSED_RESULT static bool SetUpMetadata(
|
| + LevelDBDatabase* db,
|
| + const std::string& origin_identifier) {
|
| const uint32 latest_known_data_version = kWireVersion;
|
| const std::vector<char> schema_version_key = SchemaVersionKey::Encode();
|
| const std::vector<char> data_version_key = DataVersionKey::Encode();
|
| @@ -267,9 +268,9 @@ WARN_UNUSED_RESULT static bool SetUpMetadata(LevelDBDatabase* db,
|
| LevelDBSlice(schema_version_key),
|
| db_schema_version);
|
| const std::vector<char> start_key =
|
| - DatabaseNameKey::EncodeMinKeyForOrigin(origin);
|
| + DatabaseNameKey::EncodeMinKeyForOrigin(origin_identifier);
|
| const std::vector<char> stop_key =
|
| - DatabaseNameKey::EncodeStopKeyForOrigin(origin);
|
| + DatabaseNameKey::EncodeStopKeyForOrigin(origin_identifier);
|
| scoped_ptr<LevelDBIterator> it = db->CreateIterator();
|
| for (it->Seek(LevelDBSlice(start_key));
|
| it->IsValid() && CompareKeys(it->Key(), LevelDBSlice(stop_key)) < 0;
|
| @@ -374,7 +375,7 @@ class DefaultLevelDBFactory : public LevelDBFactory {
|
| };
|
|
|
| IndexedDBBackingStore::IndexedDBBackingStore(
|
| - const string16& identifier,
|
| + const std::string& identifier,
|
| scoped_ptr<LevelDBDatabase> db,
|
| scoped_ptr<LevelDBComparator> comparator)
|
| : identifier_(identifier),
|
| @@ -419,18 +420,18 @@ enum IndexedDBLevelDBBackingStoreOpenResult {
|
| };
|
|
|
| scoped_refptr<IndexedDBBackingStore> IndexedDBBackingStore::Open(
|
| - const string16& database_identifier,
|
| + const std::string& origin_identifier,
|
| const base::FilePath& path_base,
|
| - const string16& file_identifier) {
|
| + const std::string& file_identifier) {
|
| DefaultLevelDBFactory leveldb_factory;
|
| return IndexedDBBackingStore::Open(
|
| - database_identifier, path_base, file_identifier, &leveldb_factory);
|
| + origin_identifier, path_base, file_identifier, &leveldb_factory);
|
| }
|
|
|
| scoped_refptr<IndexedDBBackingStore> IndexedDBBackingStore::Open(
|
| - const string16& database_identifier,
|
| + const std::string& origin_identifier,
|
| const base::FilePath& path_base,
|
| - const string16& file_identifier,
|
| + const std::string& file_identifier,
|
| LevelDBFactory* leveldb_factory) {
|
| IDB_TRACE("IndexedDBBackingStore::open");
|
| DCHECK(!path_base.empty());
|
| @@ -459,8 +460,10 @@ scoped_refptr<IndexedDBBackingStore> IndexedDBBackingStore::Open(
|
| }
|
|
|
| // TODO(jsbell): Rework to use FilePath throughout.
|
| - base::FilePath identifier_path = base::FilePath::FromUTF8Unsafe(
|
| - UTF16ToUTF8(database_identifier) + ".indexeddb.leveldb");
|
| + base::FilePath identifier_path =
|
| + base::FilePath().AppendASCII(origin_identifier).
|
| + AddExtension(FILE_PATH_LITERAL(".indexeddb.leveldb"));
|
| +
|
| int limit = file_util::GetMaximumPathComponentLength(path_base);
|
| if (limit == -1) {
|
| DLOG(WARNING) << "GetMaximumPathComponentLength returned -1";
|
| @@ -598,13 +601,13 @@ scoped_refptr<IndexedDBBackingStore> IndexedDBBackingStore::Open(
|
| }
|
|
|
| scoped_refptr<IndexedDBBackingStore> IndexedDBBackingStore::OpenInMemory(
|
| - const string16& identifier) {
|
| + const std::string& file_identifier) {
|
| DefaultLevelDBFactory leveldb_factory;
|
| - return IndexedDBBackingStore::OpenInMemory(identifier, &leveldb_factory);
|
| + return IndexedDBBackingStore::OpenInMemory(file_identifier, &leveldb_factory);
|
| }
|
|
|
| scoped_refptr<IndexedDBBackingStore> IndexedDBBackingStore::OpenInMemory(
|
| - const string16& identifier,
|
| + const std::string& file_identifier,
|
| LevelDBFactory* leveldb_factory) {
|
| IDB_TRACE("IndexedDBBackingStore::open_in_memory");
|
|
|
| @@ -628,11 +631,11 @@ scoped_refptr<IndexedDBBackingStore> IndexedDBBackingStore::OpenInMemory(
|
| base::HistogramBase::kUmaTargetedHistogramFlag)
|
| ->Add(INDEXED_DB_LEVEL_DB_BACKING_STORE_OPEN_MEMORY_SUCCESS);
|
|
|
| - return Create(identifier, db.Pass(), comparator.Pass());
|
| + return Create(file_identifier, db.Pass(), comparator.Pass());
|
| }
|
|
|
| scoped_refptr<IndexedDBBackingStore> IndexedDBBackingStore::Create(
|
| - const string16& identifier,
|
| + const std::string& identifier,
|
| scoped_ptr<LevelDBDatabase> db,
|
| scoped_ptr<LevelDBComparator> comparator) {
|
| // TODO(jsbell): Handle comparator name changes.
|
|
|