| 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()
|
|
|