Title: [144791] trunk/Source/WebCore
Revision
144791
Author
ander...@apple.com
Date
2013-03-05 11:43:40 -0800 (Tue, 05 Mar 2013)

Log 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.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (144790 => 144791)


--- trunk/Source/WebCore/ChangeLog	2013-03-05 19:41:55 UTC (rev 144790)
+++ trunk/Source/WebCore/ChangeLog	2013-03-05 19:43:40 UTC (rev 144791)
@@ -1,3 +1,23 @@
+2013-03-05  Anders Carlsson  <ander...@apple.com>
+
+        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.
+
 2013-03-05  Tony Chang  <t...@chromium.org>
 
         Fix some crashes in render sliders

Modified: trunk/Source/WebCore/storage/StorageAreaImpl.cpp (144790 => 144791)


--- trunk/Source/WebCore/storage/StorageAreaImpl.cpp	2013-03-05 19:41:55 UTC (rev 144790)
+++ trunk/Source/WebCore/storage/StorageAreaImpl.cpp	2013-03-05 19:43:40 UTC (rev 144791)
@@ -199,7 +199,8 @@
 
     if (m_storageAreaSync)
         m_storageAreaSync->scheduleItemForSync(key, value);
-    StorageEventDispatcher::dispatch(key, oldValue, value, m_storageType, m_securityOrigin.get(), frame);
+
+    dispatchStorageEvent(key, oldValue, value, frame);
 }
 
 void StorageAreaImpl::removeItem(const String& key, ExceptionCode& ec, Frame* frame)
@@ -226,7 +227,7 @@
 
     if (m_storageAreaSync)
         m_storageAreaSync->scheduleItemForSync(key, String());
-    StorageEventDispatcher::dispatch(key, oldValue, String(), m_storageType, m_securityOrigin.get(), frame);
+    dispatchStorageEvent(key, oldValue, String(), frame);
 }
 
 void StorageAreaImpl::clear(ExceptionCode& ec, Frame* frame)
@@ -251,7 +252,7 @@
 
     if (m_storageAreaSync)
         m_storageAreaSync->scheduleClear();
-    StorageEventDispatcher::dispatch(String(), String(), String(), m_storageType, m_securityOrigin.get(), frame);
+    dispatchStorageEvent(String(), String(), String(), frame);
 }
 
 bool StorageAreaImpl::contains(const String& key, ExceptionCode& ec, Frame* frame)
@@ -360,4 +361,9 @@
     }
 }
 
+void StorageAreaImpl::dispatchStorageEvent(const String& key, const String& oldValue, const String& newValue, Frame* sourceFrame)
+{
+    StorageEventDispatcher::dispatch(key, oldValue, newValue, m_storageType, m_securityOrigin.get(), sourceFrame);
 }
+
+} // namespace WebCore

Modified: trunk/Source/WebCore/storage/StorageAreaImpl.h (144790 => 144791)


