Changeset 130335 in webkit


Ignore:
Timestamp:
Oct 3, 2012, 3:41:57 PM (13 years ago)
Author:
jsbell@chromium.org
Message:

IndexedDB: Memory leak when deleting object stores with indexes
https://bugs.webkit.org/show_bug.cgi?id=98292

Reviewed by Tony Chang.

Reference cycles between IDBObjectStore and IDBIndex instances are explicitly
broken when the transaction completes (and the spec allows traversal to fail).
Deleted stores need to have the reference cycle broken too.

Caught by running valgrind over: storage/indexeddb/keypath-basics.html

  • Modules/indexeddb/IDBTransaction.cpp:

(WebCore::IDBTransaction::objectStoreDeleted): Add store to set.
(WebCore::IDBTransaction::dispatchEvent): Notify stores in set.

  • Modules/indexeddb/IDBTransaction.h: Add set of deleted stores.
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r130333 r130335  
     12012-10-03  Joshua Bell  <jsbell@chromium.org>
     2
     3        IndexedDB: Memory leak when deleting object stores with indexes
     4        https://bugs.webkit.org/show_bug.cgi?id=98292
     5
     6        Reviewed by Tony Chang.
     7
     8        Reference cycles between IDBObjectStore and IDBIndex instances are explicitly
     9        broken when the transaction completes (and the spec allows traversal to fail).
     10        Deleted stores need to have the reference cycle broken too.
     11
     12        Caught by running valgrind over: storage/indexeddb/keypath-basics.html
     13
     14        * Modules/indexeddb/IDBTransaction.cpp:
     15        (WebCore::IDBTransaction::objectStoreDeleted): Add store to set.
     16        (WebCore::IDBTransaction::dispatchEvent): Notify stores in set.
     17        * Modules/indexeddb/IDBTransaction.h: Add set of deleted stores.
     18
    1192012-10-03  Adam Barth  <abarth@webkit.org>
    220
  • trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp

    r129038 r130335  
    187187        objectStore->markDeleted();
    188188        m_objectStoreCleanupMap.set(objectStore, objectStore->metadata());
     189        m_deletedObjectStores.add(objectStore);
    189190    }
    190191}
     
    387388        it->second->transactionFinished();
    388389    m_objectStoreMap.clear();
     390    for (IDBObjectStoreSet::iterator it = m_deletedObjectStores.begin(); it != m_deletedObjectStores.end(); ++it)
     391        (*it)->transactionFinished();
     392    m_deletedObjectStores.clear();
    389393
    390394    Vector<RefPtr<EventTarget> > targets;
  • trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.h

    r129038 r130335  
    159159    IDBObjectStoreMap m_objectStoreMap;
    160160
     161    typedef HashSet<RefPtr<IDBObjectStore> > IDBObjectStoreSet;
     162    IDBObjectStoreSet m_deletedObjectStores;
     163
    161164    typedef HashMap<RefPtr<IDBObjectStore>, IDBObjectStoreMetadata> IDBObjectStoreMetadataMap;
    162165    IDBObjectStoreMetadataMap m_objectStoreCleanupMap;
Note: See TracChangeset for help on using the changeset viewer.