Skip to content
Permalink
Browse files
Get rid of PassRefPtr inside StorageManager
https://bugs.webkit.org/show_bug.cgi?id=139693

Reviewed by Andreas Kling.

* UIProcess/Storage/StorageManager.cpp:
(WebKit::StorageManager::TransientLocalStorageNamespace::getOrCreateStorageArea):
(WebKit::StorageManager::StorageArea::create):
(WebKit::StorageManager::StorageArea::StorageArea):
(WebKit::StorageManager::StorageArea::clone):
(WebKit::StorageManager::LocalStorageNamespace::create):
(WebKit::StorageManager::LocalStorageNamespace::getOrCreateStorageArea):
(WebKit::StorageManager::SessionStorageNamespace::create):
(WebKit::StorageManager::SessionStorageNamespace::getOrCreateStorageArea):
(WebKit::StorageManager::create):
* UIProcess/Storage/StorageManager.h:

Canonical link: https://commits.webkit.org/157590@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@177384 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Anders Carlsson committed Dec 16, 2014
1 parent c618d76 commit e4aa105aeb01fc8d942993bb562c227ec9914ab1
Showing with 44 additions and 26 deletions.
  1. +19 −0 Source/WebKit2/ChangeLog
  2. +24 −24 Source/WebKit2/UIProcess/Storage/StorageManager.cpp
  3. +1 −2 Source/WebKit2/UIProcess/Storage/StorageManager.h
@@ -1,3 +1,22 @@
2014-12-16 Anders Carlsson <andersca@apple.com>

Get rid of PassRefPtr inside StorageManager
https://bugs.webkit.org/show_bug.cgi?id=139693

Reviewed by Andreas Kling.

* UIProcess/Storage/StorageManager.cpp:
(WebKit::StorageManager::TransientLocalStorageNamespace::getOrCreateStorageArea):
(WebKit::StorageManager::StorageArea::create):
(WebKit::StorageManager::StorageArea::StorageArea):
(WebKit::StorageManager::StorageArea::clone):
(WebKit::StorageManager::LocalStorageNamespace::create):
(WebKit::StorageManager::LocalStorageNamespace::getOrCreateStorageArea):
(WebKit::StorageManager::SessionStorageNamespace::create):
(WebKit::StorageManager::SessionStorageNamespace::getOrCreateStorageArea):
(WebKit::StorageManager::create):
* UIProcess/Storage/StorageManager.h:

2014-12-16 Tim Horton <timothy_horton@apple.com>

