| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2013 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 class SQLTransactionWrapper : public ThreadSafeRefCounted<SQLTransactionWrapper>
{ | 51 class SQLTransactionWrapper : public ThreadSafeRefCounted<SQLTransactionWrapper>
{ |
| 52 public: | 52 public: |
| 53 virtual ~SQLTransactionWrapper() { } | 53 virtual ~SQLTransactionWrapper() { } |
| 54 virtual bool performPreflight(SQLTransactionBackend*) = 0; | 54 virtual bool performPreflight(SQLTransactionBackend*) = 0; |
| 55 virtual bool performPostflight(SQLTransactionBackend*) = 0; | 55 virtual bool performPostflight(SQLTransactionBackend*) = 0; |
| 56 virtual SQLError* sqlError() const = 0; | 56 virtual SQLError* sqlError() const = 0; |
| 57 virtual void handleCommitFailedAfterPostflight(SQLTransactionBackend*) = 0; | 57 virtual void handleCommitFailedAfterPostflight(SQLTransactionBackend*) = 0; |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 class SQLTransactionBackend FINAL : public SQLTransactionStateMachine<SQLTransac
tionBackend>, public AbstractSQLTransactionBackend { | 60 class SQLTransactionBackend FINAL : public AbstractSQLTransactionBackend, public
SQLTransactionStateMachine<SQLTransactionBackend> { |
| 61 public: | 61 public: |
| 62 static PassRefPtr<SQLTransactionBackend> create(DatabaseBackend*, | 62 static PassRefPtrWillBeRawPtr<SQLTransactionBackend> create(DatabaseBackend*
, |
| 63 PassRefPtrWillBeRawPtr<AbstractSQLTransaction>, PassRefPtr<SQLTransactio
nWrapper>, bool readOnly); | 63 PassRefPtrWillBeRawPtr<AbstractSQLTransaction>, PassRefPtr<SQLTransactio
nWrapper>, bool readOnly); |
| 64 | 64 |
| 65 virtual ~SQLTransactionBackend(); | 65 virtual ~SQLTransactionBackend(); |
| 66 virtual void trace(Visitor*) OVERRIDE; |
| 66 | 67 |
| 67 void lockAcquired(); | 68 void lockAcquired(); |
| 68 void performNextStep(); | 69 void performNextStep(); |
| 69 | 70 |
| 70 DatabaseBackend* database() { return m_database.get(); } | 71 DatabaseBackend* database() { return m_database.get(); } |
| 71 bool isReadOnly() { return m_readOnly; } | 72 bool isReadOnly() { return m_readOnly; } |
| 72 void notifyDatabaseThreadIsShuttingDown(); | 73 void notifyDatabaseThreadIsShuttingDown(); |
| 73 | 74 |
| 74 private: | 75 private: |
| 75 SQLTransactionBackend(DatabaseBackend*, PassRefPtrWillBeRawPtr<AbstractSQLTr
ansaction>, | 76 SQLTransactionBackend(DatabaseBackend*, PassRefPtrWillBeRawPtr<AbstractSQLTr
ansaction>, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 101 | 102 |
| 102 SQLTransactionState unreachableState(); | 103 SQLTransactionState unreachableState(); |
| 103 SQLTransactionState sendToFrontendState(); | 104 SQLTransactionState sendToFrontendState(); |
| 104 | 105 |
| 105 SQLTransactionState nextStateForCurrentStatementError(); | 106 SQLTransactionState nextStateForCurrentStatementError(); |
| 106 SQLTransactionState nextStateForTransactionError(); | 107 SQLTransactionState nextStateForTransactionError(); |
| 107 SQLTransactionState runCurrentStatementAndGetNextState(); | 108 SQLTransactionState runCurrentStatementAndGetNextState(); |
| 108 | 109 |
| 109 void getNextStatement(); | 110 void getNextStatement(); |
| 110 | 111 |
| 111 RefPtrWillBeCrossThreadPersistent<AbstractSQLTransaction> m_frontend; // Has
a reference cycle, and will break in doCleanup(). | 112 RefPtrWillBeMember<AbstractSQLTransaction> m_frontend; // Has a reference cy
cle, and will break in doCleanup(). |
| 112 RefPtr<SQLStatementBackend> m_currentStatementBackend; | 113 RefPtr<SQLStatementBackend> m_currentStatementBackend; |
| 113 | 114 |
| 114 RefPtrWillBeCrossThreadPersistent<DatabaseBackend> m_database; | 115 RefPtrWillBeMember<DatabaseBackend> m_database; |
| 115 RefPtr<SQLTransactionWrapper> m_wrapper; | 116 RefPtr<SQLTransactionWrapper> m_wrapper; |
| 116 RefPtr<SQLError> m_transactionError; | 117 RefPtr<SQLError> m_transactionError; |
| 117 | 118 |
| 118 bool m_hasCallback; | 119 bool m_hasCallback; |
| 119 bool m_hasSuccessCallback; | 120 bool m_hasSuccessCallback; |
| 120 bool m_hasErrorCallback; | 121 bool m_hasErrorCallback; |
| 121 bool m_shouldRetryCurrentStatement; | 122 bool m_shouldRetryCurrentStatement; |
| 122 bool m_modifiedDatabase; | 123 bool m_modifiedDatabase; |
| 123 bool m_lockAcquired; | 124 bool m_lockAcquired; |
| 124 bool m_readOnly; | 125 bool m_readOnly; |
| 125 bool m_hasVersionMismatch; | 126 bool m_hasVersionMismatch; |
| 126 | 127 |
| 127 Mutex m_statementMutex; | 128 Mutex m_statementMutex; |
| 128 Deque<RefPtr<SQLStatementBackend> > m_statementQueue; | 129 Deque<RefPtr<SQLStatementBackend> > m_statementQueue; |
| 129 | 130 |
| 130 OwnPtr<SQLiteTransaction> m_sqliteTransaction; | 131 OwnPtr<SQLiteTransaction> m_sqliteTransaction; |
| 131 }; | 132 }; |
| 132 | 133 |
| 133 } // namespace WebCore | 134 } // namespace WebCore |
| 134 | 135 |
| 135 #endif // SQLTransactionBackend_h | 136 #endif // SQLTransactionBackend_h |
| OLD | NEW |