Skip to content
Permalink
Browse files
Convert WebKeyValueStorageManager and WebMediaCacheManager to Message…
…Receiver

https://bugs.webkit.org/show_bug.cgi?id=105751

Reviewed by Andreas Kling.

* WebProcess/KeyValueStorage/WebKeyValueStorageManager.cpp:
(WebKit::WebKeyValueStorageManager::WebKeyValueStorageManager):
(WebKit::WebKeyValueStorageManager::dispatchDidGetKeyValueStorageOrigins):
(WebKit::WebKeyValueStorageManager::getKeyValueStorageOrigins):
(WebKit::WebKeyValueStorageManager::deleteEntriesForOrigin):
(WebKit::WebKeyValueStorageManager::deleteAllEntries):
* WebProcess/KeyValueStorage/WebKeyValueStorageManager.h:
(WebKeyValueStorageManager): Remove unused m_originsLoaded member variable.
* WebProcess/MediaCache/WebMediaCacheManager.cpp:
(WebKit::WebMediaCacheManager::WebMediaCacheManager):
(WebKit::WebMediaCacheManager::getHostnamesWithMediaCache):
(WebKit::WebMediaCacheManager::clearCacheForHostname):
(WebKit::WebMediaCacheManager::clearCacheForAllHostnames):
* WebProcess/MediaCache/WebMediaCacheManager.h:
(WebMediaCacheManager):
Convert the managers to MessageReceiver.

* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::WebProcess):
(WebKit::WebProcess::initializeWebProcess):
(WebKit::WebProcess::didReceiveMessage):
* WebProcess/WebProcess.h:
(WebProcess):
Add the new managers.


Canonical link: https://commits.webkit.org/123963@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@138479 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
weinig committed Dec 26, 2012
1 parent 1005c8c commit e5af015431443ccb9914cb40c6ffe487cb1dd52f
Showing 7 changed files with 78 additions and 70 deletions.
@@ -1,3 +1,35 @@
2012-12-25 Sam Weinig <sam@webkit.org>

Convert WebKeyValueStorageManager and WebMediaCacheManager to MessageReceiver
https://bugs.webkit.org/show_bug.cgi?id=105751

Reviewed by Andreas Kling.

* WebProcess/KeyValueStorage/WebKeyValueStorageManager.cpp:
(WebKit::WebKeyValueStorageManager::WebKeyValueStorageManager):
(WebKit::WebKeyValueStorageManager::dispatchDidGetKeyValueStorageOrigins):
(WebKit::WebKeyValueStorageManager::getKeyValueStorageOrigins):
(WebKit::WebKeyValueStorageManager::deleteEntriesForOrigin):
(WebKit::WebKeyValueStorageManager::deleteAllEntries):
* WebProcess/KeyValueStorage/WebKeyValueStorageManager.h:
(WebKeyValueStorageManager): Remove unused m_originsLoaded member variable.
* WebProcess/MediaCache/WebMediaCacheManager.cpp:
(WebKit::WebMediaCacheManager::WebMediaCacheManager):
(WebKit::WebMediaCacheManager::getHostnamesWithMediaCache):
(WebKit::WebMediaCacheManager::clearCacheForHostname):
(WebKit::WebMediaCacheManager::clearCacheForAllHostnames):
* WebProcess/MediaCache/WebMediaCacheManager.h:
(WebMediaCacheManager):
Convert the managers to MessageReceiver.

* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::WebProcess):
(WebKit::WebProcess::initializeWebProcess):
(WebKit::WebProcess::didReceiveMessage):
* WebProcess/WebProcess.h:
(WebProcess):
Add the new managers.

2012-12-25 Sam Weinig <sam@webkit.org>

Fix the Database manager assert, again.
@@ -26,11 +26,10 @@
#include "config.h"
#include "WebKeyValueStorageManager.h"

#include "MessageID.h"
#include "SecurityOriginData.h"
#include "WebKeyValueStorageManagerMessages.h"
#include "WebKeyValueStorageManagerProxyMessages.h"
#include "WebProcess.h"

#include <WebCore/SecurityOrigin.h>
#include <WebCore/SecurityOriginHash.h>
#include <WebCore/StorageTracker.h>
@@ -39,14 +38,10 @@ using namespace WebCore;

namespace WebKit {

WebKeyValueStorageManager& WebKeyValueStorageManager::shared()
{
static WebKeyValueStorageManager& shared = *new WebKeyValueStorageManager;
return shared;
}

WebKeyValueStorageManager::WebKeyValueStorageManager()
WebKeyValueStorageManager::WebKeyValueStorageManager(WebProcess* process)
: m_process(process)
{
m_process->addMessageReceiver(Messages::WebKeyValueStorageManager::messageReceiverName(), this);
}

void WebKeyValueStorageManager::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder)
@@ -76,14 +71,14 @@ static void keyValueStorageOriginIdentifiers(Vector<SecurityOriginData>& identif
}
}

