| 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 ASSERT(m_transactions.contains(transactionId)); | 152 ASSERT(m_transactions.contains(transactionId)); |
| 153 m_transactions.get(transactionId)->onAbort(error); | 153 m_transactions.get(transactionId)->onAbort(error); |
| 154 } | 154 } |
| 155 | 155 |
| 156 void IDBDatabase::onComplete(int64_t transactionId) | 156 void IDBDatabase::onComplete(int64_t transactionId) |
| 157 { | 157 { |
| 158 ASSERT(m_transactions.contains(transactionId)); | 158 ASSERT(m_transactions.contains(transactionId)); |
| 159 m_transactions.get(transactionId)->onComplete(); | 159 m_transactions.get(transactionId)->onComplete(); |
| 160 } | 160 } |
| 161 | 161 |
| 162 PassRefPtrWillBeRawPtr<DOMStringList> IDBDatabase::objectStoreNames() const | 162 RawPtr<DOMStringList> IDBDatabase::objectStoreNames() const |
| 163 { | 163 { |
| 164 RefPtrWillBeRawPtr<DOMStringList> objectStoreNames = DOMStringList::create(D
OMStringList::IndexedDB); | 164 RawPtr<DOMStringList> objectStoreNames = DOMStringList::create(DOMStringList
::IndexedDB); |
| 165 for (const auto& it : m_metadata.objectStores) | 165 for (const auto& it : m_metadata.objectStores) |
| 166 objectStoreNames->append(it.value.name); | 166 objectStoreNames->append(it.value.name); |
| 167 objectStoreNames->sort(); | 167 objectStoreNames->sort(); |
| 168 return objectStoreNames.release(); | 168 return objectStoreNames.release(); |
| 169 } | 169 } |
| 170 | 170 |
| 171 void IDBDatabase::version(UnsignedLongLongOrString& result) const | 171 void IDBDatabase::version(UnsignedLongLongOrString& result) const |
| 172 { | 172 { |
| 173 if (m_metadata.intVersion == IDBDatabaseMetadata::NoIntVersion) | 173 if (m_metadata.intVersion == IDBDatabaseMetadata::NoIntVersion) |
| 174 result.setString(m_metadata.version); | 174 result.setString(m_metadata.version); |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 // fire 'versionchange' but since we're not closing immediately the | 378 // fire 'versionchange' but since we're not closing immediately the |
| 379 // back-end should still send out 'blocked'. | 379 // back-end should still send out 'blocked'. |
| 380 m_backend->versionChangeIgnored(); | 380 m_backend->versionChangeIgnored(); |
| 381 return; | 381 return; |
| 382 } | 382 } |
| 383 | 383 |
| 384 Nullable<unsigned long long> newVersionNullable = (newVersion == IDBDatabase
Metadata::NoIntVersion) ? Nullable<unsigned long long>() : Nullable<unsigned lon
g long>(newVersion); | 384 Nullable<unsigned long long> newVersionNullable = (newVersion == IDBDatabase
Metadata::NoIntVersion) ? Nullable<unsigned long long>() : Nullable<unsigned lon
g long>(newVersion); |
| 385 enqueueEvent(IDBVersionChangeEvent::create(EventTypeNames::versionchange, ol
dVersion, newVersionNullable)); | 385 enqueueEvent(IDBVersionChangeEvent::create(EventTypeNames::versionchange, ol
dVersion, newVersionNullable)); |
| 386 } | 386 } |
| 387 | 387 |
| 388 void IDBDatabase::enqueueEvent(PassRefPtrWillBeRawPtr<Event> event) | 388 void IDBDatabase::enqueueEvent(RawPtr<Event> event) |
| 389 { | 389 { |
| 390 ASSERT(!m_contextStopped); | 390 ASSERT(!m_contextStopped); |
| 391 ASSERT(executionContext()); | 391 ASSERT(executionContext()); |
| 392 EventQueue* eventQueue = executionContext()->eventQueue(); | 392 EventQueue* eventQueue = executionContext()->eventQueue(); |
| 393 event->setTarget(this); | 393 event->setTarget(this); |
| 394 eventQueue->enqueueEvent(event.get()); | 394 eventQueue->enqueueEvent(event.get()); |
| 395 m_enqueuedEvents.append(event); | 395 m_enqueuedEvents.append(event); |
| 396 } | 396 } |
| 397 | 397 |
| 398 bool IDBDatabase::dispatchEventInternal(PassRefPtrWillBeRawPtr<Event> event) | 398 bool IDBDatabase::dispatchEventInternal(RawPtr<Event> event) |
| 399 { | 399 { |
| 400 IDB_TRACE("IDBDatabase::dispatchEvent"); | 400 IDB_TRACE("IDBDatabase::dispatchEvent"); |
| 401 if (m_contextStopped || !executionContext()) | 401 if (m_contextStopped || !executionContext()) |
| 402 return false; | 402 return false; |
| 403 ASSERT(event->type() == EventTypeNames::versionchange || event->type() == Ev
entTypeNames::close); | 403 ASSERT(event->type() == EventTypeNames::versionchange || event->type() == Ev
entTypeNames::close); |
| 404 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { | 404 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { |
| 405 if (m_enqueuedEvents[i].get() == event.get()) | 405 if (m_enqueuedEvents[i].get() == event.get()) |
| 406 m_enqueuedEvents.remove(i); | 406 m_enqueuedEvents.remove(i); |
| 407 } | 407 } |
| 408 | 408 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 return ActiveDOMObject::executionContext(); | 453 return ActiveDOMObject::executionContext(); |
| 454 } | 454 } |
| 455 | 455 |
| 456 void IDBDatabase::recordApiCallsHistogram(IndexedDatabaseMethods method) | 456 void IDBDatabase::recordApiCallsHistogram(IndexedDatabaseMethods method) |
| 457 { | 457 { |
| 458 DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, apiCallsHistogram, new
EnumerationHistogram("WebCore.IndexedDB.FrontEndAPICalls", IDBMethodsMax)); | 458 DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, apiCallsHistogram, new
EnumerationHistogram("WebCore.IndexedDB.FrontEndAPICalls", IDBMethodsMax)); |
| 459 apiCallsHistogram.count(method); | 459 apiCallsHistogram.count(method); |
| 460 } | 460 } |
| 461 | 461 |
| 462 } // namespace blink | 462 } // namespace blink |
| OLD | NEW |