Title: [196373] trunk/Source/WebCore
Revision
196373
Author
beid...@apple.com
Date
2016-02-10 11:27:58 -0800 (Wed, 10 Feb 2016)

Log Message

Modern IDB: Ref cycle between IDBObjectStore and IDBTransaction.
https://bugs.webkit.org/show_bug.cgi?id=154061

Reviewed by Alex Christensen.

No new tests (Currently untestable).

* Modules/indexeddb/client/IDBTransactionImpl.cpp:
(WebCore::IDBClient::IDBTransaction::transitionedToFinishing): Make sure the new state makes sense,
  set the new state, and then clear the set of referenced object stores which is no longer needed.
(WebCore::IDBClient::IDBTransaction::abort):
(WebCore::IDBClient::IDBTransaction::commit):
* Modules/indexeddb/client/IDBTransactionImpl.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (196372 => 196373)


--- trunk/Source/WebCore/ChangeLog	2016-02-10 19:22:08 UTC (rev 196372)
+++ trunk/Source/WebCore/ChangeLog	2016-02-10 19:27:58 UTC (rev 196373)
@@ -1,3 +1,19 @@
+2016-02-10  Brady Eidson  <beid...@apple.com>
+
+        Modern IDB: Ref cycle between IDBObjectStore and IDBTransaction.
+        https://bugs.webkit.org/show_bug.cgi?id=154061
+
+        Reviewed by Alex Christensen.
+
+        No new tests (Currently untestable).
+
+        * Modules/indexeddb/client/IDBTransactionImpl.cpp:
+        (WebCore::IDBClient::IDBTransaction::transitionedToFinishing): Make sure the new state makes sense,
+          set the new state, and then clear the set of referenced object stores which is no longer needed.
+        (WebCore::IDBClient::IDBTransaction::abort):
+        (WebCore::IDBClient::IDBTransaction::commit):
+        * Modules/indexeddb/client/IDBTransactionImpl.h:
+
 2016-02-10  Jer Noble  <jer.no...@apple.com>
 
         REGRESSION(r195770): Use-after-free in ResourceLoaderOptions::cachingPolicy

Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp (196372 => 196373)


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp	2016-02-10 19:22:08 UTC (rev 196372)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp	2016-02-10 19:27:58 UTC (rev 196373)
@@ -177,6 +177,13 @@
     abort(ec);
 }
 
+void IDBTransaction::transitionedToFinishing(IndexedDB::TransactionState state)
+{
+    ASSERT(!isFinishedOrFinishing());
+    m_state = state;
+    m_referencedObjectStores.clear();
+}
+
 void IDBTransaction::abort(ExceptionCodeWithMessage& ec)
 {
     LOG(IndexedDB, "IDBTransaction::abort");
@@ -187,13 +194,14 @@
         return;
     }
 
-    m_state = IndexedDB::TransactionState::Aborting;
     m_database->willAbortTransaction(*this);
 
     if (isVersionChange()) {
         for (auto& objectStore : m_referencedObjectStores.values())
             objectStore->rollbackInfoForVersionChangeAbort();
     }
+
+    transitionedToFinishing(IndexedDB::TransactionState::Aborting);
     
     m_abortQueue.swap(m_transactionOperationQueue);
 
@@ -319,7 +327,7 @@
 
     ASSERT(!isFinishedOrFinishing());
 
-    m_state = IndexedDB::TransactionState::Committing;
+    transitionedToFinishing(IndexedDB::TransactionState::Committing);
     m_database->willCommitTransaction(*this);
 
     auto operation = createTransactionOperation(*this, nullptr, &IDBTransaction::commitOnServer);

Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h (196372 => 196373)


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h	2016-02-10 19:22:08 UTC (rev 196372)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h	2016-02-10 19:27:58 UTC (rev 196373)
@@ -183,6 +183,8 @@
     void iterateCursorOnServer(TransactionOperation&, const IDBKeyData&, const unsigned long& count);
     void didIterateCursorOnServer(IDBRequest&, const IDBResultData&);
 
+    void transitionedToFinishing(IndexedDB::TransactionState);
+
     void establishOnServer();
 
     void scheduleOperationTimer();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to