summaryrefslogtreecommitdiffstats
path: root/WebCore/storage/Database.h
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/storage/Database.h')
-rw-r--r--WebCore/storage/Database.h88
1 files changed, 15 insertions, 73 deletions
diff --git a/WebCore/storage/Database.h b/WebCore/storage/Database.h
index 495f98f..22ef55e 100644
--- a/WebCore/storage/Database.h
+++ b/WebCore/storage/Database.h
@@ -33,18 +33,13 @@
#include "AbstractDatabase.h"
#include "PlatformString.h"
#include "SQLiteDatabase.h"
-#ifndef NDEBUG
-#include "SecurityOrigin.h"
-#endif
#include <wtf/Deque.h>
#include <wtf/Forward.h>
namespace WebCore {
-class DatabaseAuthorizer;
class DatabaseCallback;
-class DatabaseThread;
class ScriptExecutionContext;
class SecurityOrigin;
class SQLTransaction;
@@ -54,8 +49,6 @@ class SQLTransactionCoordinator;
class SQLTransactionErrorCallback;
class VoidCallback;
-typedef int ExceptionCode;
-
class Database : public AbstractDatabase {
public:
virtual ~Database();
@@ -63,113 +56,62 @@ public:
// Direct support for the DOM API
static PassRefPtr<Database> openDatabase(ScriptExecutionContext*, const String& name, const String& expectedVersion, const String& displayName,
unsigned long estimatedSize, PassRefPtr<DatabaseCallback>, ExceptionCode&);
- String version() const;
+ virtual String version() const;
void changeVersion(const String& oldVersion, const String& newVersion, PassRefPtr<SQLTransactionCallback>,
PassRefPtr<SQLTransactionErrorCallback>, PassRefPtr<VoidCallback> successCallback);
void transaction(PassRefPtr<SQLTransactionCallback>, PassRefPtr<SQLTransactionErrorCallback>,
PassRefPtr<VoidCallback> successCallback, bool readOnly);
// Internal engine support
- static const String& databaseInfoTableName();
-
- void disableAuthorizer();
- void enableAuthorizer();
- void setAuthorizerReadOnly();
- bool lastActionChangedDatabase();
- bool lastActionWasInsert();
- void resetDeletes();
- bool hadDeletes();
-
Vector<String> tableNames();
- virtual ScriptExecutionContext* scriptExecutionContext() const { return m_scriptExecutionContext.get(); }
virtual SecurityOrigin* securityOrigin() const;
SQLiteDatabase& sqliteDatabase() { return m_sqliteDatabase; }
- virtual String stringIdentifier() const;
- virtual String displayName() const;
- virtual unsigned long estimatedSize() const;
- virtual String fileName() const;
-
- bool getVersionFromDatabase(String&);
- bool setVersionInDatabase(const String&);
- void setExpectedVersion(const String&);
- bool versionMatchesExpected() const;
virtual void markAsDeletedAndClose();
bool deleted() const { return m_deleted; }
- enum ClosePolicy { DoNotRemoveDatabaseFromContext, RemoveDatabaseFromContext };
- void close(ClosePolicy);
+ void close();
virtual void closeImmediately();
- bool opened() const { return m_opened; }
-
- void stop();
- bool stopped() const { return m_stopped; }
-
- bool isNew() const { return m_new; }
unsigned long long databaseSize() const;
unsigned long long maximumSize() const;
- // Called from DatabaseThread, must be prepared to work on the background thread
- void resetAuthorizer();
- void performPolicyChecks();
-
- bool performOpenAndVerify(ExceptionCode&);
-
- void inProgressTransactionCompleted();
void scheduleTransactionCallback(SQLTransaction*);
void scheduleTransactionStep(SQLTransaction*, bool immediately = false);
- Vector<String> performGetTableNames();
- void performCreationCallback();
-
SQLTransactionClient* transactionClient() const;
SQLTransactionCoordinator* transactionCoordinator() const;
void incrementalVacuumIfNeeded();
private:
+ class DatabaseOpenTask;
+ class DatabaseCloseTask;
+ class DatabaseTransactionTask;
+ class DatabaseTableNamesTask;
+
Database(ScriptExecutionContext*, const String& name, const String& expectedVersion,
- const String& displayName, unsigned long estimatedSize, PassRefPtr<DatabaseCallback>);
+ const String& displayName, unsigned long estimatedSize);
- bool openAndVerifyVersion(ExceptionCode&);
+ bool openAndVerifyVersion(bool setVersionInNewDatabase, ExceptionCode&);
+ virtual bool performOpenAndVerify(bool setVersionInNewDatabase, ExceptionCode&);
+ void inProgressTransactionCompleted();
void scheduleTransaction();
+ Vector<String> performGetTableNames();
+
+ static void deliverPendingCallback(void*);
+
Deque<RefPtr<SQLTransaction> > m_transactionQueue;
Mutex m_transactionInProgressMutex;
bool m_transactionInProgress;
bool m_isTransactionQueueEnabled;
- static void deliverPendingCallback(void*);
-
- RefPtr<ScriptExecutionContext> m_scriptExecutionContext;
- RefPtr<SecurityOrigin> m_contextThreadSecurityOrigin;
RefPtr<SecurityOrigin> m_databaseThreadSecurityOrigin;
- String m_name;
- int m_guid;
- String m_expectedVersion;
- String m_displayName;
- unsigned long m_estimatedSize;
- String m_filename;
bool m_deleted;
-
- bool m_stopped;
-
- bool m_opened;
-
- bool m_new;
-
- SQLiteDatabase m_sqliteDatabase;
- RefPtr<DatabaseAuthorizer> m_databaseAuthorizer;
-
- RefPtr<DatabaseCallback> m_creationCallback;
-
-#ifndef NDEBUG
- String databaseDebugName() const { return m_contextThreadSecurityOrigin->toString() + "::" + m_name; }
-#endif
};
} // namespace WebCore