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

Unified Diff: content/browser/indexed_db/indexed_db_factory.cc

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 side-by-side diff with in-line comments
Download patch
Index: content/browser/indexed_db/indexed_db_factory.cc
diff --git a/content/browser/indexed_db/indexed_db_factory.cc b/content/browser/indexed_db/indexed_db_factory.cc
index 374e96c7d53f2cdb45b26c0448956b760029e8f1..fbe555d0c73c086769416061a86f29d87d8f8380 100644
--- a/content/browser/indexed_db/indexed_db_factory.cc
+++ b/content/browser/indexed_db/indexed_db_factory.cc
@@ -27,16 +27,13 @@ static void CleanWeakMap(std::map<K, base::WeakPtr<M> >* map) {
}
}
-static string16 ComputeFileIdentifier(const string16& database_identifier) {
- string16 suffix(ASCIIToUTF16("@1"));
- string16 result(database_identifier);
- result.insert(result.end(), suffix.begin(), suffix.end());
- return result;
+static std::string ComputeFileIdentifier(const std::string& origin_identifier) {
+ return origin_identifier + "@1";
}
static string16 ComputeUniqueIdentifier(const string16& name,
jsbell 2013/06/20 16:38:40 There's actually no reason this needs to be a stri
jamesr 2013/06/20 16:54:32 Ah, I had assumed that 'name' was the same as the
- const string16& database_identifier) {
- return ComputeFileIdentifier(database_identifier) + name;
+ const std::string& origin_identifier) {
+ return ASCIIToUTF16(ComputeFileIdentifier(origin_identifier)) + name;
}
IndexedDBFactory::IndexedDBFactory() {}
@@ -52,11 +49,11 @@ void IndexedDBFactory::RemoveIDBDatabaseBackend(
void IndexedDBFactory::GetDatabaseNames(
scoped_refptr<IndexedDBCallbacksWrapper> callbacks,
- const string16& database_identifier,
+ const std::string& origin_identifier,
const base::FilePath& data_directory) {
IDB_TRACE("IndexedDBFactory::get_database_names");
scoped_refptr<IndexedDBBackingStore> backing_store =
- OpenBackingStore(database_identifier, data_directory);
+ OpenBackingStore(origin_identifier, data_directory);
if (!backing_store.get()) {
callbacks->OnError(
IndexedDBDatabaseError(WebKit::WebIDBDatabaseExceptionUnknownError,
@@ -71,11 +68,11 @@ void IndexedDBFactory::GetDatabaseNames(
void IndexedDBFactory::DeleteDatabase(
const string16& name,
scoped_refptr<IndexedDBCallbacksWrapper> callbacks,
- const string16& database_identifier,
+ const std::string& origin_identifier,
const base::FilePath& data_directory) {
IDB_TRACE("IndexedDBFactory::delete_database");
const string16 unique_identifier =
- ComputeUniqueIdentifier(name, database_identifier);
+ ComputeUniqueIdentifier(name, origin_identifier);
IndexedDBDatabaseMap::iterator it =
database_backend_map_.find(unique_identifier);
@@ -88,7 +85,7 @@ void IndexedDBFactory::DeleteDatabase(
// TODO(jsbell): Everything from now on should be done on another thread.
scoped_refptr<IndexedDBBackingStore> backing_store =
- OpenBackingStore(database_identifier, data_directory);
+ OpenBackingStore(origin_identifier, data_directory);
if (!backing_store.get()) {
callbacks->OnError(IndexedDBDatabaseError(
WebKit::WebIDBDatabaseExceptionUnknownError,
@@ -113,9 +110,9 @@ void IndexedDBFactory::DeleteDatabase(
}
scoped_refptr<IndexedDBBackingStore> IndexedDBFactory::OpenBackingStore(
- const string16& database_identifier,
+ const std::string& origin_identifier,
const base::FilePath& data_directory) {
- const string16 file_identifier = ComputeFileIdentifier(database_identifier);
+ const std::string file_identifier = ComputeFileIdentifier(origin_identifier);
const bool open_in_memory = data_directory.empty();
IndexedDBBackingStoreMap::iterator it2 =
@@ -128,7 +125,7 @@ scoped_refptr<IndexedDBBackingStore> IndexedDBFactory::OpenBackingStore(
backing_store = IndexedDBBackingStore::OpenInMemory(file_identifier);
} else {
backing_store = IndexedDBBackingStore::Open(
- database_identifier, data_directory, file_identifier);
+ origin_identifier, data_directory, file_identifier);
}
if (backing_store.get()) {
@@ -154,18 +151,18 @@ void IndexedDBFactory::Open(
int64 transaction_id,
scoped_refptr<IndexedDBCallbacksWrapper> callbacks,
scoped_refptr<IndexedDBDatabaseCallbacksWrapper> database_callbacks,
- const string16& database_identifier,
+ const std::string& origin_identifier,
const base::FilePath& data_directory) {
IDB_TRACE("IndexedDBFactory::open");
const string16 unique_identifier =
- ComputeUniqueIdentifier(name, database_identifier);
+ ComputeUniqueIdentifier(name, origin_identifier);
scoped_refptr<IndexedDBDatabase> database_backend;
IndexedDBDatabaseMap::iterator it =
database_backend_map_.find(unique_identifier);
if (it == database_backend_map_.end()) {
scoped_refptr<IndexedDBBackingStore> backing_store =
- OpenBackingStore(database_identifier, data_directory);
+ OpenBackingStore(origin_identifier, data_directory);
if (!backing_store.get()) {
callbacks->OnError(IndexedDBDatabaseError(
WebKit::WebIDBDatabaseExceptionUnknownError,

Powered by Google App Engine
This is Rietveld 408576698