Changeset 143396 in webkit


Ignore:
Timestamp:
Feb 19, 2013, 3:31:58 PM (12 years ago)
Author:
andersca@apple.com
Message:

StorageAreaProxy should know its quota
https://bugs.webkit.org/show_bug.cgi?id=110268

Reviewed by Sam Weinig.

Begin stubbing out StorageAreaProxy::setItem and add some quota member variables.

  • WebProcess/Storage/StorageAreaProxy.cpp:

(WebKit::StorageAreaProxy::StorageAreaProxy):
(WebKit::StorageAreaProxy::setItem):

  • WebProcess/Storage/StorageAreaProxy.h:

(StorageAreaProxy):

  • WebProcess/Storage/StorageNamespaceProxy.cpp:

(WebKit::StorageNamespaceProxy::createSessionStorageNamespace):
(WebKit::StorageNamespaceProxy::StorageNamespaceProxy):

  • WebProcess/Storage/StorageNamespaceProxy.h:

(WebKit::StorageNamespaceProxy::quota):
(StorageNamespaceProxy):

Location:
trunk/Source/WebKit2
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r143385 r143396  
     12013-02-19  Anders Carlsson  <andersca@apple.com>
     2
     3        StorageAreaProxy should know its quota
     4        https://bugs.webkit.org/show_bug.cgi?id=110268
     5
     6        Reviewed by Sam Weinig.
     7
     8        Begin stubbing out StorageAreaProxy::setItem and add some quota member variables.
     9
     10        * WebProcess/Storage/StorageAreaProxy.cpp:
     11        (WebKit::StorageAreaProxy::StorageAreaProxy):
     12        (WebKit::StorageAreaProxy::setItem):
     13        * WebProcess/Storage/StorageAreaProxy.h:
     14        (StorageAreaProxy):
     15        * WebProcess/Storage/StorageNamespaceProxy.cpp:
     16        (WebKit::StorageNamespaceProxy::createSessionStorageNamespace):
     17        (WebKit::StorageNamespaceProxy::StorageNamespaceProxy):
     18        * WebProcess/Storage/StorageNamespaceProxy.h:
     19        (WebKit::StorageNamespaceProxy::quota):
     20        (StorageNamespaceProxy):
     21
    1222013-02-19  Alexey Proskuryakov  <ap@apple.com>
    223
  • trunk/Source/WebKit2/WebProcess/Storage/StorageAreaProxy.cpp

    r143050 r143396  
    5353StorageAreaProxy::StorageAreaProxy(StorageNamespaceProxy* storageNamespaceProxy, PassRefPtr<SecurityOrigin> securityOrigin)
    5454    : m_storageType(storageNamespaceProxy->storageType())
     55    , m_quotaInBytes(storageNamespaceProxy->quotaInBytes())
    5556    , m_storageAreaID(generateStorageAreaID())
    5657{
     
    6364}
    6465
    65 unsigned StorageAreaProxy::length(ExceptionCode& exceptionCode, Frame* sourceFrame)
     66unsigned StorageAreaProxy::length(ExceptionCode& ec, Frame* sourceFrame)
    6667{
    67     exceptionCode = 0;
     68    ec = 0;
    6869    if (!canAccessStorage(sourceFrame)) {
    69         exceptionCode = SECURITY_ERR;
     70        ec = SECURITY_ERR;
    7071        return 0;
    7172    }
     
    9293}
    9394
    94 void StorageAreaProxy::setItem(const String& key, const String& value, ExceptionCode&, Frame* sourceFrame)
     95void StorageAreaProxy::setItem(const String& key, const String& value, ExceptionCode& ec, Frame* sourceFrame)
    9596{
    96     // FIXME: Implement this.
     97    ec = 0;
     98    if (!canAccessStorage(sourceFrame)) {
     99        ec = SECURITY_ERR;
     100        return;
     101    }
     102
     103    ASSERT(!value.isNull());
     104
     105    if (disabledByPrivateBrowsingInFrame(sourceFrame)) {
     106        ec = QUOTA_EXCEEDED_ERR;
     107        return;
     108    }
     109
     110    loadValuesIfNeeded();
     111
     112    // FIXME: Actually set the value.
    97113    ASSERT_NOT_REACHED();
    98114}
  • trunk/Source/WebKit2/WebProcess/Storage/StorageAreaProxy.h

    r143038 r143396  
    6161
    6262    WebCore::StorageType m_storageType;
     63    unsigned m_quotaInBytes;
    6364    uint64_t m_storageAreaID;
    6465    OwnPtr<HashMap<String, String> > m_values;
  • trunk/Source/WebKit2/WebProcess/Storage/StorageNamespaceProxy.cpp

    r143038 r143396  
    3030#include "WebPage.h"
    3131#include <WebCore/SecurityOrigin.h>
     32#include <WebCore/Settings.h>
    3233
    3334using namespace WebCore;
     
    3738PassRefPtr<StorageNamespaceProxy> StorageNamespaceProxy::createSessionStorageNamespace(WebPage* webPage)
    3839{
    39     return adoptRef(new StorageNamespaceProxy(webPage));
     40    return adoptRef(new StorageNamespaceProxy(webPage->pageID(), webPage->corePage()->settings()->sessionStorageQuota()));
    4041}
    4142
    42 StorageNamespaceProxy::StorageNamespaceProxy(WebPage* webPage)
    43     : m_storageNamespaceID(webPage->pageID())
     43StorageNamespaceProxy::StorageNamespaceProxy(uint64_t storageNamespaceID, unsigned quotaInBytes)
     44    : m_storageNamespaceID(storageNamespaceID)
     45    , m_quotaInBytes(quotaInBytes)
    4446{
    4547}
  • trunk/Source/WebKit2/WebProcess/Storage/StorageNamespaceProxy.h

    r143038 r143396  
    4040
    4141    uint64_t storageNamespaceID() const { return m_storageNamespaceID; }
     42    unsigned quotaInBytes() const { return m_quotaInBytes; }
     43
    4244    WebCore::StorageType storageType() const;
    4345
    4446private:
    45     explicit StorageNamespaceProxy(WebPage*);
     47    explicit StorageNamespaceProxy(uint64_t storageNamespaceID, unsigned quotaInBytes);
    4648
    4749    virtual PassRefPtr<WebCore::StorageArea> storageArea(PassRefPtr<WebCore::SecurityOrigin>) OVERRIDE;
     
    5456
    5557    uint64_t m_storageNamespaceID;
     58    unsigned m_quotaInBytes;
    5659};
    5760
Note: See TracChangeset for help on using the changeset viewer.