2008-04-23 Brady Eidson <beidson@apple.com>
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Apr 2008 03:39:23 +0000 (03:39 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Apr 2008 03:39:23 +0000 (03:39 +0000)
        Reviewed by Jon Honeycutt

        Preparing for making LocalStorageAreas persistent.

        Since LocalStorageAreas will need to do a lot of additional work for each of the basic
        operations a Storage object supports, this patch makes the API entry points virtual so
        LocalStorageArea can override them.  The behavior for both Local and Session StorageAreas
        is unchanged with this patch, but LocalStorageArea will override them in the future.

        * storage/StorageArea.cpp: Rename the implementations to internalFoo
        (WebCore::StorageArea::internalLength):
        (WebCore::StorageArea::internalKey):
        (WebCore::StorageArea::internalGetItem):
        (WebCore::StorageArea::internalSetItem):
        (WebCore::StorageArea::internalRemoveItem):
        (WebCore::StorageArea::internalContains):

        * storage/StorageArea.h: Call internalFoo variants
        (WebCore::StorageArea::length):
        (WebCore::StorageArea::key):
        (WebCore::StorageArea::getItem):
        (WebCore::StorageArea::setItem):
        (WebCore::StorageArea::removeItem):
        (WebCore::StorageArea::contains):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@32454 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/storage/StorageArea.cpp
WebCore/storage/StorageArea.h

index d5d4358..0c66808 100644 (file)
@@ -1,3 +1,30 @@
+2008-04-23  Brady Eidson  <beidson@apple.com>
+
+        Reviewed by Jon Honeycutt
+
+        Preparing for making LocalStorageAreas persistent.
+
+        Since LocalStorageAreas will need to do a lot of additional work for each of the basic
+        operations a Storage object supports, this patch makes the API entry points virtual so
+        LocalStorageArea can override them.  The behavior for both Local and Session StorageAreas
+        is unchanged with this patch, but LocalStorageArea will override them in the future.
+
+        * storage/StorageArea.cpp: Rename the implementations to internalFoo
+        (WebCore::StorageArea::internalLength):
+        (WebCore::StorageArea::internalKey):
+        (WebCore::StorageArea::internalGetItem):
+        (WebCore::StorageArea::internalSetItem):
+        (WebCore::StorageArea::internalRemoveItem):
+        (WebCore::StorageArea::internalContains):
+
+        * storage/StorageArea.h: Call internalFoo variants
+        (WebCore::StorageArea::length):
+        (WebCore::StorageArea::key):
+        (WebCore::StorageArea::getItem):
+        (WebCore::StorageArea::setItem):
+        (WebCore::StorageArea::removeItem):
+        (WebCore::StorageArea::contains):
+
 2008-04-23  David Hyatt  <hyatt@apple.com>
 
         Implement getComputedStyle for border-image.
index b3b9161..315dff0 100644 (file)
@@ -28,7 +28,6 @@
 
 #include "CString.h"
 #include "ExceptionCode.h"
-#include "PlatformString.h"
 #include "SecurityOrigin.h"
 #include "StorageMap.h"
 
@@ -50,12 +49,12 @@ StorageArea::~StorageArea()
 {
 }
 
-unsigned StorageArea::length() const
+unsigned StorageArea::internalLength() const
 {
     return m_storageMap->length();
 }
 
-String StorageArea::key(unsigned index, ExceptionCode& ec) const
+String StorageArea::internalKey(unsigned index, ExceptionCode& ec) const
 {
     String key;
     
@@ -67,12 +66,12 @@ String StorageArea::key(unsigned index, ExceptionCode& ec) const
     return key;
 }
 
-String StorageArea::getItem(const String& key) const
+String StorageArea::internalGetItem(const String& key) const
 {
     return m_storageMap->getItem(key);
 }
 
-void StorageArea::setItem(const String& key, const String& value, ExceptionCode& ec, Frame* frame)
+void StorageArea::internalSetItem(const String& key, const String& value, ExceptionCode& ec, Frame* frame)
 {
     ASSERT(!value.isNull());
     
@@ -94,8 +93,8 @@ void StorageArea::setItem(const String& key, const String& value, ExceptionCode&
         itemChanged(key, oldValue, value, frame);
 }
 
-void StorageArea::removeItem(const String& key, Frame* frame)
-{    
+void StorageArea::internalRemoveItem(const String& key, Frame* frame)
+{   
     String oldValue;
     RefPtr<StorageMap> newMap = m_storageMap->removeItem(key, oldValue);
     if (newMap)
@@ -106,7 +105,7 @@ void StorageArea::removeItem(const String& key, Frame* frame)
         itemRemoved(key, oldValue, frame);
 }
 
-bool StorageArea::contains(const String& key) const
+bool StorageArea::internalContains(const String& key) const
 {
     return m_storageMap->contains(key);
 }
index 0aaa3ab..fd5366f 100644 (file)
@@ -26,6 +26,8 @@
 #ifndef StorageArea_h
 #define StorageArea_h
 
+#include "PlatformString.h"
+
 #include <wtf/Forward.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
@@ -36,20 +38,18 @@ namespace WebCore {
     class Frame;
     class SecurityOrigin;
     class StorageMap;
-    class String;
     typedef int ExceptionCode;
 
     class StorageArea : public RefCounted<StorageArea> {
     public:
         virtual ~StorageArea();
         
-        unsigned length() const;
-        String key(unsigned index, ExceptionCode&) const;
-        String getItem(const String&) const;
-        void setItem(const String& key, const String& value, ExceptionCode&, Frame* sourceFrame);
-        void removeItem(const String&, Frame* sourceFrame);
-
-        bool contains(const String& key) const;
+        virtual unsigned length() const { return internalLength(); }
+        virtual String key(unsigned index, ExceptionCode& ec) const { return internalKey(index, ec); }
+        virtual String getItem(const String& key) const { return internalGetItem(key); }
+        virtual void setItem(const String& key, const String& value, ExceptionCode& ec, Frame* sourceFrame) { internalSetItem(key, value, ec, sourceFrame); }
+        virtual void removeItem(const String& key, Frame* sourceFrame) { internalRemoveItem(key, sourceFrame); }
+        virtual bool contains(const String& key) const { return internalContains(key); }
         
         SecurityOrigin* securityOrigin() { return m_securityOrigin.get(); }
 
@@ -57,6 +57,13 @@ namespace WebCore {
         StorageArea(SecurityOrigin*);
         StorageArea(SecurityOrigin*, StorageArea*);
                 
+        unsigned internalLength() const;
+        String internalKey(unsigned index, ExceptionCode&) const;
+        String internalGetItem(const String&) const;
+        void internalSetItem(const String& key, const String& value, ExceptionCode&, Frame* sourceFrame);
+        void internalRemoveItem(const String&, Frame* sourceFrame);
+        bool internalContains(const String& key) const;
+
     private:
         virtual void itemChanged(const String& key, const String& oldValue, const String& newValue, Frame* sourceFrame) = 0;
         virtual void itemRemoved(const String& key, const String& oldValue, Frame* sourceFrame) = 0;