| 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 | 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 if (!m_backend) { | 288 if (!m_backend) { |
| 289 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas
eClosedErrorMessage); | 289 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas
eClosedErrorMessage); |
| 290 return; | 290 return; |
| 291 } | 291 } |
| 292 | 292 |
| 293 m_backend->deleteObjectStore(m_versionChangeTransaction->id(), objectStoreId
); | 293 m_backend->deleteObjectStore(m_versionChangeTransaction->id(), objectStoreId
); |
| 294 m_versionChangeTransaction->objectStoreDeleted(name); | 294 m_versionChangeTransaction->objectStoreDeleted(name); |
| 295 m_metadata.objectStores.remove(objectStoreId); | 295 m_metadata.objectStores.remove(objectStoreId); |
| 296 } | 296 } |
| 297 | 297 |
| 298 IDBTransaction* IDBDatabase::transaction(ExecutionContext* context, const Vector
<String>& scope, const String& modeString, ExceptionState& exceptionState) | 298 IDBTransaction* IDBDatabase::transaction(ScriptState* scriptState, const Vector<
String>& scope, const String& modeString, ExceptionState& exceptionState) |
| 299 { | 299 { |
| 300 IDB_TRACE("IDBDatabase::transaction"); | 300 IDB_TRACE("IDBDatabase::transaction"); |
| 301 Platform::current()->histogramEnumeration("WebCore.IndexedDB.FrontEndAPICall
s", IDBTransactionCall, IDBMethodsMax); | 301 Platform::current()->histogramEnumeration("WebCore.IndexedDB.FrontEndAPICall
s", IDBTransactionCall, IDBMethodsMax); |
| 302 if (!scope.size()) { | 302 if (!scope.size()) { |
| 303 exceptionState.throwDOMException(InvalidAccessError, "The storeNames par
ameter was empty."); | 303 exceptionState.throwDOMException(InvalidAccessError, "The storeNames par
ameter was empty."); |
| 304 return 0; | 304 return 0; |
| 305 } | 305 } |
| 306 | 306 |
| 307 WebIDBTransactionMode mode = IDBTransaction::stringToMode(modeString, except
ionState); | 307 WebIDBTransactionMode mode = IDBTransaction::stringToMode(modeString, except
ionState); |
| 308 if (exceptionState.hadException()) | 308 if (exceptionState.hadException()) |
| (...skipping 20 matching lines...) Expand all Loading... |
| 329 } | 329 } |
| 330 | 330 |
| 331 if (!m_backend) { | 331 if (!m_backend) { |
| 332 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas
eClosedErrorMessage); | 332 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas
eClosedErrorMessage); |
| 333 return 0; | 333 return 0; |
| 334 } | 334 } |
| 335 | 335 |
| 336 int64_t transactionId = nextTransactionId(); | 336 int64_t transactionId = nextTransactionId(); |
| 337 m_backend->createTransaction(transactionId, WebIDBDatabaseCallbacksImpl::cre
ate(m_databaseCallbacks).leakPtr(), objectStoreIds, mode); | 337 m_backend->createTransaction(transactionId, WebIDBDatabaseCallbacksImpl::cre
ate(m_databaseCallbacks).leakPtr(), objectStoreIds, mode); |
| 338 | 338 |
| 339 return IDBTransaction::create(context, transactionId, scope, mode, this); | 339 return IDBTransaction::create(scriptState, transactionId, scope, mode, this)
; |
| 340 } | 340 } |
| 341 | 341 |
| 342 IDBTransaction* IDBDatabase::transaction(ExecutionContext* context, const String
& storeName, const String& mode, ExceptionState& exceptionState) | 342 IDBTransaction* IDBDatabase::transaction(ScriptState* scriptState, const String&
storeName, const String& mode, ExceptionState& exceptionState) |
| 343 { | 343 { |
| 344 RefPtrWillBeRawPtr<DOMStringList> storeNames = DOMStringList::create(); | 344 RefPtrWillBeRawPtr<DOMStringList> storeNames = DOMStringList::create(); |
| 345 storeNames->append(storeName); | 345 storeNames->append(storeName); |
| 346 return transaction(context, storeNames, mode, exceptionState); | 346 return transaction(scriptState, storeNames, mode, exceptionState); |
| 347 } | 347 } |
| 348 | 348 |
| 349 void IDBDatabase::forceClose() | 349 void IDBDatabase::forceClose() |
| 350 { | 350 { |
| 351 for (TransactionMap::const_iterator::Values it = m_transactions.begin().valu
es(), end = m_transactions.end().values(); it != end; ++it) | 351 for (TransactionMap::const_iterator::Values it = m_transactions.begin().valu
es(), end = m_transactions.end().values(); it != end; ++it) |
| 352 (*it)->abort(IGNORE_EXCEPTION); | 352 (*it)->abort(IGNORE_EXCEPTION); |
| 353 this->close(); | 353 this->close(); |
| 354 enqueueEvent(Event::create(EventTypeNames::close)); | 354 enqueueEvent(Event::create(EventTypeNames::close)); |
| 355 } | 355 } |
| 356 | 356 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 { | 470 { |
| 471 return EventTargetNames::IDBDatabase; | 471 return EventTargetNames::IDBDatabase; |
| 472 } | 472 } |
| 473 | 473 |
| 474 ExecutionContext* IDBDatabase::executionContext() const | 474 ExecutionContext* IDBDatabase::executionContext() const |
| 475 { | 475 { |
| 476 return ActiveDOMObject::executionContext(); | 476 return ActiveDOMObject::executionContext(); |
| 477 } | 477 } |
| 478 | 478 |
| 479 } // namespace blink | 479 } // namespace blink |
| OLD | NEW |