Commit e8dfefaf authored by weinig@apple.com's avatar weinig@apple.com

Convert PageGroup to using std::unique_ptr

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

Reviewed by Anders Carlsson.

* page/CaptionUserPreferences.cpp:
* page/CaptionUserPreferences.h:
* page/CaptionUserPreferencesMediaAF.cpp:
* page/CaptionUserPreferencesMediaAF.h:
* page/Frame.cpp:
* page/GroupSettings.h:
* page/Page.cpp:
* page/PageGroup.cpp:
* page/PageGroup.h:
* page/UserScriptTypes.h:
* page/UserStyleSheetTypes.h:
* workers/DedicatedWorkerGlobalScope.h:
* workers/DedicatedWorkerThread.cpp:
* workers/DedicatedWorkerThread.h:
* workers/SharedWorkerGlobalScope.cpp:
* workers/SharedWorkerGlobalScope.h:
* workers/SharedWorkerThread.cpp:
* workers/SharedWorkerThread.h:
* workers/WorkerGlobalScope.cpp:
* workers/WorkerGlobalScope.h:
* workers/WorkerThread.cpp:
* workers/WorkerThread.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156751 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 620e8573
2013-10-01 Sam Weinig <sam@webkit.org>
Convert PageGroup to using std::unique_ptr
https://bugs.webkit.org/show_bug.cgi?id=122184
Reviewed by Anders Carlsson.
* page/CaptionUserPreferences.cpp:
* page/CaptionUserPreferences.h:
* page/CaptionUserPreferencesMediaAF.cpp:
* page/CaptionUserPreferencesMediaAF.h:
* page/Frame.cpp:
* page/GroupSettings.h:
* page/Page.cpp:
* page/PageGroup.cpp:
* page/PageGroup.h:
* page/UserScriptTypes.h:
* page/UserStyleSheetTypes.h:
* workers/DedicatedWorkerGlobalScope.h:
* workers/DedicatedWorkerThread.cpp:
* workers/DedicatedWorkerThread.h:
* workers/SharedWorkerGlobalScope.cpp:
* workers/SharedWorkerGlobalScope.h:
* workers/SharedWorkerThread.cpp:
* workers/SharedWorkerThread.h:
* workers/WorkerGlobalScope.cpp:
* workers/WorkerGlobalScope.h:
* workers/WorkerThread.cpp:
* workers/WorkerThread.h:
2013-10-01 Tim Horton <timothy_horton@apple.com>
Tiled drawing GraphicsLayer tree dumps should match non-tiled more closely
......@@ -37,7 +37,7 @@
namespace WebCore {
CaptionUserPreferences::CaptionUserPreferences(PageGroup* group)
CaptionUserPreferences::CaptionUserPreferences(PageGroup& group)
: m_pageGroup(group)
, m_displayMode(ForcedOnly)
, m_timer(this, &CaptionUserPreferences::timerFired)
......@@ -79,7 +79,7 @@ void CaptionUserPreferences::setCaptionDisplayMode(CaptionUserPreferences::Capti
bool CaptionUserPreferences::userPrefersCaptions() const
{
Page* page = *(pageGroup()->pages().begin());
Page* page = *(m_pageGroup.pages().begin());
if (!page)
return false;
......@@ -88,7 +88,7 @@ bool CaptionUserPreferences::userPrefersCaptions() const
void CaptionUserPreferences::setUserPrefersCaptions(bool preference)
{
Page* page = *(pageGroup()->pages().begin());
Page* page = *(m_pageGroup.pages().begin());
if (!page)
return;
......@@ -98,7 +98,7 @@ void CaptionUserPreferences::setUserPrefersCaptions(bool preference)
bool CaptionUserPreferences::userPrefersSubtitles() const
{
Page* page = *(pageGroup()->pages().begin());
Page* page = *(pageGroup().pages().begin());
if (!page)
return false;
......@@ -107,7 +107,7 @@ bool CaptionUserPreferences::userPrefersSubtitles() const
void CaptionUserPreferences::setUserPrefersSubtitles(bool preference)
{
Page* page = *(pageGroup()->pages().begin());
Page* page = *(m_pageGroup.pages().begin());
if (!page)
return;
......@@ -117,7 +117,7 @@ void CaptionUserPreferences::setUserPrefersSubtitles(bool preference)
bool CaptionUserPreferences::userPrefersTextDescriptions() const
{
Page* page = *(pageGroup()->pages().begin());
Page* page = *(m_pageGroup.pages().begin());
if (!page)
return false;
......@@ -126,7 +126,7 @@ bool CaptionUserPreferences::userPrefersTextDescriptions() const
void CaptionUserPreferences::setUserPrefersTextDescriptions(bool preference)
{
Page* page = *(pageGroup()->pages().begin());
Page* page = *(m_pageGroup.pages().begin());
if (!page)
return;
......@@ -136,7 +136,7 @@ void CaptionUserPreferences::setUserPrefersTextDescriptions(bool preference)
void CaptionUserPreferences::captionPreferencesChanged()
{
m_pageGroup->captionPreferencesChanged();
m_pageGroup.captionPreferencesChanged();
}
Vector<String> CaptionUserPreferences::preferredLanguages() const
......@@ -238,13 +238,13 @@ void CaptionUserPreferences::updateCaptionStyleSheetOveride()
// Identify our override style sheet with a unique URL - a new scheme and a UUID.
DEFINE_STATIC_LOCAL(URL, captionsStyleSheetURL, (ParsedURLString, "user-captions-override:01F6AF12-C3B0-4F70-AF5E-A3E00234DC23"));
pageGroup()->removeUserStyleSheetFromWorld(mainThreadNormalWorld(), captionsStyleSheetURL);
m_pageGroup.removeUserStyleSheetFromWorld(mainThreadNormalWorld(), captionsStyleSheetURL);
String captionsOverrideStyleSheet = captionsStyleSheetOverride();
if (captionsOverrideStyleSheet.isEmpty())
return;
pageGroup()->addUserStyleSheetToWorld(mainThreadNormalWorld(), captionsOverrideStyleSheet, captionsStyleSheetURL, Vector<String>(),
m_pageGroup.addUserStyleSheetToWorld(mainThreadNormalWorld(), captionsOverrideStyleSheet, captionsStyleSheetURL, Vector<String>(),
Vector<String>(), InjectInAllFrames, UserStyleAuthorLevel, InjectInExistingDocuments);
}
......
......@@ -43,7 +43,7 @@ class TextTrackList;
class CaptionUserPreferences {
public:
static PassOwnPtr<CaptionUserPreferences> create(PageGroup* group) { return adoptPtr(new CaptionUserPreferences(group)); }
CaptionUserPreferences(PageGroup&);
virtual ~CaptionUserPreferences();
enum CaptionDisplayMode {
......@@ -87,17 +87,16 @@ public:
virtual bool testingMode() const { return m_testingMode; }
virtual void setTestingMode(bool override) { m_testingMode = override; }
PageGroup* pageGroup() const { return m_pageGroup; }
PageGroup& pageGroup() const { return m_pageGroup; }
protected:
CaptionUserPreferences(PageGroup*);
void updateCaptionStyleSheetOveride();
private:
void timerFired(Timer<CaptionUserPreferences>*);
void notify();
PageGroup* m_pageGroup;
PageGroup& m_pageGroup;
CaptionDisplayMode m_displayMode;
Timer<CaptionUserPreferences> m_timer;
String m_userPreferredLanguage;
......
......@@ -40,7 +40,6 @@
#include "LocalizedStrings.h"
#include "Logging.h"
#include "MediaControlElements.h"
#include "PageGroup.h"
#include "SoftLinking.h"
#include "TextTrackCue.h"
#include "TextTrackList.h"
......@@ -141,7 +140,7 @@ static void userCaptionPreferencesChangedNotificationCallback(CFNotificationCent
}
#endif
CaptionUserPreferencesMediaAF::CaptionUserPreferencesMediaAF(PageGroup* group)
CaptionUserPreferencesMediaAF::CaptionUserPreferencesMediaAF(PageGroup& group)
: CaptionUserPreferences(group)
#if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
, m_listeningForPreferenceChanges(false)
......
......@@ -37,7 +37,7 @@ namespace WebCore {
class CaptionUserPreferencesMediaAF : public CaptionUserPreferences {
public:
static PassOwnPtr<CaptionUserPreferencesMediaAF> create(PageGroup* group) { return adoptPtr(new CaptionUserPreferencesMediaAF(group)); }
CaptionUserPreferencesMediaAF(PageGroup&);
virtual ~CaptionUserPreferencesMediaAF();
#if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
......@@ -67,8 +67,6 @@ public:
virtual String displayNameForTrack(TextTrack*) const OVERRIDE;
private:
CaptionUserPreferencesMediaAF(PageGroup*);
#if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
String captionsWindowCSS() const;
String captionsBackgroundCSS() const;
......
......@@ -535,8 +535,8 @@ void Frame::injectUserScripts(UserScriptInjectionTime injectionTime)
const UserScriptMap* userScripts = m_page->group().userScripts();
if (!userScripts)
return;
UserScriptMap::const_iterator end = userScripts->end();
for (UserScriptMap::const_iterator it = userScripts->begin(); it != end; ++it)
for (auto it = userScripts->begin(), end = userScripts->end(); it != end; ++it)
injectUserScriptsForWorld(it->key.get(), *it->value, injectionTime);
}
......
......@@ -26,7 +26,6 @@
#ifndef GroupSettings_h
#define GroupSettings_h
#include <wtf/PassOwnPtr.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
......@@ -36,10 +35,7 @@ class PageGroup;
class GroupSettings {
WTF_MAKE_NONCOPYABLE(GroupSettings); WTF_MAKE_FAST_ALLOCATED;
public:
static PassOwnPtr<GroupSettings> create()
{
return adoptPtr(new GroupSettings());
}
GroupSettings();
void setLocalStorageQuotaBytes(unsigned);
unsigned localStorageQuotaBytes() const { return m_localStorageQuotaBytes; }
......@@ -51,8 +47,6 @@ public:
const String& indexedDBDatabasePath() const { return m_indexedDBDatabasePath; }
private:
GroupSettings();
unsigned m_localStorageQuotaBytes;
String m_indexedDBDatabasePath;
int64_t m_indexedDBQuotaBytes;
......
......@@ -434,7 +434,7 @@ void Page::setGroupName(const String& name)
if (m_group && !m_group->name().isEmpty()) {
ASSERT(m_group != m_singlePageGroup.get());
ASSERT(!m_singlePageGroup);
m_group->removePage(this);
m_group->removePage(*this);
}
if (name.isEmpty())
......@@ -442,7 +442,7 @@ void Page::setGroupName(const String& name)
else {
m_singlePageGroup = nullptr;
m_group = PageGroup::pageGroup(name);
m_group->addPage(this);
m_group->addPage(*this);
}
}
......
......@@ -38,6 +38,7 @@
#include "SecurityOrigin.h"
#include "Settings.h"
#include "StorageNamespace.h"
#include <wtf/StdLibExtras.h>
#if ENABLE(VIDEO_TRACK)
#if (PLATFORM(MAC) && !PLATFORM(IOS)) || HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
......@@ -63,16 +64,16 @@ PageGroup::PageGroup(const String& name)
: m_name(name)
, m_visitedLinksPopulated(false)
, m_identifier(getUniqueIdentifier())
, m_groupSettings(GroupSettings::create())
, m_groupSettings(std::make_unique<GroupSettings>())
{
}
PageGroup::PageGroup(Page& page)
: m_visitedLinksPopulated(false)
, m_identifier(getUniqueIdentifier())
, m_groupSettings(GroupSettings::create())
, m_groupSettings(std::make_unique<GroupSettings>())
{
addPage(&page);
addPage(page);
}
PageGroup::~PageGroup()
......@@ -106,9 +107,7 @@ void PageGroup::closeLocalStorage()
if (!pageGroups)
return;
PageGroupMap::iterator end = pageGroups->end();
for (PageGroupMap::iterator it = pageGroups->begin(); it != end; ++it) {
for (auto it = pageGroups->begin(), end = pageGroups->end(); it != end; ++it) {
if (it->value->hasLocalStorage())
it->value->localStorage()->close();
}
......@@ -119,8 +118,7 @@ void PageGroup::clearLocalStorageForAllOrigins()
if (!pageGroups)
return;
PageGroupMap::iterator end = pageGroups->end();
for (PageGroupMap::iterator it = pageGroups->begin(); it != end; ++it) {
for (auto it = pageGroups->begin(), end = pageGroups->end(); it != end; ++it) {
if (it->value->hasLocalStorage())
it->value->localStorage()->clearAllOriginsForDeletion();
}
......@@ -131,8 +129,7 @@ void PageGroup::clearLocalStorageForOrigin(SecurityOrigin* origin)
if (!pageGroups)
return;
PageGroupMap::iterator end = pageGroups->end();
for (PageGroupMap::iterator it = pageGroups->begin(); it != end; ++it) {
for (auto it = pageGroups->begin(), end = pageGroups->end(); it != end; ++it) {
if (it->value->hasLocalStorage())
it->value->localStorage()->clearOriginForDeletion(origin);
}
......@@ -143,8 +140,7 @@ void PageGroup::closeIdleLocalStorageDatabases()
if (!pageGroups)
return;
PageGroupMap::iterator end = pageGroups->end();
for (PageGroupMap::iterator it = pageGroups->begin(); it != end; ++it) {
for (auto it = pageGroups->begin(), end = pageGroups->end(); it != end; ++it) {
if (it->value->hasLocalStorage())
it->value->localStorage()->closeIdleLocalStorageDatabases();
}
......@@ -155,8 +151,7 @@ void PageGroup::syncLocalStorage()
if (!pageGroups)
return;
PageGroupMap::iterator end = pageGroups->end();
for (PageGroupMap::iterator it = pageGroups->begin(); it != end; ++it) {
for (auto it = pageGroups->begin(), end = pageGroups->end(); it != end; ++it) {
if (it->value->hasLocalStorage())
it->value->localStorage()->sync();
}
......@@ -170,18 +165,16 @@ unsigned PageGroup::numberOfPageGroups()
return pageGroups->size();
}
void PageGroup::addPage(Page* page)
void PageGroup::addPage(Page& page)
{
ASSERT(page);
ASSERT(!m_pages.contains(page));
m_pages.add(page);
ASSERT(!m_pages.contains(&page));
m_pages.add(&page);
}
void PageGroup::removePage(Page* page)
void PageGroup::removePage(Page& page)
{
ASSERT(page);
ASSERT(m_pages.contains(page));
m_pages.remove(page);
ASSERT(m_pages.contains(&page));
m_pages.remove(&page);
}
bool PageGroup::isLinkVisited(LinkHash visitedLinkHash)
......@@ -273,13 +266,13 @@ void PageGroup::addUserScriptToWorld(DOMWrapperWorld* world, const String& sourc
{
ASSERT_ARG(world, world);
OwnPtr<UserScript> userScript = adoptPtr(new UserScript(source, url, whitelist, blacklist, injectionTime, injectedFrames));
auto userScript = std::make_unique<UserScript>(source, url, whitelist, blacklist, injectionTime, injectedFrames);
if (!m_userScripts)
m_userScripts = adoptPtr(new UserScriptMap);
OwnPtr<UserScriptVector>& scriptsInWorld = m_userScripts->add(world, nullptr).iterator->value;
m_userScripts = std::make_unique<UserScriptMap>();
std::unique_ptr<UserScriptVector>& scriptsInWorld = m_userScripts->add(world, nullptr).iterator->value;
if (!scriptsInWorld)
scriptsInWorld = adoptPtr(new UserScriptVector);
scriptsInWorld->append(userScript.release());
scriptsInWorld = std::make_unique<UserScriptVector>();
scriptsInWorld->append(std::move(userScript));
}
void PageGroup::addUserStyleSheetToWorld(DOMWrapperWorld* world, const String& source, const URL& url,
......@@ -290,13 +283,13 @@ void PageGroup::addUserStyleSheetToWorld(DOMWrapperWorld* world, const String& s
{
ASSERT_ARG(world, world);
OwnPtr<UserStyleSheet> userStyleSheet = adoptPtr(new UserStyleSheet(source, url, whitelist, blacklist, injectedFrames, level));
auto userStyleSheet = std::make_unique<UserStyleSheet>(source, url, whitelist, blacklist, injectedFrames, level);
if (!m_userStyleSheets)
m_userStyleSheets = adoptPtr(new UserStyleSheetMap);
OwnPtr<UserStyleSheetVector>& styleSheetsInWorld = m_userStyleSheets->add(world, nullptr).iterator->value;
m_userStyleSheets = std::make_unique<UserStyleSheetMap>();
std::unique_ptr<UserStyleSheetVector>& styleSheetsInWorld = m_userStyleSheets->add(world, nullptr).iterator->value;
if (!styleSheetsInWorld)
styleSheetsInWorld = adoptPtr(new UserStyleSheetVector);
styleSheetsInWorld->append(userStyleSheet.release());
styleSheetsInWorld = std::make_unique<UserStyleSheetVector>();
styleSheetsInWorld->append(std::move(userStyleSheet));
if (injectionTime == InjectInExistingDocuments)
invalidateInjectedStyleSheetCacheInAllFrames();
......@@ -309,11 +302,11 @@ void PageGroup::removeUserScriptFromWorld(DOMWrapperWorld* world, const URL& url
if (!m_userScripts)
return;
UserScriptMap::iterator it = m_userScripts->find(world);
auto it = m_userScripts->find(world);
if (it == m_userScripts->end())
return;
UserScriptVector* scripts = it->value.get();
auto scripts = it->value.get();
for (int i = scripts->size() - 1; i >= 0; --i) {
if (scripts->at(i)->url() == url)
scripts->remove(i);
......@@ -330,12 +323,12 @@ void PageGroup::removeUserStyleSheetFromWorld(DOMWrapperWorld* world, const URL&
if (!m_userStyleSheets)
return;
UserStyleSheetMap::iterator it = m_userStyleSheets->find(world);
auto it = m_userStyleSheets->find(world);
bool sheetsChanged = false;
if (it == m_userStyleSheets->end())
return;
UserStyleSheetVector* stylesheets = it->value.get();
auto stylesheets = it->value.get();
for (int i = stylesheets->size() - 1; i >= 0; --i) {
if (stylesheets->at(i)->url() == url) {
stylesheets->remove(i);
......@@ -377,10 +370,10 @@ void PageGroup::removeUserStyleSheetsFromWorld(DOMWrapperWorld* world)
void PageGroup::removeAllUserContent()
{
m_userScripts.clear();
m_userScripts = nullptr;
if (m_userStyleSheets) {
m_userStyleSheets.clear();
m_userStyleSheets = nullptr;
invalidateInjectedStyleSheetCacheInAllFrames();
}
}
......@@ -388,8 +381,7 @@ void PageGroup::removeAllUserContent()
void PageGroup::invalidateInjectedStyleSheetCacheInAllFrames()
{
// Clear our cached sheets and have them just reparse.
HashSet<Page*>::const_iterator end = m_pages.end();
for (HashSet<Page*>::const_iterator it = m_pages.begin(); it != end; ++it) {
for (auto it = m_pages.begin(), end = m_pages.end(); it != end; ++it) {
for (Frame* frame = &(*it)->mainFrame(); frame; frame = frame->tree().traverseNext()) {
frame->document()->styleSheetCollection().invalidateInjectedStyleSheetCache();
frame->document()->styleResolverChanged(DeferRecalcStyle);
......@@ -400,23 +392,23 @@ void PageGroup::invalidateInjectedStyleSheetCacheInAllFrames()
#if ENABLE(VIDEO_TRACK)
void PageGroup::captionPreferencesChanged()
{
for (HashSet<Page*>::iterator i = m_pages.begin(); i != m_pages.end(); ++i)
(*i)->captionPreferencesChanged();
for (auto it = m_pages.begin(), end = m_pages.end(); it != end; ++it)
(*it)->captionPreferencesChanged();
pageCache()->markPagesForCaptionPreferencesChanged();
}
CaptionUserPreferences* PageGroup::captionPreferences()
{
if (!m_captionPreferences)
if (!m_captionPreferences) {
#if (PLATFORM(MAC) && !PLATFORM(IOS)) || HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
m_captionPreferences = CaptionUserPreferencesMediaAF::create(this);
m_captionPreferences = std::make_unique<CaptionUserPreferencesMediaAF>(*this);
#else
m_captionPreferences = CaptionUserPreferences::create(this);
m_captionPreferences = std::make_unique<CaptionUserPreferences>(*this);
#endif
}
return m_captionPreferences.get();
}
#endif
} // namespace WebCore
......@@ -36,10 +36,6 @@
namespace WebCore {
#if ENABLE(VIDEO_TRACK)
class CaptionPreferencesChangedListener;
class CaptionUserPreferences;
#endif
class URL;
class GroupSettings;
class IDBFactoryBackendInterface;
......@@ -47,6 +43,11 @@ namespace WebCore {
class SecurityOrigin;
class StorageNamespace;
#if ENABLE(VIDEO_TRACK)
class CaptionPreferencesChangedListener;
class CaptionUserPreferences;
#endif
class PageGroup : public Supplementable<PageGroup> {
WTF_MAKE_NONCOPYABLE(PageGroup); WTF_MAKE_FAST_ALLOCATED;
public:
......@@ -68,8 +69,8 @@ namespace WebCore {
const HashSet<Page*>& pages() const { return m_pages; }
void addPage(Page*);
void removePage(Page*);
void addPage(Page&);
void removePage(Page&);
bool isLinkVisited(LinkHash);
......@@ -129,13 +130,13 @@ namespace WebCore {
RefPtr<StorageNamespace> m_localStorage;
HashMap<RefPtr<SecurityOrigin>, RefPtr<StorageNamespace> > m_transientLocalStorageMap;
OwnPtr<UserScriptMap> m_userScripts;
OwnPtr<UserStyleSheetMap> m_userStyleSheets;
std::unique_ptr<UserScriptMap> m_userScripts;
std::unique_ptr<UserStyleSheetMap> m_userStyleSheets;
const OwnPtr<GroupSettings> m_groupSettings;
const std::unique_ptr<GroupSettings> m_groupSettings;
#if ENABLE(VIDEO_TRACK)
OwnPtr<CaptionUserPreferences> m_captionPreferences;
std::unique_ptr<CaptionUserPreferences> m_captionPreferences;
#endif
};
......
......@@ -36,8 +36,8 @@ enum UserScriptInjectionTime { InjectAtDocumentStart, InjectAtDocumentEnd };
class DOMWrapperWorld;
class UserScript;
typedef Vector<OwnPtr<UserScript> > UserScriptVector;
typedef HashMap<RefPtr<DOMWrapperWorld>, OwnPtr<UserScriptVector> > UserScriptMap;
typedef Vector<std::unique_ptr<UserScript>> UserScriptVector;
typedef HashMap<RefPtr<DOMWrapperWorld>, std::unique_ptr<UserScriptVector>> UserScriptMap;
} // namespace WebCore
......
......@@ -37,8 +37,8 @@ enum UserStyleLevel { UserStyleUserLevel, UserStyleAuthorLevel };
class DOMWrapperWorld;
class UserStyleSheet;
typedef Vector<OwnPtr<UserStyleSheet> > UserStyleSheetVector;
typedef HashMap<RefPtr<DOMWrapperWorld>, OwnPtr<UserStyleSheetVector> > UserStyleSheetMap;
typedef Vector<std::unique_ptr<UserStyleSheet>> UserStyleSheetVector;
typedef HashMap<RefPtr<DOMWrapperWorld>, std::unique_ptr<UserStyleSheetVector>> UserStyleSheetMap;
} // namespace WebCore
......
......@@ -40,15 +40,15 @@
namespace WebCore {
PassRefPtr<DedicatedWorkerGlobalScope> DedicatedWorkerGlobalScope::create(const URL& url, const String& userAgent, PassOwnPtr<GroupSettings> settings, DedicatedWorkerThread* thread, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType, PassRefPtr<SecurityOrigin> topOrigin)
PassRefPtr<DedicatedWorkerGlobalScope> DedicatedWorkerGlobalScope::create(const URL& url, const String& userAgent, std::unique_ptr<GroupSettings> settings, DedicatedWorkerThread* thread, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType, PassRefPtr<SecurityOrigin> topOrigin)
{
RefPtr<DedicatedWorkerGlobalScope> context = adoptRef(new DedicatedWorkerGlobalScope(url, userAgent, settings, thread, topOrigin));
RefPtr<DedicatedWorkerGlobalScope> context = adoptRef(new DedicatedWorkerGlobalScope(url, userAgent, std::move(settings), thread, topOrigin));
context->applyContentSecurityPolicyFromString(contentSecurityPolicy, contentSecurityPolicyType);
return context.release();
}
DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope(const URL& url, const String& userAgent, PassOwnPtr<GroupSettings> settings, DedicatedWorkerThread* thread, PassRefPtr<SecurityOrigin> topOrigin)
: WorkerGlobalScope(url, userAgent, settings, thread, topOrigin)
DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope(const URL& url, const String& userAgent, std::unique_ptr<GroupSettings> settings, DedicatedWorkerThread* thread, PassRefPtr<SecurityOrigin> topOrigin)
: WorkerGlobalScope(url, userAgent, std::move(settings), thread, topOrigin)
{
}
......
......@@ -44,7 +44,7 @@ namespace WebCore {
class DedicatedWorkerGlobalScope : public WorkerGlobalScope {
public:
typedef WorkerGlobalScope Base;
static PassRefPtr<DedicatedWorkerGlobalScope> create(const URL&, const String& userAgent, PassOwnPtr<GroupSettings>, DedicatedWorkerThread*, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType, PassRefPtr<SecurityOrigin> topOrigin);
static PassRefPtr<DedicatedWorkerGlobalScope> create(const URL&, const String& userAgent, std::unique_ptr<GroupSettings>, DedicatedWorkerThread*, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType, PassRefPtr<SecurityOrigin> topOrigin);
virtual ~DedicatedWorkerGlobalScope();
virtual bool isDedicatedWorkerGlobalScope() const OVERRIDE { return true; }
......@@ -64,7 +64,7 @@ namespace WebCore {
DedicatedWorkerThread* thread();
private:
DedicatedWorkerGlobalScope(const URL&, const String& userAgent, PassOwnPtr<GroupSettings>, DedicatedWorkerThread*, PassRefPtr<SecurityOrigin> topOrigin);
DedicatedWorkerGlobalScope(const URL&, const String& userAgent, std::unique_ptr<GroupSettings>, DedicatedWorkerThread*, PassRefPtr<SecurityOrigin> topOrigin);
};
} // namespace WebCore
......
......@@ -55,9 +55,9 @@ DedicatedWorkerThread::~DedicatedWorkerThread()
{
}
PassRefPtr<WorkerGlobalScope> DedicatedWorkerThread::createWorkerGlobalScope(const URL& url, const String& userAgent, PassOwnPtr<GroupSettings> settings, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType, PassRefPtr<SecurityOrigin> topOrigin)
PassRefPtr<WorkerGlobalScope> DedicatedWorkerThread::createWorkerGlobalScope(const URL& url, const String& userAgent, std::unique_ptr<GroupSettings> settings, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType, PassRefPtr<SecurityOrigin> topOrigin)
{
return DedicatedWorkerGlobalScope::create(url, userAgent, settings, this, contentSecurityPolicy, contentSecurityPolicyType, topOrigin);
return DedicatedWorkerGlobalScope::create(url, userAgent, std::move(settings), this, contentSecurityPolicy, contentSecurityPolicyType, topOrigin);
}
void DedicatedWorkerThread::runEventLoop()
......
......@@ -46,7 +46,7 @@ namespace WebCore {
virtual ~DedicatedWorkerThread();
protected:
virtual PassRefPtr<WorkerGlobalScope> createWorkerGlobalScope(const URL&, const String& userAgent, PassOwnPtr<GroupSettings>, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType, PassRefPtr<SecurityOrigin> topOrigin) OVERRIDE;
virtual PassRefPtr<WorkerGlobalScope> createWorkerGlobalScope(const URL&, const String& userAgent, std::unique_ptr<GroupSettings>, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType, PassRefPtr<SecurityOrigin> topOrigin) OVERRIDE;
virtual void runEventLoop() OVERRIDE;
private:
......
......@@ -53,15 +53,15 @@ PassRefPtr<MessageEvent> createConnectEvent(PassRefPtr<MessagePort> prpPort)
}
// static
PassRefPtr<SharedWorkerGlobalScope> SharedWorkerGlobalScope::create(const String& name, const URL& url, const String& userAgent, PassOwnPtr<GroupSettings> settings, SharedWorkerThread* thread, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType)
PassRefPtr<SharedWorkerGlobalScope> SharedWorkerGlobalScope::create(const String& name, const URL& url, const String& userAgent, std::unique_ptr<GroupSettings> settings, SharedWorkerThread* thread, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType)
{
RefPtr<SharedWorkerGlobalScope> context = adoptRef(new SharedWorkerGlobalScope(name, url, userAgent, settings, thread));
RefPtr<SharedWorkerGlobalScope> context = adoptRef(new SharedWorkerGlobalScope(name, url, userAgent, std::move(settings), thread));
context->applyContentSecurityPolicyFromString(contentSecurityPolicy, contentSecurityPolicyType);
return context.release();
}
SharedWorkerGlobalScope::SharedWorkerGlobalScope(const String& name, const URL& url, const String& userAgent, PassOwnPtr<GroupSettings> settings, SharedWorkerThread* thread)
: WorkerGlobalScope(url, userAgent, settings, thread, 0)
SharedWorkerGlobalScope::SharedWorkerGlobalScope(const String& name, const URL& url, const String& userAgent, std::unique_ptr<GroupSettings> settings, SharedWorkerThread* thread)
: WorkerGlobalScope(url, userAgent, std::move(settings), thread, 0)
, m_name(name)
{
}
......
......@@ -44,7 +44,7 @@ namespace WebCore {
class SharedWorkerGlobalScope : public WorkerGlobalScope {
public:
typedef WorkerGlobalScope Base;
static PassRefPtr<SharedWorkerGlobalScope> create(const String& name, const URL&, const String& userAgent, PassOwnPtr<GroupSettings>, SharedWorkerThread*, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType);
static PassRefPtr<SharedWorkerGlobalScope> create(const String& name, const URL&, const String& userAgent, std::unique_ptr<GroupSettings>, SharedWorkerThread*, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType);
virtual ~SharedWorkerGlobalScope();
virtual bool isSharedWorkerGlobalScope() const OVERRIDE { return true; }
......@@ -59,7 +59,7 @@ namespace WebCore {
SharedWorkerThread* thread();
private:
SharedWorkerGlobalScope(const String& name, const URL&, const String& userAgent, PassOwnPtr<GroupSettings>, SharedWorkerThread*);
SharedWorkerGlobalScope(const String& name, const URL&, const String& userAgent, std::unique_ptr<GroupSettings>, SharedWorkerThread*);
virtual void logExceptionToConsole(const String& errorMessage, const String& sourceURL, int lineNumber, int columnNumber, PassRefPtr<ScriptCallStack>) OVERRIDE;
String m_name;
......
......@@ -53,9 +53,9 @@ SharedWorkerThread::~SharedWorkerThread()
{
}
PassRefPtr<WorkerGlobalScope> SharedWorkerThread::createWorkerGlobalScope(const URL& url, const String& userAgent, PassOwnPtr<GroupSettings> settings, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType, PassRefPtr<SecurityOrigin>)
PassRefPtr<WorkerGlobalScope> SharedWorkerThread::createWorkerGlobalScope(const URL& url, const String& userAgent, std::unique_ptr<GroupSettings> settings, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType, PassRefPtr<SecurityOrigin>)
{
return SharedWorkerGlobalScope::create(m_name, url, userAgent, settings, this, contentSecurityPolicy, contentSecurityPolicyType);
return SharedWorkerGlobalScope::create(m_name, url, userAgent, std::move(settings), this, contentSecurityPolicy, contentSecurityPolicyType);
}
} // namespace WebCore
......
......@@ -43,7 +43,7 @@ namespace WebCore {
virtual ~SharedWorkerThread();
protected:
virtual PassRefPtr<WorkerGlobalScope> createWorkerGlobalScope(const URL&, const String& userAgent, PassOwnPtr<GroupSettings>, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType, PassRefPtr<SecurityOrigin> topOrigin) OVERRIDE;
virtual PassRefPtr<WorkerGlobalScope> createWorkerGlobalScope(const URL&, const String& userAgent, std::unique_ptr<GroupSettings>, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType, PassRefPtr<SecurityOrigin> topOrigin) OVERRIDE;
private:
SharedWorkerThread(const String& name, const URL&, const String& userAgent, const GroupSettings*, const String& sourceCode, WorkerLoaderProxy&, WorkerReportingProxy&, WorkerThreadStartMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType);
......
......@@ -84,10 +84,10 @@ public:
virtual bool isCleanupTask() const { return true; }
};
WorkerGlobalScope::WorkerGlobalScope(const URL& url, const String& userAgent, PassOwnPtr<GroupSettings> settings, WorkerThread* thread, PassRefPtr<SecurityOrigin> topOrigin)
WorkerGlobalScope::WorkerGlobalScope(const URL& url, const String& userAgent, std::unique_ptr<GroupSettings> settings, WorkerThread* thread, PassRefPtr<SecurityOrigin> topOrigin)
: m_url(url)
, m_userAgent(userAgent)
, m_groupSettings(settings)
, m_groupSettings(std::move(settings))