--- trunk/Source/WebCore/storage/StorageAreaImpl.h	2013-03-05 19:41:55 UTC (rev 144790)
+++ trunk/Source/WebCore/storage/StorageAreaImpl.h	2013-03-05 19:43:40 UTC (rev 144791)
@@ -35,64 +35,66 @@
 
 namespace WebCore {
 
-    class SecurityOrigin;
-    class StorageMap;
-    class StorageAreaSync;
+class SecurityOrigin;
+class StorageMap;
+class StorageAreaSync;
 
-    class StorageAreaImpl : public StorageArea {
-    public:
-        static PassRefPtr<StorageAreaImpl> create(StorageType, PassRefPtr<SecurityOrigin>, PassRefPtr<StorageSyncManager>, unsigned quota);
-        virtual ~StorageAreaImpl();
+class StorageAreaImpl : public StorageArea {
+public:
+    static PassRefPtr<StorageAreaImpl> create(StorageType, PassRefPtr<SecurityOrigin>, PassRefPtr<StorageSyncManager>, unsigned quota);
+    virtual ~StorageAreaImpl();
 
-        // The HTML5 DOM Storage API (and contains)
-        virtual unsigned length(ExceptionCode&, Frame* sourceFrame) OVERRIDE;
-        virtual String key(unsigned index, ExceptionCode&, Frame* sourceFrame) OVERRIDE;
-        virtual String getItem(const String& key, ExceptionCode&, Frame* sourceFrame) OVERRIDE;
-        virtual void setItem(const String& key, const String& value, ExceptionCode&, Frame* sourceFrame) OVERRIDE;
-        virtual void removeItem(const String& key, ExceptionCode&, Frame* sourceFrame) OVERRIDE;
-        virtual void clear(ExceptionCode&, Frame* sourceFrame) OVERRIDE;
-        virtual bool contains(const String& key, ExceptionCode&, Frame* sourceFrame) OVERRIDE;
+    // The HTML5 DOM Storage API (and contains)
+    virtual unsigned length(ExceptionCode&, Frame* sourceFrame) OVERRIDE;
+    virtual String key(unsigned index, ExceptionCode&, Frame* sourceFrame) OVERRIDE;
+    virtual String getItem(const String& key, ExceptionCode&, Frame* sourceFrame) OVERRIDE;
+    virtual void setItem(const String& key, const String& value, ExceptionCode&, Frame* sourceFrame) OVERRIDE;
+    virtual void removeItem(const String& key, ExceptionCode&, Frame* sourceFrame) OVERRIDE;
+    virtual void clear(ExceptionCode&, Frame* sourceFrame) OVERRIDE;
+    virtual bool contains(const String& key, ExceptionCode&, Frame* sourceFrame) OVERRIDE;
 
-        virtual bool canAccessStorage(Frame* sourceFrame) OVERRIDE;
+    virtual bool canAccessStorage(Frame* sourceFrame) OVERRIDE;
 
-        virtual size_t memoryBytesUsedByCache() OVERRIDE;
+    virtual size_t memoryBytesUsedByCache() OVERRIDE;
 
-        virtual void incrementAccessCount();
-        virtual void decrementAccessCount();
-        virtual void closeDatabaseIfIdle();
+    virtual void incrementAccessCount();
+    virtual void decrementAccessCount();
+    virtual void closeDatabaseIfIdle();
 
-        PassRefPtr<StorageAreaImpl> copy();
-        void close();
+    PassRefPtr<StorageAreaImpl> copy();
+    void close();
 
-        // Only called from a background thread.
-        void importItems(const HashMap<String, String>& items);
+    // Only called from a background thread.
+    void importItems(const HashMap<String, String>& items);
 
-        // Used to clear a StorageArea and close db before backing db file is deleted.
-        void clearForOriginDeletion();
+    // Used to clear a StorageArea and close db before backing db file is deleted.
+    void clearForOriginDeletion();
 
-        void sync();
+    void sync();
 
-    private:
-        StorageAreaImpl(StorageType, PassRefPtr<SecurityOrigin>, PassRefPtr<StorageSyncManager>, unsigned quota);
-        explicit StorageAreaImpl(StorageAreaImpl*);
+private:
+    StorageAreaImpl(StorageType, PassRefPtr<SecurityOrigin>, PassRefPtr<StorageSyncManager>, unsigned quota);
+    explicit StorageAreaImpl(StorageAreaImpl*);
 
-        void blockUntilImportComplete() const;
-        void closeDatabaseTimerFired(Timer<StorageAreaImpl>*);
-        bool disabledByPrivateBrowsingInFrame(const Frame* sourceFrame) const;
+    void blockUntilImportComplete() const;
+    void closeDatabaseTimerFired(Timer<StorageAreaImpl>*);
+    bool disabledByPrivateBrowsingInFrame(const Frame* sourceFrame) const;
 
-        StorageType m_storageType;
-        RefPtr<SecurityOrigin> m_securityOrigin;
-        RefPtr<StorageMap> m_storageMap;
+    void dispatchStorageEvent(const String& key, const String& oldValue, const String& newValue, Frame* sourceFrame);
 
-        RefPtr<StorageAreaSync> m_storageAreaSync;
-        RefPtr<StorageSyncManager> m_storageSyncManager;
+    StorageType m_storageType;
+    RefPtr<SecurityOrigin> m_securityOrigin;
+    RefPtr<StorageMap> m_storageMap;
 
+    RefPtr<StorageAreaSync> m_storageAreaSync;
+    RefPtr<StorageSyncManager> m_storageSyncManager;
+
 #ifndef NDEBUG
-        bool m_isShutdown;
+    bool m_isShutdown;
 #endif
-        unsigned m_accessCount;
-        Timer<StorageAreaImpl> m_closeDatabaseTimer;
-    };
+    unsigned m_accessCount;
+    Timer<StorageAreaImpl> m_closeDatabaseTimer;
+};
 
 } // namespace WebCore
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to