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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 void IDBDatabase::enqueueEvent(PassRefPtrWillBeRawPtr<Event> event) | 380 void IDBDatabase::enqueueEvent(PassRefPtrWillBeRawPtr<Event> event) |
381 { | 381 { |
382 ASSERT(!m_contextStopped); | 382 ASSERT(!m_contextStopped); |
383 ASSERT(executionContext()); | 383 ASSERT(executionContext()); |
384 EventQueue* eventQueue = executionContext()->eventQueue(); | 384 EventQueue* eventQueue = executionContext()->eventQueue(); |
385 event->setTarget(this); | 385 event->setTarget(this); |
386 eventQueue->enqueueEvent(event.get()); | 386 eventQueue->enqueueEvent(event.get()); |
387 m_enqueuedEvents.append(event); | 387 m_enqueuedEvents.append(event); |
388 } | 388 } |
389 | 389 |
390 bool IDBDatabase::dispatchEventInternal(PassRefPtrWillBeRawPtr<Event> event) | 390 DispatchEventResult IDBDatabase::dispatchEventInternal(PassRefPtrWillBeRawPtr<Ev
ent> event) |
391 { | 391 { |
392 IDB_TRACE("IDBDatabase::dispatchEvent"); | 392 IDB_TRACE("IDBDatabase::dispatchEvent"); |
393 if (m_contextStopped || !executionContext()) | 393 if (m_contextStopped || !executionContext()) |
394 return false; | 394 return DispatchEventResult::CanceledBeforeDispatch; |
395 ASSERT(event->type() == EventTypeNames::versionchange || event->type() == Ev
entTypeNames::close); | 395 ASSERT(event->type() == EventTypeNames::versionchange || event->type() == Ev
entTypeNames::close); |
396 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { | 396 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { |
397 if (m_enqueuedEvents[i].get() == event.get()) | 397 if (m_enqueuedEvents[i].get() == event.get()) |
398 m_enqueuedEvents.remove(i); | 398 m_enqueuedEvents.remove(i); |
399 } | 399 } |
400 | 400 |
401 bool result = EventTarget::dispatchEventInternal(event.get()); | 401 DispatchEventResult dispatchResult = EventTarget::dispatchEventInternal(even
t.get()); |
402 if (event->type() == EventTypeNames::versionchange && !m_closePending && m_b
ackend) | 402 if (event->type() == EventTypeNames::versionchange && !m_closePending && m_b
ackend) |
403 m_backend->versionChangeIgnored(); | 403 m_backend->versionChangeIgnored(); |
404 return result; | 404 return dispatchResult; |
405 } | 405 } |
406 | 406 |
407 int64_t IDBDatabase::findObjectStoreId(const String& name) const | 407 int64_t IDBDatabase::findObjectStoreId(const String& name) const |
408 { | 408 { |
409 for (const auto& it : m_metadata.objectStores) { | 409 for (const auto& it : m_metadata.objectStores) { |
410 if (it.value.name == name) { | 410 if (it.value.name == name) { |
411 ASSERT(it.key != IDBObjectStoreMetadata::InvalidId); | 411 ASSERT(it.key != IDBObjectStoreMetadata::InvalidId); |
412 return it.key; | 412 return it.key; |
413 } | 413 } |
414 } | 414 } |
(...skipping 30 matching lines...) Expand all Loading... |
445 return ActiveDOMObject::executionContext(); | 445 return ActiveDOMObject::executionContext(); |
446 } | 446 } |
447 | 447 |
448 void IDBDatabase::recordApiCallsHistogram(IndexedDatabaseMethods method) | 448 void IDBDatabase::recordApiCallsHistogram(IndexedDatabaseMethods method) |
449 { | 449 { |
450 DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, apiCallsHistogram, new
EnumerationHistogram("WebCore.IndexedDB.FrontEndAPICalls", IDBMethodsMax)); | 450 DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, apiCallsHistogram, new
EnumerationHistogram("WebCore.IndexedDB.FrontEndAPICalls", IDBMethodsMax)); |
451 apiCallsHistogram.count(method); | 451 apiCallsHistogram.count(method); |
452 } | 452 } |
453 | 453 |
454 } // namespace blink | 454 } // namespace blink |
OLD | NEW |