SharedWorkerProcessManager.cpp [plain text]
#include "config.h"
#include "SharedWorkerProcessManager.h"
#if ENABLE(SHARED_WORKER_PROCESS)
#include "SharedWorkerProcessProxy.h"
#include "WebContext.h"
#include <wtf/StdLibExtras.h>
#include <wtf/text/WTFString.h>
namespace WebKit {
SharedWorkerProcessManager& SharedWorkerProcessManager::shared()
{
DEFINE_STATIC_LOCAL(SharedWorkerProcessManager, manager, ());
return manager;
}
SharedWorkerProcessManager::SharedWorkerProcessManager()
{
}
void SharedWorkerProcessManager::getSharedWorkerProcessConnection(const String& url, const String& name, PassRefPtr<Messages::WebProcessProxy::GetSharedWorkerProcessConnection::DelayedReply> reply)
{
SharedWorkerProcessProxy* sharedWorkerProcess = getOrCreateSharedWorkerProcess(url, name);
sharedWorkerProcess->getSharedWorkerProcessConnection(reply);
}
void SharedWorkerProcessManager::removeSharedWorkerProcessProxy(SharedWorkerProcessProxy* sharedWorkerProcessProxy)
{
size_t vectorIndex = m_sharedWorkerProcesses.find(sharedWorkerProcessProxy);
ASSERT(vectorIndex != notFound);
m_sharedWorkerProcesses.remove(vectorIndex);
}
SharedWorkerProcessProxy* SharedWorkerProcessManager::getOrCreateSharedWorkerProcess(const String& url, const String& name)
{
RefPtr<SharedWorkerProcessProxy> sharedWorkerProcess = SharedWorkerProcessProxy::create(this, url, name);
SharedWorkerProcessProxy* sharedWorkerProcessPtr = sharedWorkerProcess.get();
m_sharedWorkerProcesses.append(sharedWorkerProcess.release());
return sharedWorkerProcessPtr;
}
}
#endif // ENABLE(SHARED_WORKER_PROCESS)