| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 ASSERT(m_transactions.contains(transactionId)); | 153 ASSERT(m_transactions.contains(transactionId)); |
| 154 m_transactions.get(transactionId)->onAbort(error); | 154 m_transactions.get(transactionId)->onAbort(error); |
| 155 } | 155 } |
| 156 | 156 |
| 157 void IDBDatabase::onComplete(int64_t transactionId) | 157 void IDBDatabase::onComplete(int64_t transactionId) |
| 158 { | 158 { |
| 159 ASSERT(m_transactions.contains(transactionId)); | 159 ASSERT(m_transactions.contains(transactionId)); |
| 160 m_transactions.get(transactionId)->onComplete(); | 160 m_transactions.get(transactionId)->onComplete(); |
| 161 } | 161 } |
| 162 | 162 |
| 163 PassRefPtrWillBeRawPtr<DOMStringList> IDBDatabase::objectStoreNames() const | 163 RawPtr<DOMStringList> IDBDatabase::objectStoreNames() const |
| 164 { | 164 { |
| 165 RefPtrWillBeRawPtr<DOMStringList> objectStoreNames = DOMStringList::create(D
OMStringList::IndexedDB); | 165 RawPtr<DOMStringList> objectStoreNames = DOMStringList::create(DOMStringList
::IndexedDB); |
| 166 for (const auto& it : m_metadata.objectStores) | 166 for (const auto& it : m_metadata.objectStores) |
| 167 objectStoreNames->append(it.value.name); | 167 objectStoreNames->append(it.value.name); |
| 168 objectStoreNames->sort(); | 168 objectStoreNames->sort(); |
| 169 return objectStoreNames.release(); | 169 return objectStoreNames.release(); |
| 170 } | 170 } |
| 171 | 171 |
| 172 IDBObjectStore* IDBDatabase::createObjectStore(const String& name, const IDBKeyP
ath& keyPath, bool autoIncrement, ExceptionState& exceptionState) | 172 IDBObjectStore* IDBDatabase::createObjectStore(const String& name, const IDBKeyP
ath& keyPath, bool autoIncrement, ExceptionState& exceptionState) |
| 173 { | 173 { |
| 174 IDB_TRACE("IDBDatabase::createObjectStore"); | 174 IDB_TRACE("IDBDatabase::createObjectStore"); |
| 175 recordApiCallsHistogram(IDBCreateObjectStoreCall); | 175 recordApiCallsHistogram(IDBCreateObjectStoreCall); |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 // fire 'versionchange' but since we're not closing immediately the | 371 // fire 'versionchange' but since we're not closing immediately the |
| 372 // back-end should still send out 'blocked'. | 372 // back-end should still send out 'blocked'. |
| 373 m_backend->versionChangeIgnored(); | 373 m_backend->versionChangeIgnored(); |
| 374 return; | 374 return; |
| 375 } | 375 } |
| 376 | 376 |
| 377 Nullable<unsigned long long> newVersionNullable = (newVersion == IDBDatabase
Metadata::NoVersion) ? Nullable<unsigned long long>() : Nullable<unsigned long l
ong>(newVersion); | 377 Nullable<unsigned long long> newVersionNullable = (newVersion == IDBDatabase
Metadata::NoVersion) ? Nullable<unsigned long long>() : Nullable<unsigned long l
ong>(newVersion); |
| 378 enqueueEvent(IDBVersionChangeEvent::create(EventTypeNames::versionchange, ol
dVersion, newVersionNullable)); | 378 enqueueEvent(IDBVersionChangeEvent::create(EventTypeNames::versionchange, ol
dVersion, newVersionNullable)); |
| 379 } | 379 } |
| 380 | 380 |
| 381 void IDBDatabase::enqueueEvent(PassRefPtrWillBeRawPtr<Event> event) | 381 void IDBDatabase::enqueueEvent(RawPtr<Event> event) |
| 382 { | 382 { |
| 383 ASSERT(!m_contextStopped); | 383 ASSERT(!m_contextStopped); |
| 384 ASSERT(getExecutionContext()); | 384 ASSERT(getExecutionContext()); |
| 385 EventQueue* eventQueue = getExecutionContext()->getEventQueue(); | 385 EventQueue* eventQueue = getExecutionContext()->getEventQueue(); |
| 386 event->setTarget(this); | 386 event->setTarget(this); |
| 387 eventQueue->enqueueEvent(event.get()); | 387 eventQueue->enqueueEvent(event.get()); |
| 388 m_enqueuedEvents.append(event); | 388 m_enqueuedEvents.append(event); |
| 389 } | 389 } |
| 390 | 390 |
| 391 DispatchEventResult IDBDatabase::dispatchEventInternal(PassRefPtrWillBeRawPtr<Ev
ent> event) | 391 DispatchEventResult IDBDatabase::dispatchEventInternal(RawPtr<Event> event) |
| 392 { | 392 { |
| 393 IDB_TRACE("IDBDatabase::dispatchEvent"); | 393 IDB_TRACE("IDBDatabase::dispatchEvent"); |
| 394 if (m_contextStopped || !getExecutionContext()) | 394 if (m_contextStopped || !getExecutionContext()) |
| 395 return DispatchEventResult::CanceledBeforeDispatch; | 395 return DispatchEventResult::CanceledBeforeDispatch; |
| 396 ASSERT(event->type() == EventTypeNames::versionchange || event->type() == Ev
entTypeNames::close); | 396 ASSERT(event->type() == EventTypeNames::versionchange || event->type() == Ev
entTypeNames::close); |
| 397 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { | 397 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { |
| 398 if (m_enqueuedEvents[i].get() == event.get()) | 398 if (m_enqueuedEvents[i].get() == event.get()) |
| 399 m_enqueuedEvents.remove(i); | 399 m_enqueuedEvents.remove(i); |
| 400 } | 400 } |
| 401 | 401 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 return ActiveDOMObject::getExecutionContext(); | 446 return ActiveDOMObject::getExecutionContext(); |
| 447 } | 447 } |
| 448 | 448 |
| 449 void IDBDatabase::recordApiCallsHistogram(IndexedDatabaseMethods method) | 449 void IDBDatabase::recordApiCallsHistogram(IndexedDatabaseMethods method) |
| 450 { | 450 { |
| 451 DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, apiCallsHistogram, new
EnumerationHistogram("WebCore.IndexedDB.FrontEndAPICalls", IDBMethodsMax)); | 451 DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, apiCallsHistogram, new
EnumerationHistogram("WebCore.IndexedDB.FrontEndAPICalls", IDBMethodsMax)); |
| 452 apiCallsHistogram.count(method); | 452 apiCallsHistogram.count(method); |
| 453 } | 453 } |
| 454 | 454 |
| 455 } // namespace blink | 455 } // namespace blink |
| OLD | NEW |