| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 DatabaseSync::~DatabaseSync() | 66 DatabaseSync::~DatabaseSync() |
| 67 { | 67 { |
| 68 ASSERT(m_executionContext->isContextThread()); | 68 ASSERT(m_executionContext->isContextThread()); |
| 69 } | 69 } |
| 70 | 70 |
| 71 PassRefPtr<DatabaseBackendSync> DatabaseSync::backend() | 71 PassRefPtr<DatabaseBackendSync> DatabaseSync::backend() |
| 72 { | 72 { |
| 73 return this; | 73 return this; |
| 74 } | 74 } |
| 75 | 75 |
| 76 void DatabaseSync::changeVersion(const String& oldVersion, const String& newVers
ion, PassRefPtr<SQLTransactionSyncCallback> changeVersionCallback, ExceptionStat
e& exceptionState) | 76 void DatabaseSync::changeVersion(const String& oldVersion, const String& newVers
ion, PassOwnPtr<SQLTransactionSyncCallback> changeVersionCallback, ExceptionStat
e& exceptionState) |
| 77 { | 77 { |
| 78 ASSERT(m_executionContext->isContextThread()); | 78 ASSERT(m_executionContext->isContextThread()); |
| 79 | 79 |
| 80 if (sqliteDatabase().transactionInProgress()) { | 80 if (sqliteDatabase().transactionInProgress()) { |
| 81 reportChangeVersionResult(1, SQLError::DATABASE_ERR, 0); | 81 reportChangeVersionResult(1, SQLError::DATABASE_ERR, 0); |
| 82 setLastErrorMessage("unable to changeVersion from within a transaction")
; | 82 setLastErrorMessage("unable to changeVersion from within a transaction")
; |
| 83 exceptionState.throwUninformativeAndGenericDOMException(SQLDatabaseError
); | 83 exceptionState.throwUninformativeAndGenericDOMException(SQLDatabaseError
); |
| 84 return; | 84 return; |
| 85 } | 85 } |
| 86 | 86 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 setCachedVersion(oldVersion); | 126 setCachedVersion(oldVersion); |
| 127 return; | 127 return; |
| 128 } | 128 } |
| 129 | 129 |
| 130 reportChangeVersionResult(0, -1, 0); // OK | 130 reportChangeVersionResult(0, -1, 0); // OK |
| 131 | 131 |
| 132 setExpectedVersion(newVersion); | 132 setExpectedVersion(newVersion); |
| 133 setLastErrorMessage(""); | 133 setLastErrorMessage(""); |
| 134 } | 134 } |
| 135 | 135 |
| 136 void DatabaseSync::transaction(PassRefPtr<SQLTransactionSyncCallback> callback,
ExceptionState& exceptionState) | 136 void DatabaseSync::transaction(PassOwnPtr<SQLTransactionSyncCallback> callback,
ExceptionState& exceptionState) |
| 137 { | 137 { |
| 138 runTransaction(callback, false, exceptionState); | 138 runTransaction(callback, false, exceptionState); |
| 139 } | 139 } |
| 140 | 140 |
| 141 void DatabaseSync::readTransaction(PassRefPtr<SQLTransactionSyncCallback> callba
ck, ExceptionState& exceptionState) | 141 void DatabaseSync::readTransaction(PassOwnPtr<SQLTransactionSyncCallback> callba
ck, ExceptionState& exceptionState) |
| 142 { | 142 { |
| 143 runTransaction(callback, true, exceptionState); | 143 runTransaction(callback, true, exceptionState); |
| 144 } | 144 } |
| 145 | 145 |
| 146 void DatabaseSync::rollbackTransaction(PassRefPtr<SQLTransactionSync> transactio
n) | 146 void DatabaseSync::rollbackTransaction(PassRefPtr<SQLTransactionSync> transactio
n) |
| 147 { | 147 { |
| 148 ASSERT(!lastErrorMessage().isEmpty()); | 148 ASSERT(!lastErrorMessage().isEmpty()); |
| 149 transaction->rollback(); | 149 transaction->rollback(); |
| 150 setLastErrorMessage(""); | 150 setLastErrorMessage(""); |
| 151 return; | 151 return; |
| 152 } | 152 } |
| 153 | 153 |
| 154 void DatabaseSync::runTransaction(PassRefPtr<SQLTransactionSyncCallback> callbac
k, bool readOnly, ExceptionState& exceptionState) | 154 void DatabaseSync::runTransaction(PassOwnPtr<SQLTransactionSyncCallback> callbac
k, bool readOnly, ExceptionState& exceptionState) |
| 155 { | 155 { |
| 156 ASSERT(m_executionContext->isContextThread()); | 156 ASSERT(m_executionContext->isContextThread()); |
| 157 | 157 |
| 158 if (sqliteDatabase().transactionInProgress()) { | 158 if (sqliteDatabase().transactionInProgress()) { |
| 159 setLastErrorMessage("unable to start a transaction from within a transac
tion"); | 159 setLastErrorMessage("unable to start a transaction from within a transac
tion"); |
| 160 exceptionState.throwUninformativeAndGenericDOMException(SQLDatabaseError
); | 160 exceptionState.throwUninformativeAndGenericDOMException(SQLDatabaseError
); |
| 161 return; | 161 return; |
| 162 } | 162 } |
| 163 | 163 |
| 164 RefPtr<SQLTransactionSync> transaction = SQLTransactionSync::create(this, ca
llback, readOnly); | 164 RefPtr<SQLTransactionSync> transaction = SQLTransactionSync::create(this, ca
llback, readOnly); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 188 ASSERT(m_executionContext->isContextThread()); | 188 ASSERT(m_executionContext->isContextThread()); |
| 189 | 189 |
| 190 if (!opened()) | 190 if (!opened()) |
| 191 return; | 191 return; |
| 192 | 192 |
| 193 logErrorMessage("forcibly closing database"); | 193 logErrorMessage("forcibly closing database"); |
| 194 closeDatabase(); | 194 closeDatabase(); |
| 195 } | 195 } |
| 196 | 196 |
| 197 } // namespace WebCore | 197 } // namespace WebCore |
| OLD | NEW |