Disable TextIndication for Lookup immediate actions
@@ -46,15 +46,15 @@ namespace WebKit {

class StorageManager::StorageArea : public ThreadSafeRefCounted<StorageManager::StorageArea> {
public:
static RefPtr<StorageArea> create(LocalStorageNamespace*, PassRefPtr<SecurityOrigin>, unsigned quotaInBytes);
static RefPtr<StorageArea> create(LocalStorageNamespace*, RefPtr<SecurityOrigin>&&, unsigned quotaInBytes);
~StorageArea();

SecurityOrigin* securityOrigin() const { return m_securityOrigin.get(); }

void addListener(IPC::Connection*, uint64_t storageMapID);
void removeListener(IPC::Connection*, uint64_t storageMapID);

PassRefPtr<StorageArea> clone() const;
RefPtr<StorageArea> clone() const;

void setItem(IPC::Connection* sourceConnection, uint64_t sourceStorageAreaID, const String& key, const String& value, const String& urlString, bool& quotaException);
void removeItem(IPC::Connection* sourceConnection, uint64_t sourceStorageAreaID, const String& key, const String& urlString);
@@ -64,7 +64,7 @@ class StorageManager::StorageArea : public ThreadSafeRefCounted<StorageManager::
void clear();

private:
explicit StorageArea(LocalStorageNamespace*, PassRefPtr<SecurityOrigin>, unsigned quotaInBytes);
explicit StorageArea(LocalStorageNamespace*, RefPtr<SecurityOrigin>&&, unsigned quotaInBytes);

void openDatabaseAndImportItemsIfNeeded();

@@ -84,12 +84,12 @@ class StorageManager::StorageArea : public ThreadSafeRefCounted<StorageManager::

class StorageManager::LocalStorageNamespace : public ThreadSafeRefCounted<LocalStorageNamespace> {
public:
static PassRefPtr<LocalStorageNamespace> create(StorageManager*, uint64_t storageManagerID);
static RefPtr<LocalStorageNamespace> create(StorageManager*, uint64_t storageManagerID);
~LocalStorageNamespace();

StorageManager* storageManager() const { return m_storageManager; }

PassRefPtr<StorageArea> getOrCreateStorageArea(PassRefPtr<SecurityOrigin>);
RefPtr<StorageArea> getOrCreateStorageArea(RefPtr<SecurityOrigin>&&);
void didDestroyStorageArea(StorageArea*);

void clearStorageAreasMatchingOrigin(SecurityOrigin*);
@@ -117,13 +117,13 @@ class StorageManager::TransientLocalStorageNamespace : public ThreadSafeRefCount
{
}

RefPtr<StorageArea> getOrCreateStorageArea(PassRefPtr<SecurityOrigin> securityOrigin)
RefPtr<StorageArea> getOrCreateStorageArea(RefPtr<SecurityOrigin>&& securityOrigin)
{
auto& slot = m_storageAreaMap.add(securityOrigin.get(), nullptr).iterator->value;
auto& slot = m_storageAreaMap.add(securityOrigin, nullptr).iterator->value;
if (slot)
return slot;

auto storageArea = StorageArea::create(nullptr, securityOrigin, m_quotaInBytes);
auto storageArea = StorageArea::create(nullptr, WTF::move(securityOrigin), m_quotaInBytes);
slot = storageArea.get();

return storageArea;
@@ -154,15 +154,15 @@ class StorageManager::TransientLocalStorageNamespace : public ThreadSafeRefCount
HashMap<RefPtr<SecurityOrigin>, StorageArea*> m_storageAreaMap;
};

RefPtr<StorageManager::StorageArea> StorageManager::StorageArea::create(LocalStorageNamespace* localStorageNamespace, PassRefPtr<SecurityOrigin> securityOrigin, unsigned quotaInBytes)
RefPtr<StorageManager::StorageArea> StorageManager::StorageArea::create(LocalStorageNamespace* localStorageNamespace, RefPtr<SecurityOrigin>&& securityOrigin, unsigned quotaInBytes)
{
return adoptRef(new StorageArea(localStorageNamespace, securityOrigin, quotaInBytes));
return adoptRef(new StorageArea(localStorageNamespace, WTF::move(securityOrigin), quotaInBytes));
}

StorageManager::StorageArea::StorageArea(LocalStorageNamespace* localStorageNamespace, PassRefPtr<SecurityOrigin> securityOrigin, unsigned quotaInBytes)
StorageManager::StorageArea::StorageArea(LocalStorageNamespace* localStorageNamespace, RefPtr<SecurityOrigin>&& securityOrigin, unsigned quotaInBytes)
: m_localStorageNamespace(localStorageNamespace)
, m_didImportItemsFromDatabase(false)
, m_securityOrigin(securityOrigin)
, m_securityOrigin(WTF::move(securityOrigin))
, m_quotaInBytes(quotaInBytes)
, m_storageMap(StorageMap::create(m_quotaInBytes))
{
@@ -191,14 +191,14 @@ void StorageManager::StorageArea::removeListener(IPC::Connection* connection, ui
m_eventListeners.remove(std::make_pair(connection, storageMapID));
}

PassRefPtr<StorageManager::StorageArea> StorageManager::StorageArea::clone() const
RefPtr<StorageManager::StorageArea> StorageManager::StorageArea::clone() const
{
ASSERT(!m_localStorageNamespace);

RefPtr<StorageArea> storageArea = StorageArea::create(0, m_securityOrigin, m_quotaInBytes);
auto storageArea = StorageArea::create(0, m_securityOrigin.copyRef(), m_quotaInBytes);
storageArea->m_storageMap = m_storageMap;

return storageArea.release();
return storageArea;
}

void StorageManager::StorageArea::setItem(IPC::Connection* sourceConnection, uint64_t sourceStorageAreaID, const String& key, const String& value, const String& urlString, bool& quotaException)
@@ -298,7 +298,7 @@ void StorageManager::StorageArea::dispatchEvents(IPC::Connection* sourceConnecti
}
}

PassRefPtr<StorageManager::LocalStorageNamespace> StorageManager::LocalStorageNamespace::create(StorageManager* storageManager, uint64_t storageNamespaceID)
RefPtr<StorageManager::LocalStorageNamespace> StorageManager::LocalStorageNamespace::create(StorageManager* storageManager, uint64_t storageNamespaceID)
{
return adoptRef(new LocalStorageNamespace(storageManager, storageNamespaceID));
}
@@ -317,13 +317,13 @@ StorageManager::LocalStorageNamespace::~LocalStorageNamespace()
ASSERT(m_storageAreaMap.isEmpty());
}

PassRefPtr<StorageManager::StorageArea> StorageManager::LocalStorageNamespace::getOrCreateStorageArea(PassRefPtr<SecurityOrigin> securityOrigin)
RefPtr<StorageManager::StorageArea> StorageManager::LocalStorageNamespace::getOrCreateStorageArea(RefPtr<SecurityOrigin>&& securityOrigin)
{
auto result = m_storageAreaMap.add(securityOrigin, nullptr);
if (!result.isNewEntry)
return result.iterator->value;

RefPtr<StorageArea> storageArea = StorageArea::create(this, result.iterator->key, m_quotaInBytes);
RefPtr<StorageArea> storageArea = StorageArea::create(this, result.iterator->key.copyRef(), m_quotaInBytes);
result.iterator->value = storageArea.get();

return storageArea.release();
@@ -357,15 +357,15 @@ void StorageManager::LocalStorageNamespace::clearAllStorageAreas()

class StorageManager::SessionStorageNamespace : public ThreadSafeRefCounted<SessionStorageNamespace> {
public:
static PassRefPtr<SessionStorageNamespace> create(IPC::Connection* allowedConnection, unsigned quotaInBytes);
static RefPtr<SessionStorageNamespace> create(IPC::Connection* allowedConnection, unsigned quotaInBytes);
~SessionStorageNamespace();

bool isEmpty() const { return m_storageAreaMap.isEmpty(); }

IPC::Connection* allowedConnection() const { return m_allowedConnection.get(); }
void setAllowedConnection(IPC::Connection*);

PassRefPtr<StorageArea> getOrCreateStorageArea(PassRefPtr<SecurityOrigin>);
RefPtr<StorageArea> getOrCreateStorageArea(RefPtr<SecurityOrigin>&&);

void cloneTo(SessionStorageNamespace& newSessionStorageNamespace);

@@ -378,7 +378,7 @@ class StorageManager::SessionStorageNamespace : public ThreadSafeRefCounted<Sess
HashMap<RefPtr<SecurityOrigin>, RefPtr<StorageArea>> m_storageAreaMap;
};

PassRefPtr<StorageManager::SessionStorageNamespace> StorageManager::SessionStorageNamespace::create(IPC::Connection* allowedConnection, unsigned quotaInBytes)
RefPtr<StorageManager::SessionStorageNamespace> StorageManager::SessionStorageNamespace::create(IPC::Connection* allowedConnection, unsigned quotaInBytes)
{
return adoptRef(new SessionStorageNamespace(allowedConnection, quotaInBytes));
}
@@ -400,11 +400,11 @@ void StorageManager::SessionStorageNamespace::setAllowedConnection(IPC::Connecti
m_allowedConnection = allowedConnection;
}

PassRefPtr<StorageManager::StorageArea> StorageManager::SessionStorageNamespace::getOrCreateStorageArea(PassRefPtr<SecurityOrigin> securityOrigin)
RefPtr<StorageManager::StorageArea> StorageManager::SessionStorageNamespace::getOrCreateStorageArea(RefPtr<SecurityOrigin>&& securityOrigin)
{
auto result = m_storageAreaMap.add(securityOrigin, nullptr);
if (result.isNewEntry)
result.iterator->value = StorageArea::create(0, result.iterator->key, m_quotaInBytes);
result.iterator->value = StorageArea::create(0, result.iterator->key.copyRef(), m_quotaInBytes);

return result.iterator->value;
}
@@ -417,7 +417,7 @@ void StorageManager::SessionStorageNamespace::cloneTo(SessionStorageNamespace& n
newSessionStorageNamespace.m_storageAreaMap.add(it->key, it->value->clone());
}

PassRefPtr<StorageManager> StorageManager::create(const String& localStorageDirectory)
RefPtr<StorageManager> StorageManager::create(const String& localStorageDirectory)
{
return adoptRef(new StorageManager(localStorageDirectory));
}
@@ -29,7 +29,6 @@
#include "Connection.h"
#include <chrono>
#include <wtf/Forward.h>
#include <wtf/PassRefPtr.h>
#include <wtf/ThreadSafeRefCounted.h>
#include <wtf/text/StringHash.h>

@@ -48,7 +47,7 @@ class WebProcessProxy;

class StorageManager : public IPC::Connection::WorkQueueMessageReceiver {
public:
static PassRefPtr<StorageManager> create(const String& localStorageDirectory);
static RefPtr<StorageManager> create(const String& localStorageDirectory);
~StorageManager();

void createSessionStorageNamespace(uint64_t storageNamespaceID, IPC::Connection* allowedConnection, unsigned quotaInBytes);

0 comments on commit e4aa105

Please sign in to comment.