diff options
author | Steve Block <steveblock@google.com> | 2010-07-08 12:51:48 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-07-09 15:33:40 +0100 |
commit | ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24 (patch) | |
tree | bb45155550ec013adc0ad10f4d7d354c6469b022 /WebCore/storage/Database.h | |
parent | d4b24d9a829ed7de70381c8b99fb75a07ab40466 (diff) | |
download | external_webkit-ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24.zip external_webkit-ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24.tar.gz external_webkit-ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24.tar.bz2 |
Merge WebKit at r62496: Initial merge by git
Change-Id: Ie3da0770eca22a70a632e3571f31cfabc80facb2
Diffstat (limited to 'WebCore/storage/Database.h')
-rw-r--r-- | WebCore/storage/Database.h | 88 |
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 |