summaryrefslogtreecommitdiffstats
path: root/WebCore/storage/Database.cpp
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-07-22 15:37:06 +0100
committerBen Murdoch <benm@google.com>2010-07-27 10:20:25 +0100
commit967717af5423377c967781471ee106e2bb4e11c8 (patch)
tree1e701dc0a12f7f07cce1df4a7681717de77a211b /WebCore/storage/Database.cpp
parentdcc30a9fca45f634b1d3a12b276d3a0ccce99fc3 (diff)
downloadexternal_webkit-967717af5423377c967781471ee106e2bb4e11c8.zip
external_webkit-967717af5423377c967781471ee106e2bb4e11c8.tar.gz
external_webkit-967717af5423377c967781471ee106e2bb4e11c8.tar.bz2
Merge WebKit at r63859 : Initial merge by git.
Change-Id: Ie8096c63ec7c991c9a9cba8bdd9c3b74a3b8ed62
Diffstat (limited to 'WebCore/storage/Database.cpp')
-rw-r--r--WebCore/storage/Database.cpp33
1 files changed, 18 insertions, 15 deletions
diff --git a/WebCore/storage/Database.cpp b/WebCore/storage/Database.cpp
index 30087ee..69f5036 100644
--- a/WebCore/storage/Database.cpp
+++ b/WebCore/storage/Database.cpp
@@ -36,7 +36,6 @@
#include "DatabaseThread.h"
#include "DatabaseTracker.h"
#include "Document.h"
-#include "ExceptionCode.h"
#include "InspectorController.h"
#include "Logging.h"
#include "NotImplemented.h"
@@ -141,25 +140,37 @@ Database::Database(ScriptExecutionContext* context, const String& name, const St
class DerefContextTask : public ScriptExecutionContext::Task {
public:
- static PassOwnPtr<DerefContextTask> create()
+ static PassOwnPtr<DerefContextTask> create(PassRefPtr<ScriptExecutionContext> context)
{
- return new DerefContextTask();
+ return new DerefContextTask(context);
}
virtual void performTask(ScriptExecutionContext* context)
{
- context->deref();
+ ASSERT_UNUSED(context, context == m_context);
+ m_context.clear();
}
virtual bool isCleanupTask() const { return true; }
+
+private:
+ DerefContextTask(PassRefPtr<ScriptExecutionContext> context)
+ : m_context(context)
+ {
+ }
+
+ RefPtr<ScriptExecutionContext> m_context;
};
Database::~Database()
{
// The reference to the ScriptExecutionContext needs to be cleared on the JavaScript thread. If we're on that thread already, we can just let the RefPtr's destruction do the dereffing.
if (!m_scriptExecutionContext->isContextThread()) {
- m_scriptExecutionContext->postTask(DerefContextTask::create());
- m_scriptExecutionContext.release().releaseRef();
+ // Grab a pointer to the script execution here because we're releasing it when we pass it to
+ // DerefContextTask::create.
+ ScriptExecutionContext* scriptExecutionContext = m_scriptExecutionContext.get();
+
+ scriptExecutionContext->postTask(DerefContextTask::create(m_scriptExecutionContext.release()));
}
}
@@ -336,7 +347,7 @@ Vector<String> Database::performGetTableNames()
{
disableAuthorizer();
- SQLiteStatement statement(m_sqliteDatabase, "SELECT name FROM sqlite_master WHERE type='table';");
+ SQLiteStatement statement(sqliteDatabase(), "SELECT name FROM sqlite_master WHERE type='table';");
if (statement.prepare() != SQLResultOk) {
LOG_ERROR("Unable to retrieve list of tables for database %s", databaseDebugName().ascii().data());
enableAuthorizer();
@@ -397,14 +408,6 @@ SecurityOrigin* Database::securityOrigin() const
return 0;
}
-void Database::incrementalVacuumIfNeeded()
-{
- int64_t freeSpaceSize = m_sqliteDatabase.freeSpaceSize();
- int64_t totalSize = m_sqliteDatabase.totalSize();
- if (totalSize <= 10 * freeSpaceSize)
- m_sqliteDatabase.runIncrementalVacuumCommand();
-}
-
} // namespace WebCore
#endif // ENABLE(DATABASE)