Changeset 32942 in webkit


Ignore:
Timestamp:
May 6, 2008 10:31:34 PM (16 years ago)
Author:
beidson@apple.com
Message:

2008-05-06 Brady Eidson <beidson@apple.com>

Reviewed by Sam Weinig

Fix a few bugs with the final sync'ing of LocalStorageAreas when the thread is shut down.
1 - A sync task actually needs to be scheduled for each LocalStorageArea when the shut down occurs.
2 - Pending sync timers all need to be cancelled.

  • storage/LocalStorage.cpp: (WebCore::LocalStorage::storageArea): (WebCore::LocalStorage::close): Tell each LocalStorageArea to schedule it's final sync before scheduling thread termination.
  • storage/LocalStorage.h: Change the map to be of LocalStorageAreas instead of StorageAreas
  • storage/LocalStorageArea.cpp: (WebCore::LocalStorageArea::LocalStorageArea): (WebCore::LocalStorageArea::~LocalStorageArea): ASSERT the timer has been cancelled, but make SURE it is in release builds. (WebCore::LocalStorageArea::scheduleFinalSync): Cancel the sync timer, schedule the final sync, and set the "final sync scheduled" flag (WebCore::LocalStorageArea::scheduleItemForSync): ASSERT that the final sync hasn't already been scheduled (WebCore::LocalStorageArea::scheduleClear): Ditto
  • storage/LocalStorageArea.h:
Location:
trunk/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r32941 r32942  
     12008-05-06  Brady Eidson  <beidson@apple.com>
     2
     3        Reviewed by Sam Weinig
     4
     5        Fix a few bugs with the final sync'ing of LocalStorageAreas when the thread is shut down.
     6        1 - A sync task actually needs to be scheduled for each LocalStorageArea when the shut down occurs.
     7        2 - Pending sync timers all need to be cancelled.
     8
     9        * storage/LocalStorage.cpp:
     10        (WebCore::LocalStorage::storageArea):
     11        (WebCore::LocalStorage::close): Tell each LocalStorageArea to schedule it's final sync before scheduling
     12          thread termination.
     13        * storage/LocalStorage.h:  Change the map to be of LocalStorageAreas instead of StorageAreas
     14
     15        * storage/LocalStorageArea.cpp:
     16        (WebCore::LocalStorageArea::LocalStorageArea):
     17        (WebCore::LocalStorageArea::~LocalStorageArea): ASSERT the timer has been cancelled, but make SURE it is
     18          in release builds.
     19        (WebCore::LocalStorageArea::scheduleFinalSync): Cancel the sync timer, schedule the final sync, and set the
     20          "final sync scheduled" flag
     21        (WebCore::LocalStorageArea::scheduleItemForSync): ASSERT that the final sync hasn't already been scheduled
     22        (WebCore::LocalStorageArea::scheduleClear): Ditto
     23        * storage/LocalStorageArea.h:
     24
    1252008-05-06  Kevin Ollivier  <kevino@theolliviers.com>
    226
  • trunk/WebCore/storage/LocalStorage.cpp

    r32929 r32942  
    6464    // sync its existance and quota out to disk via an task of type AreaSync
    6565
    66     RefPtr<StorageArea> storageArea;
     66    RefPtr<LocalStorageArea> storageArea;
    6767    if (storageArea = m_storageAreaMap.get(origin))
    6868        return storageArea.release();
     
    112112    ASSERT(isMainThread());
    113113
     114    LocalStorageAreaMap::iterator end = m_storageAreaMap.end();
     115    for (LocalStorageAreaMap::iterator it = m_storageAreaMap.begin(); it != end; ++it)
     116        it->second->scheduleFinalSync();
     117
    114118    if (m_thread) {
    115119        m_thread->terminate();
  • trunk/WebCore/storage/LocalStorage.h

    r32928 r32942  
    5555        LocalStorage(PageGroup*, const String& path);
    5656
    57         typedef HashMap<RefPtr<SecurityOrigin>, RefPtr<StorageArea>, SecurityOriginHash> StorageAreaMap;
    58         StorageAreaMap m_storageAreaMap;
     57        typedef HashMap<RefPtr<SecurityOrigin>, RefPtr<LocalStorageArea>, SecurityOriginHash> LocalStorageAreaMap;
     58        LocalStorageAreaMap m_storageAreaMap;
    5959
    6060        PageGroup* m_group;
  • trunk/WebCore/storage/LocalStorageArea.cpp

    r32930 r32942  
    5050    , m_syncTimer(this, &LocalStorageArea::syncTimerFired)
    5151    , m_itemsCleared(false)
     52    , m_finalSyncScheduled(false)
    5253    , m_localStorage(localStorage)
    5354    , m_clearItemsWhileSyncing(false)
     
    5859   
    5960     m_localStorage->scheduleImport(this);
     61}
     62
     63LocalStorageArea::~LocalStorageArea()
     64{
     65    ASSERT(!m_syncTimer.isActive());
     66}
     67
     68void LocalStorageArea::scheduleFinalSync()
     69{
     70    m_syncTimer.stop();
     71    syncTimerFired(&m_syncTimer);
     72    m_finalSyncScheduled = true;
    6073}
    6174
     
    221234{
    222235    ASSERT(isMainThread());
     236    ASSERT(!m_finalSyncScheduled);
    223237
    224238    m_changedItems.set(key, value);
     
    230244{
    231245    ASSERT(isMainThread());
     246    ASSERT(!m_finalSyncScheduled);
    232247
    233248    m_changedItems.clear();
  • trunk/WebCore/storage/LocalStorageArea.h

    r32930 r32942  
    4545    class LocalStorageArea : public StorageArea {
    4646    public:
     47        virtual ~LocalStorageArea();
     48
    4749        static PassRefPtr<LocalStorageArea> create(SecurityOrigin* origin, LocalStorage* localStorage) { return adoptRef(new LocalStorageArea(origin, localStorage)); }
     50
     51        void scheduleFinalSync();
    4852
    4953    private:
     
    6165        HashMap<String, String> m_changedItems;
    6266        bool m_itemsCleared;
     67       
     68        bool m_finalSyncScheduled;
    6369
    6470        LocalStorage* m_localStorage;
Note: See TracChangeset for help on using the changeset viewer.