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 7876a88ac9a65f6c450a3562a77ab25431bca82a..daa12968b6ad71e128b2334a6ac4af31af4f79d2 100644 |
--- a/content/browser/indexed_db/indexed_db_factory.cc |
+++ b/content/browser/indexed_db/indexed_db_factory.cc |
@@ -43,12 +43,14 @@ void IndexedDBFactory::RemoveIDBDatabaseBackend( |
void IndexedDBFactory::GetDatabaseNames( |
scoped_refptr<IndexedDBCallbacks> callbacks, |
const std::string& origin_identifier, |
- const base::FilePath& data_directory) { |
+ const base::FilePath& data_directory, |
+ base::TaskRunner* task_runner) { |
IDB_TRACE("IndexedDBFactory::GetDatabaseNames"); |
// TODO(dgrogan): Plumb data_loss back to script eventually? |
WebKit::WebIDBCallbacks::DataLoss data_loss; |
scoped_refptr<IndexedDBBackingStore> backing_store = |
- OpenBackingStore(origin_identifier, data_directory, &data_loss); |
+ OpenBackingStore(origin_identifier, data_directory, NULL, &data_loss, |
+ task_runner); |
if (!backing_store) { |
callbacks->OnError( |
IndexedDBDatabaseError(WebKit::WebIDBDatabaseExceptionUnknownError, |
@@ -62,9 +64,11 @@ void IndexedDBFactory::GetDatabaseNames( |
void IndexedDBFactory::DeleteDatabase( |
const string16& name, |
+ net::URLRequestContext* request_context, |
scoped_refptr<IndexedDBCallbacks> callbacks, |
const std::string& origin_identifier, |
- const base::FilePath& data_directory) { |
+ const base::FilePath& data_directory, |
+ base::TaskRunner* task_runner) { |
IDB_TRACE("IndexedDBFactory::DeleteDatabase"); |
IndexedDBDatabase::Identifier unique_identifier(origin_identifier, name); |
IndexedDBDatabaseMap::iterator it = database_map_.find(unique_identifier); |
@@ -78,7 +82,8 @@ void IndexedDBFactory::DeleteDatabase( |
// TODO(dgrogan): Plumb data_loss back to script eventually? |
WebKit::WebIDBCallbacks::DataLoss data_loss; |
scoped_refptr<IndexedDBBackingStore> backing_store = |
- OpenBackingStore(origin_identifier, data_directory, &data_loss); |
+ OpenBackingStore(origin_identifier, data_directory, request_context, |
+ &data_loss, task_runner); |
if (!backing_store) { |
callbacks->OnError( |
IndexedDBDatabaseError(WebKit::WebIDBDatabaseExceptionUnknownError, |
@@ -107,7 +112,9 @@ void IndexedDBFactory::DeleteDatabase( |
scoped_refptr<IndexedDBBackingStore> IndexedDBFactory::OpenBackingStore( |
const std::string& origin_identifier, |
const base::FilePath& data_directory, |
- WebKit::WebIDBCallbacks::DataLoss* data_loss) { |
+ net::URLRequestContext* request_context, |
+ WebKit::WebIDBCallbacks::DataLoss* data_loss, |
+ base::TaskRunner* task_runner) { |
const std::string file_identifier = ComputeFileIdentifier(origin_identifier); |
const bool open_in_memory = data_directory.empty(); |
@@ -117,14 +124,20 @@ scoped_refptr<IndexedDBBackingStore> IndexedDBFactory::OpenBackingStore( |
return it2->second.get(); |
scoped_refptr<IndexedDBBackingStore> backing_store; |
+ bool first_time = false; |
if (open_in_memory) { |
+ // TODO(ericu): Support blobs in in-memory backends. |
backing_store = IndexedDBBackingStore::OpenInMemory(file_identifier); |
} else { |
+ first_time = !backends_opened_since_boot_.count(file_identifier); |
backing_store = IndexedDBBackingStore::Open( |
- origin_identifier, data_directory, file_identifier, data_loss); |
+ origin_identifier, data_directory, file_identifier, request_context, |
+ data_loss, task_runner, first_time); |
} |
if (backing_store.get()) { |
+ if (first_time) |
+ backends_opened_since_boot_.insert(file_identifier); |
CleanWeakMap(&backing_store_map_); |
backing_store_map_[file_identifier] = backing_store->GetWeakPtr(); |
// If an in-memory database, bind lifetime to this factory instance. |
@@ -144,11 +157,14 @@ scoped_refptr<IndexedDBBackingStore> IndexedDBFactory::OpenBackingStore( |
void IndexedDBFactory::Open( |
const string16& name, |
int64 version, |
+ net::URLRequestContext* request_context, |
int64 transaction_id, |
scoped_refptr<IndexedDBCallbacks> callbacks, |
scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks, |
const std::string& origin_identifier, |
- const base::FilePath& data_directory) { |
+ const base::FilePath& data_directory, |
+ int child_process_id, |
+ base::TaskRunner* task_runner) { |
IDB_TRACE("IndexedDBFactory::Open"); |
scoped_refptr<IndexedDBDatabase> database; |
IndexedDBDatabase::Identifier unique_identifier(origin_identifier, name); |
@@ -157,7 +173,8 @@ void IndexedDBFactory::Open( |
WebKit::WebIDBCallbacks::DataLossNone; |
if (it == database_map_.end()) { |
scoped_refptr<IndexedDBBackingStore> backing_store = |
- OpenBackingStore(origin_identifier, data_directory, &data_loss); |
+ OpenBackingStore(origin_identifier, data_directory, request_context, |
+ &data_loss, task_runner); |
if (!backing_store) { |
callbacks->OnError(IndexedDBDatabaseError( |
WebKit::WebIDBDatabaseExceptionUnknownError, |
@@ -182,7 +199,8 @@ void IndexedDBFactory::Open( |
} |
database->OpenConnection( |
- callbacks, database_callbacks, transaction_id, version, data_loss); |
+ callbacks, database_callbacks, child_process_id, transaction_id, version, |
+ data_loss); |
} |
std::vector<IndexedDBDatabase*> IndexedDBFactory::GetOpenDatabasesForOrigin( |