| 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 if (transaction->isVersionChange()) { | 149 if (transaction->isVersionChange()) { |
| 150 DCHECK(!m_versionChangeTransaction); | 150 DCHECK(!m_versionChangeTransaction); |
| 151 m_versionChangeTransaction = transaction; | 151 m_versionChangeTransaction = transaction; |
| 152 } | 152 } |
| 153 } | 153 } |
| 154 | 154 |
| 155 void IDBDatabase::transactionFinished(const IDBTransaction* transaction) { | 155 void IDBDatabase::transactionFinished(const IDBTransaction* transaction) { |
| 156 DCHECK(transaction); | 156 DCHECK(transaction); |
| 157 DCHECK(m_transactions.contains(transaction->id())); | 157 DCHECK(m_transactions.contains(transaction->id())); |
| 158 DCHECK_EQ(m_transactions.get(transaction->id()), transaction); | 158 DCHECK_EQ(m_transactions.get(transaction->id()), transaction); |
| 159 m_transactions.remove(transaction->id()); | 159 m_transactions.erase(transaction->id()); |
| 160 | 160 |
| 161 if (transaction->isVersionChange()) { | 161 if (transaction->isVersionChange()) { |
| 162 DCHECK_EQ(m_versionChangeTransaction, transaction); | 162 DCHECK_EQ(m_versionChangeTransaction, transaction); |
| 163 m_versionChangeTransaction = nullptr; | 163 m_versionChangeTransaction = nullptr; |
| 164 } | 164 } |
| 165 | 165 |
| 166 if (m_closePending && m_transactions.isEmpty()) | 166 if (m_closePending && m_transactions.isEmpty()) |
| 167 closeConnection(); | 167 closeConnection(); |
| 168 } | 168 } |
| 169 | 169 |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 } | 341 } |
| 342 | 342 |
| 343 if (!m_backend) { | 343 if (!m_backend) { |
| 344 exceptionState.throwDOMException(InvalidStateError, | 344 exceptionState.throwDOMException(InvalidStateError, |
| 345 IDBDatabase::databaseClosedErrorMessage); | 345 IDBDatabase::databaseClosedErrorMessage); |
| 346 return; | 346 return; |
| 347 } | 347 } |
| 348 | 348 |
| 349 m_backend->deleteObjectStore(m_versionChangeTransaction->id(), objectStoreId); | 349 m_backend->deleteObjectStore(m_versionChangeTransaction->id(), objectStoreId); |
| 350 m_versionChangeTransaction->objectStoreDeleted(objectStoreId, name); | 350 m_versionChangeTransaction->objectStoreDeleted(objectStoreId, name); |
| 351 m_metadata.objectStores.remove(objectStoreId); | 351 m_metadata.objectStores.erase(objectStoreId); |
| 352 } | 352 } |
| 353 | 353 |
| 354 IDBTransaction* IDBDatabase::transaction( | 354 IDBTransaction* IDBDatabase::transaction( |
| 355 ScriptState* scriptState, | 355 ScriptState* scriptState, |
| 356 const StringOrStringSequenceOrDOMStringList& storeNames, | 356 const StringOrStringSequenceOrDOMStringList& storeNames, |
| 357 const String& modeString, | 357 const String& modeString, |
| 358 ExceptionState& exceptionState) { | 358 ExceptionState& exceptionState) { |
| 359 IDB_TRACE("IDBDatabase::transaction"); | 359 IDB_TRACE("IDBDatabase::transaction"); |
| 360 recordApiCallsHistogram(IDBTransactionCall); | 360 recordApiCallsHistogram(IDBTransactionCall); |
| 361 | 361 |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 } | 546 } |
| 547 | 547 |
| 548 void IDBDatabase::revertObjectStoreCreation(int64_t objectStoreId) { | 548 void IDBDatabase::revertObjectStoreCreation(int64_t objectStoreId) { |
| 549 DCHECK(m_versionChangeTransaction) << "Object store metadata reverted on " | 549 DCHECK(m_versionChangeTransaction) << "Object store metadata reverted on " |
| 550 "database without a versionchange " | 550 "database without a versionchange " |
| 551 "transaction"; | 551 "transaction"; |
| 552 DCHECK(!m_versionChangeTransaction->isActive()) | 552 DCHECK(!m_versionChangeTransaction->isActive()) |
| 553 << "Object store metadata reverted when versionchange transaction is " | 553 << "Object store metadata reverted when versionchange transaction is " |
| 554 "still active"; | 554 "still active"; |
| 555 DCHECK(m_metadata.objectStores.contains(objectStoreId)); | 555 DCHECK(m_metadata.objectStores.contains(objectStoreId)); |
| 556 m_metadata.objectStores.remove(objectStoreId); | 556 m_metadata.objectStores.erase(objectStoreId); |
| 557 } | 557 } |
| 558 | 558 |
| 559 void IDBDatabase::revertObjectStoreMetadata( | 559 void IDBDatabase::revertObjectStoreMetadata( |
| 560 RefPtr<IDBObjectStoreMetadata> oldMetadata) { | 560 RefPtr<IDBObjectStoreMetadata> oldMetadata) { |
| 561 DCHECK(m_versionChangeTransaction) << "Object store metadata reverted on " | 561 DCHECK(m_versionChangeTransaction) << "Object store metadata reverted on " |
| 562 "database without a versionchange " | 562 "database without a versionchange " |
| 563 "transaction"; | 563 "transaction"; |
| 564 DCHECK(!m_versionChangeTransaction->isActive()) | 564 DCHECK(!m_versionChangeTransaction->isActive()) |
| 565 << "Object store metadata reverted when versionchange transaction is " | 565 << "Object store metadata reverted when versionchange transaction is " |
| 566 "still active"; | 566 "still active"; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 | 598 |
| 599 void IDBDatabase::recordApiCallsHistogram(IndexedDatabaseMethods method) { | 599 void IDBDatabase::recordApiCallsHistogram(IndexedDatabaseMethods method) { |
| 600 DEFINE_THREAD_SAFE_STATIC_LOCAL( | 600 DEFINE_THREAD_SAFE_STATIC_LOCAL( |
| 601 EnumerationHistogram, apiCallsHistogram, | 601 EnumerationHistogram, apiCallsHistogram, |
| 602 new EnumerationHistogram("WebCore.IndexedDB.FrontEndAPICalls", | 602 new EnumerationHistogram("WebCore.IndexedDB.FrontEndAPICalls", |
| 603 IDBMethodsMax)); | 603 IDBMethodsMax)); |
| 604 apiCallsHistogram.count(method); | 604 apiCallsHistogram.count(method); |
| 605 } | 605 } |
| 606 | 606 |
| 607 } // namespace blink | 607 } // namespace blink |
| OLD | NEW |