Convert PageGroup to using std::unique_ptr
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Oct 2013 00:03:12 +0000 (00:03 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Oct 2013 00:03:12 +0000 (00:03 +0000)
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: https://svn.webkit.org/repository/webkit/trunk@156751 268f45cc-cd09-0410-ab3c-d52691b4dbfc

24 files changed:
Source/WebCore/ChangeLog
Source/WebCore/page/CaptionUserPreferences.cpp
Source/WebCore/page/CaptionUserPreferences.h
Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp
Source/WebCore/page/CaptionUserPreferencesMediaAF.h
Source/WebCore/page/Frame.cpp
Source/WebCore/page/GroupSettings.h
Source/WebCore/page/Page.cpp
Source/WebCore/page/PageGroup.cpp
Source/WebCore/page/PageGroup.h
Source/WebCore/page/UserScriptTypes.h
Source/WebCore/page/UserStyleSheetTypes.h
Source/WebCore/workers/DedicatedWorkerGlobalScope.cpp
Source/WebCore/workers/DedicatedWorkerGlobalScope.h
Source/WebCore/workers/DedicatedWorkerThread.cpp
Source/WebCore/workers/DedicatedWorkerThread.h
Source/WebCore/workers/SharedWorkerGlobalScope.cpp
Source/WebCore/workers/SharedWorkerGlobalScope.h
Source/WebCore/workers/SharedWorkerThread.cpp
Source/WebCore/workers/SharedWorkerThread.h
Source/WebCore/workers/WorkerGlobalScope.cpp
Source/WebCore/workers/WorkerGlobalScope.h
Source/WebCore/workers/WorkerThread.cpp
Source/WebCore/workers/WorkerThread.h

index 764306d..9d352a2 100644 (file)
@@ -1,3 +1,33 @@
+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
index 51aa38e..4fff2aa 100644 (file)
@@ -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);
 }
 
index 1ca2a40..ab04030 100644 (file)
@@ -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;
index 739559c..67c0f8d 100644 (file)
@@ -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)
index 0de7c43..3d4f573 100644 (file)
@@ -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;
index 21011ba..e5b3c73 100644 (file)
@@ -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);
 }
 
index 603d06a..e094f09 100644 (file)
@@ -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;
index fb3bd7a..06db4da 100644 (file)
@@ -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);
     }
 }
 
index 916ce00..0747c59 100644 (file)
@@ -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
index 62a307c..e68316a 100644 (file)
 
 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
     };
 
index 6b0c037..f85977e 100644 (file)
@@ -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
  
index 74cbaca..2072864 100644 (file)
@@ -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
  
index 9241930..12728c5 100644 (file)
 
 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)
 {
 }
 
index 43a5b54..dae7c1d 100644 (file)
@@ -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
index 929fde7..fc8275a 100644 (file)
@@ -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()
index 1998fe9..9a914d4 100644 (file)
@@ -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:
index 1cf5f81..e177a70 100644 (file)
@@ -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)
 {
 }
index e0136ca..2251681 100644 (file)
@@ -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;
index 1ac148b..9d6ea5c 100644 (file)
@@ -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
index ca05aa7..910facd 100644 (file)
@@ -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);
index b7e6db9..2937974 100644 (file)
@@ -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))
     , m_script(adoptPtr(new WorkerScriptController(this)))
     , m_thread(thread)
 #if ENABLE(INSPECTOR)
index 78af782..29f2dee 100644 (file)
@@ -139,7 +139,7 @@ namespace WebCore {
         virtual SecurityOrigin* topOrigin() const OVERRIDE { return m_topOrigin.get(); }
 
     protected:
-        WorkerGlobalScope(const URL&, const String& userAgent, PassOwnPtr<GroupSettings>, WorkerThread*, PassRefPtr<SecurityOrigin> topOrigin);
+        WorkerGlobalScope(const URL&, const String& userAgent, std::unique_ptr<GroupSettings>, WorkerThread*, PassRefPtr<SecurityOrigin> topOrigin);
         void applyContentSecurityPolicyFromString(const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType);
 
         virtual void logExceptionToConsole(const String& errorMessage, const String& sourceURL, int lineNumber, int columnNumber, PassRefPtr<ScriptCallStack>) OVERRIDE;
@@ -161,7 +161,7 @@ namespace WebCore {
 
         URL m_url;
         String m_userAgent;
-        OwnPtr<GroupSettings> m_groupSettings;
+        std::unique_ptr<GroupSettings> m_groupSettings;
 
         mutable RefPtr<WorkerLocation> m_location;
         mutable RefPtr<WorkerNavigator> m_navigator;
index 5e4929a..6733d14 100644 (file)
@@ -76,7 +76,7 @@ public:
 
     URL m_scriptURL;
     String m_userAgent;
-    OwnPtr<GroupSettings> m_groupSettings;
+    std::unique_ptr<GroupSettings> m_groupSettings;
     String m_sourceCode;
     WorkerThreadStartMode m_startMode;
     String m_contentSecurityPolicy;
@@ -98,7 +98,7 @@ WorkerThreadStartupData::WorkerThreadStartupData(const URL& scriptURL, const Str
     if (!settings)
         return;
 
-    m_groupSettings = GroupSettings::create();
+    m_groupSettings = std::make_unique<GroupSettings>();
     m_groupSettings->setLocalStorageQuotaBytes(settings->localStorageQuotaBytes());
     m_groupSettings->setIndexedDBQuotaBytes(settings->indexedDBQuotaBytes());
     m_groupSettings->setIndexedDBDatabasePath(settings->indexedDBDatabasePath().isolatedCopy());
@@ -146,7 +146,7 @@ void WorkerThread::workerThread()
 {
     {
         MutexLocker lock(m_threadCreationMutex);
-        m_workerGlobalScope = createWorkerGlobalScope(m_startupData->m_scriptURL, m_startupData->m_userAgent, m_startupData->m_groupSettings.release(), m_startupData->m_contentSecurityPolicy, m_startupData->m_contentSecurityPolicyType, m_startupData->m_topOrigin.release());
+        m_workerGlobalScope = createWorkerGlobalScope(m_startupData->m_scriptURL, m_startupData->m_userAgent, std::move(m_startupData->m_groupSettings), m_startupData->m_contentSecurityPolicy, m_startupData->m_contentSecurityPolicyType, m_startupData->m_topOrigin.release());
 
         if (m_runLoop.terminated()) {
             // The worker was terminated before the thread had a chance to run. Since the context didn't exist yet,
index d5db2ab..b1fa22e 100644 (file)
@@ -74,7 +74,7 @@ namespace WebCore {
         WorkerThread(const URL&, const String& userAgent, const GroupSettings*,  const String& sourceCode, WorkerLoaderProxy&, WorkerReportingProxy&, WorkerThreadStartMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType, const SecurityOrigin* topOrigin);
 
         // Factory method for creating a new worker context for the thread.
-        virtual PassRefPtr<WorkerGlobalScope> createWorkerGlobalScope(const URL&, const String& userAgent, PassOwnPtr<GroupSettings>, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType, PassRefPtr<SecurityOrigin> topOrigin) = 0;
+        virtual PassRefPtr<WorkerGlobalScope> createWorkerGlobalScope(const URL&, const String& userAgent, std::unique_ptr<GroupSettings>, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType, PassRefPtr<SecurityOrigin> topOrigin) = 0;
 
         // Executes the event loop for the worker thread. Derived classes can override to perform actions before/after entering the event loop.
         virtual void runEventLoop();