This source file includes following definitions.
- localStorageArea
- storageArea
- isSameNamespace
#include "config.h"
#include "core/storage/StorageNamespace.h"
#include "core/storage/StorageArea.h"
#include "platform/weborigin/SecurityOrigin.h"
#include "public/platform/Platform.h"
#include "public/platform/WebStorageArea.h"
#include "public/platform/WebStorageNamespace.h"
#include "wtf/MainThread.h"
namespace WebCore {
StorageNamespace::StorageNamespace(PassOwnPtr<blink::WebStorageNamespace> webStorageNamespace)
: m_webStorageNamespace(webStorageNamespace)
{
}
StorageNamespace::~StorageNamespace()
{
}
PassOwnPtrWillBeRawPtr<StorageArea> StorageNamespace::localStorageArea(SecurityOrigin* origin)
{
ASSERT(isMainThread());
static blink::WebStorageNamespace* localStorageNamespace = 0;
if (!localStorageNamespace)
localStorageNamespace = blink::Platform::current()->createLocalStorageNamespace();
return adoptPtrWillBeNoop(new StorageArea(adoptPtr(localStorageNamespace->createStorageArea(origin->toString())), LocalStorage));
}
PassOwnPtrWillBeRawPtr<StorageArea> StorageNamespace::storageArea(SecurityOrigin* origin)
{
return adoptPtrWillBeNoop(new StorageArea(adoptPtr(m_webStorageNamespace->createStorageArea(origin->toString())), SessionStorage));
}
bool StorageNamespace::isSameNamespace(const blink::WebStorageNamespace& sessionNamespace) const
{
return m_webStorageNamespace && m_webStorageNamespace->isSameNamespace(sessionNamespace);
}
}