StorageAreaImpl.cpp [plain text]
#include "config.h"
#include "StorageAreaImpl.h"
#include "StorageAreaMap.h"
#include <WebCore/Document.h>
#include <WebCore/Frame.h>
#include <WebCore/Page.h>
#include <WebCore/SchemeRegistry.h>
#include <WebCore/SecurityOriginData.h>
#include <WebCore/Settings.h>
using namespace WebCore;
namespace WebKit {
static uint64_t generateStorageAreaID()
{
static uint64_t storageAreaID;
return ++storageAreaID;
}
Ref<StorageAreaImpl> StorageAreaImpl::create(Ref<StorageAreaMap>&& storageAreaMap)
{
return adoptRef(*new StorageAreaImpl(WTFMove(storageAreaMap)));
}
StorageAreaImpl::StorageAreaImpl(Ref<StorageAreaMap>&& storageAreaMap)
: m_storageAreaID(generateStorageAreaID())
, m_storageAreaMap(WTFMove(storageAreaMap))
{
}
StorageAreaImpl::~StorageAreaImpl()
{
}
unsigned StorageAreaImpl::length()
{
return m_storageAreaMap->length();
}
String StorageAreaImpl::key(unsigned index)
{
return m_storageAreaMap->key(index);
}
String StorageAreaImpl::item(const String& key)
{
return m_storageAreaMap->item(key);
}
void StorageAreaImpl::setItem(Frame* sourceFrame, const String& key, const String& value, bool& quotaException)
{
ASSERT(!value.isNull());
m_storageAreaMap->setItem(sourceFrame, this, key, value, quotaException);
}
void StorageAreaImpl::removeItem(Frame* sourceFrame, const String& key)
{
m_storageAreaMap->removeItem(sourceFrame, this, key);
}
void StorageAreaImpl::clear(Frame* sourceFrame)
{
m_storageAreaMap->clear(sourceFrame, this);
}
bool StorageAreaImpl::contains(const String& key)
{
return m_storageAreaMap->contains(key);
}
bool StorageAreaImpl::canAccessStorage(Frame* frame)
{
return frame && frame->page();
}
StorageType StorageAreaImpl::storageType() const
{
return m_storageAreaMap->storageType();
}
size_t StorageAreaImpl::memoryBytesUsedByCache()
{
return 0;
}
void StorageAreaImpl::incrementAccessCount()
{
}
void StorageAreaImpl::decrementAccessCount()
{
}
void StorageAreaImpl::closeDatabaseIfIdle()
{
ASSERT_NOT_REACHED();
}
WebCore::SecurityOriginData StorageAreaImpl::securityOrigin() const
{
return WebCore::SecurityOriginData::fromSecurityOrigin(m_storageAreaMap->securityOrigin());
}
}