| Index: third_party/WebKit/Source/modules/indexeddb/IDBDatabase.cpp
|
| diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBDatabase.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBDatabase.cpp
|
| index b5defd21f02a579b2dec20e70e899b9cca48362f..bdb2142a955bcb42a83c30d1abb662b5d4c03ea7 100644
|
| --- a/third_party/WebKit/Source/modules/indexeddb/IDBDatabase.cpp
|
| +++ b/third_party/WebKit/Source/modules/indexeddb/IDBDatabase.cpp
|
| @@ -68,13 +68,11 @@ const char IDBDatabase::databaseClosedErrorMessage[] = "The database connection
|
|
|
| IDBDatabase* IDBDatabase::create(ExecutionContext* context, PassOwnPtr<WebIDBDatabase> database, IDBDatabaseCallbacks* callbacks)
|
| {
|
| - IDBDatabase* idbDatabase = new IDBDatabase(context, database, callbacks);
|
| - idbDatabase->suspendIfNeeded();
|
| - return idbDatabase;
|
| + return new IDBDatabase(context, database, callbacks);
|
| }
|
|
|
| IDBDatabase::IDBDatabase(ExecutionContext* context, PassOwnPtr<WebIDBDatabase> backend, IDBDatabaseCallbacks* callbacks)
|
| - : ActiveDOMObject(context)
|
| + : ContextLifecycleObserver(context)
|
| , m_backend(backend)
|
| , m_databaseCallbacks(callbacks)
|
| {
|
| @@ -94,7 +92,7 @@ DEFINE_TRACE(IDBDatabase)
|
| visitor->trace(m_enqueuedEvents);
|
| visitor->trace(m_databaseCallbacks);
|
| RefCountedGarbageCollectedEventTargetWithInlineData<IDBDatabase>::trace(visitor);
|
| - ActiveDOMObject::trace(visitor);
|
| + ContextLifecycleObserver::trace(visitor);
|
| }
|
|
|
| int64_t IDBDatabase::nextTransactionId()
|
| @@ -345,7 +343,7 @@ void IDBDatabase::closeConnection()
|
| m_backend.clear();
|
| }
|
|
|
| - if (m_contextStopped || !executionContext())
|
| + if (!executionContext())
|
| return;
|
|
|
| EventQueue* eventQueue = executionContext()->eventQueue();
|
| @@ -362,7 +360,7 @@ void IDBDatabase::closeConnection()
|
| void IDBDatabase::onVersionChange(int64_t oldVersion, int64_t newVersion)
|
| {
|
| IDB_TRACE("IDBDatabase::onVersionChange");
|
| - if (m_contextStopped || !executionContext())
|
| + if (!executionContext())
|
| return;
|
|
|
| if (m_closePending) {
|
| @@ -379,7 +377,6 @@ void IDBDatabase::onVersionChange(int64_t oldVersion, int64_t newVersion)
|
|
|
| void IDBDatabase::enqueueEvent(PassRefPtrWillBeRawPtr<Event> event)
|
| {
|
| - ASSERT(!m_contextStopped);
|
| ASSERT(executionContext());
|
| EventQueue* eventQueue = executionContext()->eventQueue();
|
| event->setTarget(this);
|
| @@ -390,7 +387,7 @@ void IDBDatabase::enqueueEvent(PassRefPtrWillBeRawPtr<Event> event)
|
| DispatchEventResult IDBDatabase::dispatchEventInternal(PassRefPtrWillBeRawPtr<Event> event)
|
| {
|
| IDB_TRACE("IDBDatabase::dispatchEvent");
|
| - if (m_contextStopped || !executionContext())
|
| + if (!executionContext())
|
| return DispatchEventResult::CanceledBeforeDispatch;
|
| ASSERT(event->type() == EventTypeNames::versionchange || event->type() == EventTypeNames::close);
|
| for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) {
|
| @@ -419,13 +416,11 @@ bool IDBDatabase::hasPendingActivity() const
|
| {
|
| // The script wrapper must not be collected before the object is closed or
|
| // we can't fire a "versionchange" event to let script manually close the connection.
|
| - return !m_closePending && hasEventListeners() && !m_contextStopped;
|
| + return !m_closePending && hasEventListeners() && executionContext();
|
| }
|
|
|
| -void IDBDatabase::stop()
|
| +void IDBDatabase::contextDestroyed()
|
| {
|
| - m_contextStopped = true;
|
| -
|
| // Immediately close the connection to the back end. Don't attempt a
|
| // normal close() since that may wait on transactions which require a
|
| // round trip to the back-end to abort.
|
| @@ -442,7 +437,7 @@ const AtomicString& IDBDatabase::interfaceName() const
|
|
|
| ExecutionContext* IDBDatabase::executionContext() const
|
| {
|
| - return ActiveDOMObject::executionContext();
|
| + return ContextLifecycleObserver::executionContext();
|
| }
|
|
|
| void IDBDatabase::recordApiCallsHistogram(IndexedDatabaseMethods method)
|
|
|