Changeset 144791 in webkit


Ignore:
Timestamp:
Mar 5, 2013, 11:43:40 AM (12 years ago)
Author:
andersca@apple.com
Message:

Simplify storage event dispatch somewhat
https://bugs.webkit.org/show_bug.cgi?id=111461

Reviewed by Beth Dakin.

Add a StorageAreaImpl::dispatchStorageEvent to avoid replicating the calls to
StorageEventDispatcher::dispatch there times. This is in preparation for changing the
interface of StorageEventDispatcher so it can be used by WebKit2.

  • storage/StorageAreaImpl.cpp:

(WebCore::StorageAreaImpl::setItem):
(WebCore::StorageAreaImpl::removeItem):
(WebCore::StorageAreaImpl::clear):
(WebCore::StorageAreaImpl::dispatchStorageEvent):

  • storage/StorageAreaImpl.h:

Reindent.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r144790 r144791  
     12013-03-05  Anders Carlsson  <andersca@apple.com>
     2
     3        Simplify storage event dispatch somewhat
     4        https://bugs.webkit.org/show_bug.cgi?id=111461
     5
     6        Reviewed by Beth Dakin.
     7
     8        Add a StorageAreaImpl::dispatchStorageEvent to avoid replicating the calls to
     9        StorageEventDispatcher::dispatch there times. This is in preparation for changing the
     10        interface of StorageEventDispatcher so it can be used by WebKit2.
     11
     12        * storage/StorageAreaImpl.cpp:
     13        (WebCore::StorageAreaImpl::setItem):
     14        (WebCore::StorageAreaImpl::removeItem):
     15        (WebCore::StorageAreaImpl::clear):
     16        (WebCore::StorageAreaImpl::dispatchStorageEvent):
     17
     18        * storage/StorageAreaImpl.h:
     19        Reindent.
     20
    1212013-03-05  Tony Chang  <tony@chromium.org>
    222
  • trunk/Source/WebCore/storage/StorageAreaImpl.cpp

    r144103 r144791  
    200200    if (m_storageAreaSync)
    201201        m_storageAreaSync->scheduleItemForSync(key, value);
    202     StorageEventDispatcher::dispatch(key, oldValue, value, m_storageType, m_securityOrigin.get(), frame);
     202
     203    dispatchStorageEvent(key, oldValue, value, frame);
    203204}
    204205
     
    227228    if (m_storageAreaSync)
    228229        m_storageAreaSync->scheduleItemForSync(key, String());
    229     StorageEventDispatcher::dispatch(key, oldValue, String(), m_storageType, m_securityOrigin.get(), frame);
     230    dispatchStorageEvent(key, oldValue, String(), frame);
    230231}
    231232
     
    252253    if (m_storageAreaSync)
    253254        m_storageAreaSync->scheduleClear();
    254     StorageEventDispatcher::dispatch(String(), String(), String(), m_storageType, m_securityOrigin.get(), frame);
     255    dispatchStorageEvent(String(), String(), String(), frame);
    255256}
    256257
     
    361362}
    362363
    363 }
     364void StorageAreaImpl::dispatchStorageEvent(const String& key, const String& oldValue, const String& newValue, Frame* sourceFrame)
     365{
     366    StorageEventDispatcher::dispatch(key, oldValue, newValue, m_storageType, m_securityOrigin.get(), sourceFrame);
     367}
     368
     369} // namespace WebCore
  • trunk/Source/WebCore/storage/StorageAreaImpl.h

    r144103 r144791  
    3636namespace WebCore {
    3737
    38     class SecurityOrigin;
    39     class StorageMap;
    40     class StorageAreaSync;
     38class SecurityOrigin;
     39class StorageMap;
     40class StorageAreaSync;
    4141
    42     class StorageAreaImpl : public StorageArea {
    43     public:
    44         static PassRefPtr<StorageAreaImpl> create(StorageType, PassRefPtr<SecurityOrigin>, PassRefPtr<StorageSyncManager>, unsigned quota);
    45         virtual ~StorageAreaImpl();
     42class StorageAreaImpl : public StorageArea {
     43public:
     44    static PassRefPtr<StorageAreaImpl> create(StorageType, PassRefPtr<SecurityOrigin>, PassRefPtr<StorageSyncManager>, unsigned quota);
     45    virtual ~StorageAreaImpl();
    4646
    47         // The HTML5 DOM Storage API (and contains)
    48         virtual unsigned length(ExceptionCode&, Frame* sourceFrame) OVERRIDE;
    49         virtual String key(unsigned index, ExceptionCode&, Frame* sourceFrame) OVERRIDE;
    50         virtual String getItem(const String& key, ExceptionCode&, Frame* sourceFrame) OVERRIDE;
    51         virtual void setItem(const String& key, const String& value, ExceptionCode&, Frame* sourceFrame) OVERRIDE;
    52         virtual void removeItem(const String& key, ExceptionCode&, Frame* sourceFrame) OVERRIDE;
    53         virtual void clear(ExceptionCode&, Frame* sourceFrame) OVERRIDE;
    54         virtual bool contains(const String& key, ExceptionCode&, Frame* sourceFrame) OVERRIDE;
     47    // The HTML5 DOM Storage API (and contains)
     48    virtual unsigned length(ExceptionCode&, Frame* sourceFrame) OVERRIDE;
     49    virtual String key(unsigned index, ExceptionCode&, Frame* sourceFrame) OVERRIDE;
     50    virtual String getItem(const String& key, ExceptionCode&, Frame* sourceFrame) OVERRIDE;
     51    virtual void setItem(const String& key, const String& value, ExceptionCode&, Frame* sourceFrame) OVERRIDE;
     52    virtual void removeItem(const String& key, ExceptionCode&, Frame* sourceFrame) OVERRIDE;
     53    virtual void clear(ExceptionCode&, Frame* sourceFrame) OVERRIDE;
     54    virtual bool contains(const String& key, ExceptionCode&, Frame* sourceFrame) OVERRIDE;
    5555
    56         virtual bool canAccessStorage(Frame* sourceFrame) OVERRIDE;
     56    virtual bool canAccessStorage(Frame* sourceFrame) OVERRIDE;
    5757
    58         virtual size_t memoryBytesUsedByCache() OVERRIDE;
     58    virtual size_t memoryBytesUsedByCache() OVERRIDE;
    5959
    60         virtual void incrementAccessCount();
    61         virtual void decrementAccessCount();
    62         virtual void closeDatabaseIfIdle();
     60    virtual void incrementAccessCount();
     61    virtual void decrementAccessCount();
     62    virtual void closeDatabaseIfIdle();
    6363
    64         PassRefPtr<StorageAreaImpl> copy();
    65         void close();
     64    PassRefPtr<StorageAreaImpl> copy();
     65    void close();
    6666
    67         // Only called from a background thread.
    68         void importItems(const HashMap<String, String>& items);
     67    // Only called from a background thread.
     68    void importItems(const HashMap<String, String>& items);
    6969
    70         // Used to clear a StorageArea and close db before backing db file is deleted.
    71         void clearForOriginDeletion();
     70    // Used to clear a StorageArea and close db before backing db file is deleted.
     71    void clearForOriginDeletion();
    7272
    73         void sync();
     73    void sync();
    7474
    75     private:
    76         StorageAreaImpl(StorageType, PassRefPtr<SecurityOrigin>, PassRefPtr<StorageSyncManager>, unsigned quota);
    77         explicit StorageAreaImpl(StorageAreaImpl*);
     75private:
     76    StorageAreaImpl(StorageType, PassRefPtr<SecurityOrigin>, PassRefPtr<StorageSyncManager>, unsigned quota);
     77    explicit StorageAreaImpl(StorageAreaImpl*);
    7878
    79         void blockUntilImportComplete() const;
    80         void closeDatabaseTimerFired(Timer<StorageAreaImpl>*);
    81         bool disabledByPrivateBrowsingInFrame(const Frame* sourceFrame) const;
     79    void blockUntilImportComplete() const;
     80    void closeDatabaseTimerFired(Timer<StorageAreaImpl>*);
     81    bool disabledByPrivateBrowsingInFrame(const Frame* sourceFrame) const;
    8282
    83         StorageType m_storageType;
    84         RefPtr<SecurityOrigin> m_securityOrigin;
    85         RefPtr<StorageMap> m_storageMap;
     83    void dispatchStorageEvent(const String& key, const String& oldValue, const String& newValue, Frame* sourceFrame);
    8684
    87         RefPtr<StorageAreaSync> m_storageAreaSync;
    88         RefPtr<StorageSyncManager> m_storageSyncManager;
     85    StorageType m_storageType;
     86    RefPtr<SecurityOrigin> m_securityOrigin;
     87    RefPtr<StorageMap> m_storageMap;
     88
     89    RefPtr<StorageAreaSync> m_storageAreaSync;
     90    RefPtr<StorageSyncManager> m_storageSyncManager;
    8991
    9092#ifndef NDEBUG
    91         bool m_isShutdown;
     93    bool m_isShutdown;
    9294#endif
    93         unsigned m_accessCount;
    94         Timer<StorageAreaImpl> m_closeDatabaseTimer;
    95     };
     95    unsigned m_accessCount;
     96    Timer<StorageAreaImpl> m_closeDatabaseTimer;
     97};
    9698
    9799} // namespace WebCore
Note: See TracChangeset for help on using the changeset viewer.