static void dispatchDidGetKeyValueStorageOrigins(const Vector<SecurityOriginData>& identifiers, uint64_t callbackID)
void WebKeyValueStorageManager::dispatchDidGetKeyValueStorageOrigins(const Vector<SecurityOriginData>& identifiers, uint64_t callbackID)
{
WebProcess::shared().connection()->send(Messages::WebKeyValueStorageManagerProxy::DidGetKeyValueStorageOrigins(identifiers, callbackID), 0);
m_process->send(Messages::WebKeyValueStorageManagerProxy::DidGetKeyValueStorageOrigins(identifiers, callbackID), 0);
}

void WebKeyValueStorageManager::getKeyValueStorageOrigins(uint64_t callbackID)
{
WebProcess::LocalTerminationDisabler terminationDisabler(WebProcess::shared());
ChildProcess::LocalTerminationDisabler terminationDisabler(*m_process);

if (!StorageTracker::tracker().originsLoaded()) {
m_originsRequestCallbackIDs.append(callbackID);
@@ -115,7 +110,7 @@ void WebKeyValueStorageManager::dispatchDidModifyOrigin(const String&)

void WebKeyValueStorageManager::deleteEntriesForOrigin(const SecurityOriginData& originData)
{
WebProcess::LocalTerminationDisabler terminationDisabler(WebProcess::shared());
ChildProcess::LocalTerminationDisabler terminationDisabler(*m_process);

RefPtr<SecurityOrigin> origin = SecurityOrigin::create(originData.protocol, originData.host, originData.port);
if (!origin)
@@ -126,7 +121,7 @@ void WebKeyValueStorageManager::deleteEntriesForOrigin(const SecurityOriginData&

void WebKeyValueStorageManager::deleteAllEntries()
{
WebProcess::LocalTerminationDisabler terminationDisabler(WebProcess::shared());
ChildProcess::LocalTerminationDisabler terminationDisabler(*m_process);
StorageTracker::tracker().deleteAllOrigins();
}

@@ -26,43 +26,38 @@
#ifndef WebKeyValueStorageManager_h
#define WebKeyValueStorageManager_h

#include "MessageReceiver.h"
#include <WebCore/StorageTrackerClient.h>
#include <wtf/Noncopyable.h>
#include <wtf/text/WTFString.h>

namespace CoreIPC {
class Connection;
class MessageDecoder;
class MessageID;
}
#include <wtf/Vector.h>

namespace WebKit {

class WebProcess;
struct SecurityOriginData;

class WebKeyValueStorageManager : public WebCore::StorageTrackerClient {
class WebKeyValueStorageManager : public WebCore::StorageTrackerClient, private CoreIPC::MessageReceiver {
WTF_MAKE_NONCOPYABLE(WebKeyValueStorageManager);

public:
static WebKeyValueStorageManager& shared();

void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&);
explicit WebKeyValueStorageManager(WebProcess*);

private:
WebKeyValueStorageManager();

void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&) OVERRIDE;
void didReceiveWebKeyValueStorageManagerMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&);

void getKeyValueStorageOrigins(uint64_t callbackID);
void deleteEntriesForOrigin(const SecurityOriginData&);
void deleteAllEntries();

void dispatchDidGetKeyValueStorageOrigins(const Vector<SecurityOriginData>& identifiers, uint64_t callbackID);

// WebCore::StorageTrackerClient
virtual void dispatchDidModifyOrigin(const String&) OVERRIDE;
virtual void didFinishLoadingOrigins() OVERRIDE;

void didReceiveWebKeyValueStorageManagerMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&);

Vector<uint64_t> m_originsRequestCallbackIDs;
bool m_originsLoaded;

WebProcess* m_process;
};

} // namespace WebKit
@@ -26,8 +26,7 @@
#include "config.h"
#include "WebMediaCacheManager.h"

#include "MessageID.h"
#include "SecurityOriginData.h"
#include "WebMediaCacheManagerMessages.h"
#include "WebMediaCacheManagerProxyMessages.h"
#include "WebProcess.h"
#include <WebCore/HTMLMediaElement.h>
@@ -36,14 +35,10 @@ using namespace WebCore;

namespace WebKit {

WebMediaCacheManager& WebMediaCacheManager::shared()
{
static WebMediaCacheManager& shared = *new WebMediaCacheManager;
return shared;
}

WebMediaCacheManager::WebMediaCacheManager()
WebMediaCacheManager::WebMediaCacheManager(WebProcess* process)
: m_process(process)
{
m_process->addMessageReceiver(Messages::WebMediaCacheManager::messageReceiverName(), this);
}

void WebMediaCacheManager::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder)
@@ -53,20 +48,20 @@ void WebMediaCacheManager::didReceiveMessage(CoreIPC::Connection* connection, Co

void WebMediaCacheManager::getHostnamesWithMediaCache(uint64_t callbackID)
{
WebProcess::LocalTerminationDisabler terminationDisabler(WebProcess::shared());
ChildProcess::LocalTerminationDisabler terminationDisabler(*m_process);

Vector<String> mediaCacheHostnames;

#if ENABLE(VIDEO)
HTMLMediaElement::getSitesInMediaCache(mediaCacheHostnames);
#endif

WebProcess::shared().connection()->send(Messages::WebMediaCacheManagerProxy::DidGetHostnamesWithMediaCache(mediaCacheHostnames, callbackID), 0);
m_process->send(Messages::WebMediaCacheManagerProxy::DidGetHostnamesWithMediaCache(mediaCacheHostnames, callbackID), 0);
}

void WebMediaCacheManager::clearCacheForHostname(const String& hostname)
{
WebProcess::LocalTerminationDisabler terminationDisabler(WebProcess::shared());
ChildProcess::LocalTerminationDisabler terminationDisabler(*m_process);

#if ENABLE(VIDEO)
HTMLMediaElement::clearMediaCacheForSite(hostname);
@@ -75,7 +70,7 @@ void WebMediaCacheManager::clearCacheForHostname(const String& hostname)

void WebMediaCacheManager::clearCacheForAllHostnames()
{
WebProcess::LocalTerminationDisabler terminationDisabler(WebProcess::shared());
ChildProcess::LocalTerminationDisabler terminationDisabler(*m_process);

#if ENABLE(VIDEO)
HTMLMediaElement::clearMediaCache();
@@ -26,33 +26,28 @@
#ifndef WebMediaCacheManager_h
#define WebMediaCacheManager_h

#include "MessageReceiver.h"
#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
#include <wtf/text/WTFString.h>

namespace CoreIPC {
class Connection;
class MessageDecoder;
class MessageID;
}

namespace WebKit {

class WebMediaCacheManager {
WTF_MAKE_NONCOPYABLE(WebMediaCacheManager);
class WebProcess;

class WebMediaCacheManager : private CoreIPC::MessageReceiver {
WTF_MAKE_NONCOPYABLE(WebMediaCacheManager);
public:
static WebMediaCacheManager& shared();

void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&);
explicit WebMediaCacheManager(WebProcess*);

private:
WebMediaCacheManager();

void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&) OVERRIDE;
void didReceiveWebMediaCacheManagerMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&);

void getHostnamesWithMediaCache(uint64_t callbackID);
void clearCacheForHostname(const String&);
void clearCacheForAllHostnames();

void didReceiveWebMediaCacheManagerMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&);
WebProcess* m_process;
};

} // namespace WebKit
@@ -151,6 +151,8 @@ WebProcess::WebProcess()
, m_applicationCacheManager(new WebApplicationCacheManager(this))
, m_resourceCacheManager(new WebResourceCacheManager(this))
, m_cookieManager(new WebCookieManager(this))
, m_keyValueStorageManager(new WebKeyValueStorageManager(this))
, m_mediaCacheManager(new WebMediaCacheManager(this))
, m_authenticationManager(new AuthenticationManager(this))
#if ENABLE(SQL_DATABASE)
, m_databaseManager(new WebDatabaseManager(this))
@@ -260,7 +262,7 @@ void WebProcess::initializeWebProcess(const WebProcessCreationParameters& parame
m_iconDatabaseProxy->setEnabled(parameters.iconDatabaseEnabled);
#endif

StorageTracker::initializeTracker(parameters.localStorageDirectory, &WebKeyValueStorageManager::shared());
StorageTracker::initializeTracker(parameters.localStorageDirectory, m_keyValueStorageManager);
m_localStorageDirectory = parameters.localStorageDirectory;

if (!parameters.applicationCacheDirectory.isEmpty())
@@ -645,16 +647,6 @@ void WebProcess::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Mes
return;
}

if (messageID.is<CoreIPC::MessageClassWebKeyValueStorageManager>()) {
WebKeyValueStorageManager::shared().didReceiveMessage(connection, messageID, decoder);
return;
}

if (messageID.is<CoreIPC::MessageClassWebMediaCacheManager>()) {
WebMediaCacheManager::shared().didReceiveMessage(connection, messageID, decoder);
return;
}

if (messageID.is<CoreIPC::MessageClassWebPageGroupProxy>()) {
uint64_t pageGroupID = decoder.destinationID();
if (!pageGroupID)
@@ -82,6 +82,8 @@ class WebCookieManager;
class WebFrame;
class WebGeolocationManager;
class WebIconDatabaseProxy;
class WebKeyValueStorageManager;
class WebMediaCacheManager;
class WebPage;
class WebPageGroupProxy;
class WebResourceCacheManager;
@@ -380,6 +382,8 @@ class WebProcess : public ChildProcess, private CoreIPC::Connection::QueueClient
WebApplicationCacheManager* m_applicationCacheManager;
WebResourceCacheManager* m_resourceCacheManager;
WebCookieManager* m_cookieManager;
WebKeyValueStorageManager* m_keyValueStorageManager;
WebMediaCacheManager* m_mediaCacheManager;
AuthenticationManager* m_authenticationManager;
#if ENABLE(SQL_DATABASE)
WebDatabaseManager* m_databaseManager;

0 comments on commit e5af015

Please sign in to comment.