summaryrefslogtreecommitdiffstats
path: root/WebCore/storage/SQLTransaction.h
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/storage/SQLTransaction.h')
-rw-r--r--WebCore/storage/SQLTransaction.h35
1 files changed, 21 insertions, 14 deletions
diff --git a/WebCore/storage/SQLTransaction.h b/WebCore/storage/SQLTransaction.h
index e77c183..6d6a8d7 100644
--- a/WebCore/storage/SQLTransaction.h
+++ b/WebCore/storage/SQLTransaction.h
@@ -60,34 +60,39 @@ public:
virtual ~SQLTransactionWrapper() { }
virtual bool performPreflight(SQLTransaction*) = 0;
virtual bool performPostflight(SQLTransaction*) = 0;
-
+
virtual SQLError* sqlError() const = 0;
};
class SQLTransaction : public ThreadSafeShared<SQLTransaction> {
public:
- static PassRefPtr<SQLTransaction> create(Database*, PassRefPtr<SQLTransactionCallback>, PassRefPtr<SQLTransactionErrorCallback>, PassRefPtr<VoidCallback>, PassRefPtr<SQLTransactionWrapper>);
+ static PassRefPtr<SQLTransaction> create(Database*, PassRefPtr<SQLTransactionCallback>, PassRefPtr<SQLTransactionErrorCallback>,
+ PassRefPtr<VoidCallback>, PassRefPtr<SQLTransactionWrapper>, bool readOnly = false);
~SQLTransaction();
-
- void executeSQL(const String& sqlStatement, const Vector<SQLValue>& arguments,
+
+ void executeSQL(const String& sqlStatement, const Vector<SQLValue>& arguments,
PassRefPtr<SQLStatementCallback> callback, PassRefPtr<SQLStatementErrorCallback> callbackError, ExceptionCode& e);
-
+
+ void lockAcquired();
bool performNextStep();
void performPendingCallback();
-
+
Database* database() { return m_database.get(); }
+ bool isReadOnly() { return m_readOnly; }
private:
- SQLTransaction(Database*, PassRefPtr<SQLTransactionCallback>, PassRefPtr<SQLTransactionErrorCallback>, PassRefPtr<VoidCallback>, PassRefPtr<SQLTransactionWrapper>);
+ SQLTransaction(Database*, PassRefPtr<SQLTransactionCallback>, PassRefPtr<SQLTransactionErrorCallback>,
+ PassRefPtr<VoidCallback>, PassRefPtr<SQLTransactionWrapper>, bool readOnly);
typedef void (SQLTransaction::*TransactionStepMethod)();
TransactionStepMethod m_nextStep;
-
+
void enqueueStatement(PassRefPtr<SQLStatement>);
-
+
void checkAndHandleClosedDatabase();
-
+
+ void acquireLock();
void openTransactionAndPreflight();
void deliverTransactionCallback();
void scheduleToRunStatements();
@@ -109,9 +114,9 @@ private:
#endif
RefPtr<SQLStatement> m_currentStatement;
-
+
bool m_executeSqlAllowed;
-
+
RefPtr<Database> m_database;
RefPtr<SQLTransactionWrapper> m_wrapper;
RefPtr<SQLTransactionCallback> m_callback;
@@ -120,13 +125,15 @@ private:
RefPtr<SQLError> m_transactionError;
bool m_shouldRetryCurrentStatement;
bool m_modifiedDatabase;
-
+ bool m_lockAcquired;
+ bool m_readOnly;
+
Mutex m_statementMutex;
Deque<RefPtr<SQLStatement> > m_statementQueue;
OwnPtr<SQLiteTransaction> m_sqliteTransaction;
};
-
+
} // namespace WebCore
#endif