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

Unified Diff: WebCore/storage/Database.cpp

Issue 596028: Make the DatabaseTracker thread-safe. (Closed) Base URL: http://svn.webkit.org/repository/webkit/trunk/
Patch Set: '' Created 10 years, 10 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
« no previous file with comments | « WebCore/storage/Database.h ('k') | WebCore/storage/DatabaseTask.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: WebCore/storage/Database.cpp
===================================================================
--- WebCore/storage/Database.cpp (revision 55036)
+++ WebCore/storage/Database.cpp (working copy)
@@ -352,6 +352,10 @@
m_scriptExecutionContext->databaseThread()->scheduleImmediateTask(task.release());
synchronizer.waitForTaskCompletion();
+
+ // DatabaseCloseTask tells Database::close not to do this, so that we can get it over with here.
+ m_scriptExecutionContext->removeOpenDatabase(this);
+ DatabaseTracker::tracker().removeOpenDatabase(this);
}
class ContextRemoveOpenDatabaseTask : public ScriptExecutionContext::Task {
@@ -378,7 +382,7 @@
RefPtr<Database> m_database;
};
-void Database::close()
+void Database::close(bool removeDatabaseFromContext)
{
RefPtr<Database> protect = this;
@@ -407,7 +411,10 @@
}
m_scriptExecutionContext->databaseThread()->unscheduleDatabaseTasks(this);
- m_scriptExecutionContext->postTask(ContextRemoveOpenDatabaseTask::create(this));
+ // In some cases the context initiated this call, so it'll take care of the cleanup by itself, synchronously. This lets it make sure that the
+ // cleanup completes by a given time.
+ if (removeDatabaseFromContext)
+ m_scriptExecutionContext->postTask(ContextRemoveOpenDatabaseTask::create(this));
}
void Database::stop()
« no previous file with comments | « WebCore/storage/Database.h ('k') | WebCore/storage/DatabaseTask.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698