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

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

Issue 203833003: Add the IndexedDBActiveBlobRegistry, currently unused, to enable future blob (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix override mismatch Created 6 years, 9 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 113060324000d267ae647109e0215af3bb4c417f..e3a415a683a0cac066880140ba2b43eabb75aa3b 100644
--- a/content/browser/indexed_db/indexed_db_factory.cc
+++ b/content/browser/indexed_db/indexed_db_factory.cc
@@ -60,6 +60,15 @@ void IndexedDBFactory::ReleaseDatabase(
void IndexedDBFactory::ReleaseBackingStore(const GURL& origin_url,
bool immediate) {
+ if (immediate) {
+ IndexedDBBackingStoreMap::iterator it =
+ backing_stores_with_active_blobs_.find(origin_url);
+ if (it != backing_stores_with_active_blobs_.end()) {
+ it->second->active_blob_registry()->ForceShutdown();
+ backing_stores_with_active_blobs_.erase(it);
+ }
+ }
+
// Only close if this is the last reference.
if (!HasLastBackingStoreReference(origin_url))
return;
@@ -134,9 +143,31 @@ void IndexedDBFactory::ContextDestroyed() {
++it)
it->second->close_timer()->Stop();
backing_store_map_.clear();
+ backing_stores_with_active_blobs_.clear();
context_ = NULL;
}
+void IndexedDBFactory::ReportOutstandingBlobs(const GURL& origin_url,
+ bool blobs_outstanding) {
+ if (!context_)
+ return;
+ if (blobs_outstanding) {
+ DCHECK(!backing_stores_with_active_blobs_.count(origin_url));
+ IndexedDBBackingStoreMap::iterator it = backing_store_map_.find(origin_url);
+ if (it != backing_store_map_.end())
+ backing_stores_with_active_blobs_.insert(*it);
+ else
+ DCHECK(false);
+ } else {
+ IndexedDBBackingStoreMap::iterator it =
+ backing_stores_with_active_blobs_.find(origin_url);
+ if (it != backing_stores_with_active_blobs_.end()) {
+ backing_stores_with_active_blobs_.erase(it);
+ ReleaseBackingStore(origin_url, false /* immediate */);
+ }
+ }
+}
+
void IndexedDBFactory::GetDatabaseNames(
scoped_refptr<IndexedDBCallbacks> callbacks,
const GURL& origin_url,
@@ -288,13 +319,16 @@ scoped_refptr<IndexedDBBackingStore> IndexedDBFactory::OpenBackingStore(
scoped_refptr<IndexedDBBackingStore> backing_store;
if (open_in_memory) {
- backing_store = IndexedDBBackingStore::OpenInMemory(origin_url);
+ backing_store =
+ IndexedDBBackingStore::OpenInMemory(origin_url, context_->TaskRunner());
} else {
- backing_store = IndexedDBBackingStore::Open(origin_url,
+ backing_store = IndexedDBBackingStore::Open(this,
+ origin_url,
data_directory,
data_loss,
data_loss_message,
- disk_full);
+ disk_full,
+ context_->TaskRunner());
}
if (backing_store.get()) {
« no previous file with comments | « content/browser/indexed_db/indexed_db_factory.h ('k') | content/browser/indexed_db/indexed_db_factory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698