Changeset 62043 in webkit


Ignore:
Timestamp:
Jun 28, 2010 3:36:02 PM (14 years ago)
Author:
dumi@chromium.org
Message:

Fix a race condition that can happen when using DBs in workers.
https://bugs.webkit.org/show_bug.cgi?id=41105

Reviewed by Eric Seidel.

  • storage/DatabaseTracker.cpp:

(WebCore::DatabaseTracker::addOpenDatabase):

  • storage/DatabaseTracker.h:
Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r62042 r62043  
     12010-06-28  Dumitru Daniliuc  <dumi@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Fix a race condition that can happen when using DBs in workers.
     6        https://bugs.webkit.org/show_bug.cgi?id=41105
     7
     8        * storage/DatabaseTracker.cpp:
     9        (WebCore::DatabaseTracker::addOpenDatabase):
     10        * storage/DatabaseTracker.h:
     11
    1122010-06-28  Adam Barth  <abarth@webkit.org>
    213
  • trunk/WebCore/storage/DatabaseTracker.cpp

    r61154 r62043  
    507507
    508508        LOG(StorageAPI, "Added open Database %s (%p)\n", database->stringIdentifier().ascii().data(), database);
     509
     510        Locker<OriginQuotaManager> quotaManagerLocker(originQuotaManager());
     511        if (!originQuotaManager().tracksOrigin(database->securityOrigin()))
     512            originQuotaManager().trackOrigin(database->securityOrigin());
    509513    }
    510514
     
    554558        m_openDatabaseMap->remove(database->securityOrigin());
    555559        delete nameMap;
    556     }
    557 
    558     Locker<OriginQuotaManager> quotaManagerLocker(originQuotaManager());
    559     originQuotaManager().removeOrigin(database->securityOrigin());
     560
     561        Locker<OriginQuotaManager> quotaManagerLocker(originQuotaManager());
     562        originQuotaManager().removeOrigin(database->securityOrigin());
     563    }
    560564}
    561565
  • trunk/WebCore/storage/DatabaseTracker.h

    r61154 r62043  
    6464    // currently using 4 locks.  In order to avoid deadlock when taking multiple locks, you must take them in the correct order:
    6565    // m_databaseGuard before quotaManager if both locks are needed.
    66     // no other lock is taken in the code locked on m_openDatabaseMapGuard.
     66    // m_openDatabaseMapGuard before quotaManager if both locks are needed.
     67    // m_databaseGuard and m_openDatabaseMapGuard currently don't overlap.
    6768    // notificationMutex() is currently independent of the other locks.
    6869
Note: See TracChangeset for help on using the changeset viewer.