Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1220)

Side by Side Diff: Source/modules/webdatabase/SQLTransactionBackendSync.cpp

Issue 24469004: Amusingly deprecate the generic version of 'ExceptionState::throwDOMException'. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * Copyright (C) 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2013 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 m_sqliteTransaction->begin(); 151 m_sqliteTransaction->begin();
152 m_database->enableAuthorizer(); 152 m_database->enableAuthorizer();
153 153
154 // Check if begin() succeeded. 154 // Check if begin() succeeded.
155 if (!m_sqliteTransaction->inProgress()) { 155 if (!m_sqliteTransaction->inProgress()) {
156 ASSERT(!m_database->sqliteDatabase().transactionInProgress()); 156 ASSERT(!m_database->sqliteDatabase().transactionInProgress());
157 m_database->reportStartTransactionResult(2, SQLError::DATABASE_ERR, m_da tabase->sqliteDatabase().lastError()); 157 m_database->reportStartTransactionResult(2, SQLError::DATABASE_ERR, m_da tabase->sqliteDatabase().lastError());
158 m_database->setLastErrorMessage("unable to begin transaction", 158 m_database->setLastErrorMessage("unable to begin transaction",
159 m_database->sqliteDatabase().lastError(), m_database->sqliteDatabase ().lastErrorMsg()); 159 m_database->sqliteDatabase().lastError(), m_database->sqliteDatabase ().lastErrorMsg());
160 m_sqliteTransaction.clear(); 160 m_sqliteTransaction.clear();
161 es.throwDOMException(SQLDatabaseError); 161 es.throwUninformativeAndGenericDOMException(SQLDatabaseError);
162 return; 162 return;
163 } 163 }
164 164
165 // Note: We intentionally retrieve the actual version even with an empty exp ected version. 165 // Note: We intentionally retrieve the actual version even with an empty exp ected version.
166 // In multi-process browsers, we take this opportinutiy to update the cached value for 166 // In multi-process browsers, we take this opportinutiy to update the cached value for
167 // the actual version. In single-process browsers, this is just a map lookup . 167 // the actual version. In single-process browsers, this is just a map lookup .
168 String actualVersion; 168 String actualVersion;
169 if (!m_database->getActualVersionForTransaction(actualVersion)) { 169 if (!m_database->getActualVersionForTransaction(actualVersion)) {
170 m_database->reportStartTransactionResult(3, SQLError::DATABASE_ERR, m_da tabase->sqliteDatabase().lastError()); 170 m_database->reportStartTransactionResult(3, SQLError::DATABASE_ERR, m_da tabase->sqliteDatabase().lastError());
171 m_database->setLastErrorMessage("unable to read version", 171 m_database->setLastErrorMessage("unable to read version",
172 m_database->sqliteDatabase().lastError(), m_database->sqliteDatabase ().lastErrorMsg()); 172 m_database->sqliteDatabase().lastError(), m_database->sqliteDatabase ().lastErrorMsg());
173 rollback(); 173 rollback();
174 es.throwDOMException(SQLDatabaseError); 174 es.throwUninformativeAndGenericDOMException(SQLDatabaseError);
175 return; 175 return;
176 } 176 }
177 m_hasVersionMismatch = !m_database->expectedVersion().isEmpty() && (m_databa se->expectedVersion() != actualVersion); 177 m_hasVersionMismatch = !m_database->expectedVersion().isEmpty() && (m_databa se->expectedVersion() != actualVersion);
178 m_database->reportStartTransactionResult(0, -1, 0); // OK 178 m_database->reportStartTransactionResult(0, -1, 0); // OK
179 } 179 }
180 180
181 void SQLTransactionBackendSync::execute(ExceptionState& es) 181 void SQLTransactionBackendSync::execute(ExceptionState& es)
182 { 182 {
183 ASSERT(m_database->scriptExecutionContext()->isContextThread()); 183 ASSERT(m_database->scriptExecutionContext()->isContextThread());
184 if (!m_database->opened() || (m_callback && !m_callback->handleEvent(SQLTran sactionSync::from(this)))) { 184 if (!m_database->opened() || (m_callback && !m_callback->handleEvent(SQLTran sactionSync::from(this)))) {
(...skipping 21 matching lines...) Expand all
206 206
207 m_database->disableAuthorizer(); 207 m_database->disableAuthorizer();
208 m_sqliteTransaction->commit(); 208 m_sqliteTransaction->commit();
209 m_database->enableAuthorizer(); 209 m_database->enableAuthorizer();
210 210
211 // If the commit failed, the transaction will still be marked as "in progres s" 211 // If the commit failed, the transaction will still be marked as "in progres s"
212 if (m_sqliteTransaction->inProgress()) { 212 if (m_sqliteTransaction->inProgress()) {
213 m_database->reportCommitTransactionResult(2, SQLError::DATABASE_ERR, m_d atabase->sqliteDatabase().lastError()); 213 m_database->reportCommitTransactionResult(2, SQLError::DATABASE_ERR, m_d atabase->sqliteDatabase().lastError());
214 m_database->setLastErrorMessage("unable to commit transaction", 214 m_database->setLastErrorMessage("unable to commit transaction",
215 m_database->sqliteDatabase().lastError(), m_database->sqliteDatabase ().lastErrorMsg()); 215 m_database->sqliteDatabase().lastError(), m_database->sqliteDatabase ().lastErrorMsg());
216 es.throwDOMException(SQLDatabaseError); 216 es.throwUninformativeAndGenericDOMException(SQLDatabaseError);
217 return; 217 return;
218 } 218 }
219 219
220 m_sqliteTransaction.clear(); 220 m_sqliteTransaction.clear();
221 221
222 // Vacuum the database if anything was deleted. 222 // Vacuum the database if anything was deleted.
223 if (m_database->hadDeletes()) 223 if (m_database->hadDeletes())
224 m_database->incrementalVacuumIfNeeded(); 224 m_database->incrementalVacuumIfNeeded();
225 225
226 // The commit was successful. If the transaction modified this database, not ify the delegates. 226 // The commit was successful. If the transaction modified this database, not ify the delegates.
(...skipping 10 matching lines...) Expand all
237 if (m_sqliteTransaction) { 237 if (m_sqliteTransaction) {
238 m_sqliteTransaction->rollback(); 238 m_sqliteTransaction->rollback();
239 m_sqliteTransaction.clear(); 239 m_sqliteTransaction.clear();
240 } 240 }
241 m_database->enableAuthorizer(); 241 m_database->enableAuthorizer();
242 242
243 ASSERT(!m_database->sqliteDatabase().transactionInProgress()); 243 ASSERT(!m_database->sqliteDatabase().transactionInProgress());
244 } 244 }
245 245
246 } // namespace WebCore 246 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/webdatabase/SQLTransaction.cpp ('k') | Source/modules/webdatabase/WorkerGlobalScopeWebDatabase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698