Chromium Code Reviews| Index: third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp |
| diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp |
| index c9d648a0ca2cdd90daf6bbf04000952ae733d292..1ab10eacee4051168aa2de5e9a7cf163af7a7a78 100644 |
| --- a/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp |
| +++ b/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp |
| @@ -47,16 +47,12 @@ namespace blink { |
| IDBTransaction* IDBTransaction::create(ScriptState* scriptState, int64_t id, const HashSet<String>& objectStoreNames, WebIDBTransactionMode mode, IDBDatabase* db) |
| { |
| IDBOpenDBRequest* openDBRequest = nullptr; |
| - IDBTransaction* transaction = new IDBTransaction(scriptState, id, objectStoreNames, mode, db, openDBRequest, IDBDatabaseMetadata()); |
| - transaction->suspendIfNeeded(); |
| - return transaction; |
| + return new IDBTransaction(scriptState, id, objectStoreNames, mode, db, openDBRequest, IDBDatabaseMetadata()); |
| } |
| IDBTransaction* IDBTransaction::create(ScriptState* scriptState, int64_t id, IDBDatabase* db, IDBOpenDBRequest* openDBRequest, const IDBDatabaseMetadata& previousMetadata) |
| { |
| - IDBTransaction* transaction = new IDBTransaction(scriptState, id, HashSet<String>(), WebIDBTransactionModeVersionChange, db, openDBRequest, previousMetadata); |
| - transaction->suspendIfNeeded(); |
| - return transaction; |
| + return new IDBTransaction(scriptState, id, HashSet<String>(), WebIDBTransactionModeVersionChange, db, openDBRequest, previousMetadata); |
| } |
| namespace { |
| @@ -84,7 +80,7 @@ private: |
| } // namespace |
| IDBTransaction::IDBTransaction(ScriptState* scriptState, int64_t id, const HashSet<String>& objectStoreNames, WebIDBTransactionMode mode, IDBDatabase* db, IDBOpenDBRequest* openDBRequest, const IDBDatabaseMetadata& previousMetadata) |
| - : ActiveDOMObject(scriptState->executionContext()) |
| + : ContextLifecycleObserver(scriptState->executionContext()) |
| , m_id(id) |
| , m_database(db) |
| , m_objectStoreNames(objectStoreNames) |
| @@ -104,8 +100,8 @@ IDBTransaction::IDBTransaction(ScriptState* scriptState, int64_t id, const HashS |
| IDBTransaction::~IDBTransaction() |
| { |
| - ASSERT(m_state == Finished || m_contextStopped); |
| - ASSERT(m_requestList.isEmpty() || m_contextStopped); |
| + ASSERT(m_state == Finished || !executionContext()); |
| + ASSERT(m_requestList.isEmpty() || !executionContext()); |
| } |
| DEFINE_TRACE(IDBTransaction) |
| @@ -118,7 +114,7 @@ DEFINE_TRACE(IDBTransaction) |
| visitor->trace(m_deletedObjectStores); |
| visitor->trace(m_objectStoreCleanupMap); |
| RefCountedGarbageCollectedEventTargetWithInlineData<IDBTransaction>::trace(visitor); |
| - ActiveDOMObject::trace(visitor); |
| + ContextLifecycleObserver::trace(visitor); |
| } |
| void IDBTransaction::setError(DOMException* error) |
| @@ -206,7 +202,7 @@ void IDBTransaction::abort(ExceptionState& exceptionState) |
| m_state = Finishing; |
| - if (m_contextStopped) |
| + if (!executionContext()) |
| return; |
| for (IDBRequest* request : m_requestList) |
| @@ -234,7 +230,7 @@ void IDBTransaction::unregisterRequest(IDBRequest* request) |
| void IDBTransaction::onAbort(DOMException* error) |
| { |
| IDB_TRACE("IDBTransaction::onAbort"); |
| - if (m_contextStopped) { |
| + if (!executionContext()) { |
| m_database->transactionFinished(this); |
| return; |
| } |
| @@ -270,7 +266,7 @@ void IDBTransaction::onAbort(DOMException* error) |
| void IDBTransaction::onComplete() |
| { |
| IDB_TRACE("IDBTransaction::onComplete"); |
| - if (m_contextStopped) { |
| + if (!executionContext()) { |
| m_database->transactionFinished(this); |
| return; |
| } |
| @@ -290,7 +286,7 @@ bool IDBTransaction::hasPendingActivity() const |
| // FIXME: In an ideal world, we should return true as long as anyone has a or can |
| // get a handle to us or any child request object and any of those have |
| // event listeners. This is in order to handle user generated events properly. |
| - return m_hasPendingActivity && !m_contextStopped; |
| + return m_hasPendingActivity && executionContext(); |
| } |
| WebIDBTransactionMode IDBTransaction::stringToMode(const String& modeString) |
| @@ -341,13 +337,13 @@ const AtomicString& IDBTransaction::interfaceName() const |
| ExecutionContext* IDBTransaction::executionContext() const |
| { |
| - return ActiveDOMObject::executionContext(); |
| + return ContextLifecycleObserver::executionContext(); |
| } |
| DispatchEventResult IDBTransaction::dispatchEventInternal(PassRefPtrWillBeRawPtr<Event> event) |
| { |
| IDB_TRACE("IDBTransaction::dispatchEvent"); |
| - if (m_contextStopped || !executionContext()) { |
| + if (!executionContext()) { |
| m_state = Finished; |
| return DispatchEventResult::CanceledBeforeDispatch; |
| } |
| @@ -382,20 +378,15 @@ DispatchEventResult IDBTransaction::dispatchEventInternal(PassRefPtrWillBeRawPtr |
| return dispatchResult; |
| } |
| -void IDBTransaction::stop() |
| +void IDBTransaction::contextDestroyed() |
| { |
| - if (m_contextStopped) |
| - return; |
| - |
| - m_contextStopped = true; |
| - |
| abort(IGNORE_EXCEPTION); |
|
sof
2016/03/01 07:04:26
afaict, the abort() call here used to be a no-op.
|
| } |
| void IDBTransaction::enqueueEvent(PassRefPtrWillBeRawPtr<Event> event) |
| { |
| ASSERT_WITH_MESSAGE(m_state != Finished, "A finished transaction tried to enqueue an event of type %s.", event->type().utf8().data()); |
| - if (m_contextStopped || !executionContext()) |
| + if (!executionContext()) |
| return; |
| EventQueue* eventQueue = executionContext()->eventQueue(); |