Title: [156660] trunk/Source/WebCore
Revision
156660
Author
wei...@apple.com
Date
2013-09-30 09:50:34 -0700 (Mon, 30 Sep 2013)

Log Message

Convert a bunch of OwnPtrs on Page to std::unique_ptrs
https://bugs.webkit.org/show_bug.cgi?id=122086

Reviewed by Darin Adler.

* loader/ProgressTracker.cpp:
* loader/ProgressTracker.h:
* page/Page.cpp:
(WebCore::Page::Page):
(WebCore::Page::setGroupName):
(WebCore::Page::initGroup):
* page/Page.h:
* page/PageGroup.cpp:
(WebCore::PageGroup::PageGroup):
* page/PageGroup.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (156659 => 156660)


--- trunk/Source/WebCore/ChangeLog	2013-09-30 16:32:07 UTC (rev 156659)
+++ trunk/Source/WebCore/ChangeLog	2013-09-30 16:50:34 UTC (rev 156660)
@@ -1,3 +1,21 @@
+2013-09-29  Sam Weinig  <s...@webkit.org>
+
+        Convert a bunch of OwnPtrs on Page to std::unique_ptrs
+        https://bugs.webkit.org/show_bug.cgi?id=122086
+
+        Reviewed by Darin Adler.
+
+        * loader/ProgressTracker.cpp:
+        * loader/ProgressTracker.h:
+        * page/Page.cpp:
+        (WebCore::Page::Page):
+        (WebCore::Page::setGroupName):
+        (WebCore::Page::initGroup):
+        * page/Page.h:
+        * page/PageGroup.cpp:
+        (WebCore::PageGroup::PageGroup):
+        * page/PageGroup.h:
+
 2013-09-30  Antti Koivisto  <an...@apple.com>
 
         Remove FontTranscoder

Modified: trunk/Source/WebCore/loader/ProgressTracker.cpp (156659 => 156660)


--- trunk/Source/WebCore/loader/ProgressTracker.cpp	2013-09-30 16:32:07 UTC (rev 156659)
+++ trunk/Source/WebCore/loader/ProgressTracker.cpp	2013-09-30 16:50:34 UTC (rev 156660)
@@ -91,11 +91,6 @@
 {
 }
 
-PassOwnPtr<ProgressTracker> ProgressTracker::create()
-{
-    return adoptPtr(new ProgressTracker);
-}
-
 double ProgressTracker::estimatedProgress() const
 {
     return m_progressValue;

Modified: trunk/Source/WebCore/loader/ProgressTracker.h (156659 => 156660)


--- trunk/Source/WebCore/loader/ProgressTracker.h	2013-09-30 16:32:07 UTC (rev 156659)
+++ trunk/Source/WebCore/loader/ProgressTracker.h	2013-09-30 16:50:34 UTC (rev 156660)
@@ -42,9 +42,9 @@
 class ProgressTracker {
     WTF_MAKE_NONCOPYABLE(ProgressTracker); WTF_MAKE_FAST_ALLOCATED;
 public:
+    ProgressTracker();
     ~ProgressTracker();
 
-    static PassOwnPtr<ProgressTracker> create();
     static unsigned long createUniqueIdentifier();
 
     double estimatedProgress() const;
@@ -62,8 +62,6 @@
     bool isMainLoadProgressing() const;
 
 private:
-    ProgressTracker();
-
     void reset();
     void finalProgressComplete();
 

Modified: trunk/Source/WebCore/page/Page.cpp (156659 => 156660)


--- trunk/Source/WebCore/page/Page.cpp	2013-09-30 16:32:07 UTC (rev 156659)
+++ trunk/Source/WebCore/page/Page.cpp	2013-09-30 16:50:34 UTC (rev 156660)
@@ -124,14 +124,14 @@
 }
 
 Page::Page(PageClients& pageClients)
-    : m_chrome(createOwned<Chrome>(*this, *pageClients.chromeClient))
-    , m_dragCaretController(createOwned<DragCaretController>())
+    : m_chrome(std::make_unique<Chrome>(*this, *pageClients.chromeClient))
+    , m_dragCaretController(std::make_unique<DragCaretController>())
 #if ENABLE(DRAG_SUPPORT)
-    , m_dragController(createOwned<DragController>(*this, *pageClients.dragClient))
+    , m_dragController(std::make_unique<DragController>(*this, *pageClients.dragClient))
 #endif
-    , m_focusController(createOwned<FocusController>(*this))
+    , m_focusController(std::make_unique<FocusController>(*this))
 #if ENABLE(CONTEXT_MENUS)
-    , m_contextMenuController(createOwned<ContextMenuController>(*this, *pageClients.contextMenuClient))
+    , m_contextMenuController(std::make_unique<ContextMenuController>(*this, *pageClients.contextMenuClient))
 #endif
 #if ENABLE(INSPECTOR)
     , m_inspectorController(InspectorController::create(this, pageClients.inspectorClient))
@@ -140,8 +140,8 @@
     , m_pointerLockController(PointerLockController::create(this))
 #endif
     , m_settings(Settings::create(this))
-    , m_progress(ProgressTracker::create())
-    , m_backForwardController(createOwned<BackForwardController>(*this, pageClients.backForwardClient))
+    , m_progress(std::make_unique<ProgressTracker>())
+    , m_backForwardController(std::make_unique<BackForwardController>(*this, pageClients.backForwardClient))
     , m_mainFrame(MainFrame::create(*this, *pageClients.loaderClientForMainFrame))
     , m_theme(RenderTheme::themeForPage(this))
     , m_editorClient(pageClients.editorClient)
@@ -185,8 +185,8 @@
 #endif
     , m_alternativeTextClient(pageClients.alternativeTextClient)
     , m_scriptedAnimationsSuspended(false)
-    , m_pageThrottler(createOwned<PageThrottler>(*this))
-    , m_console(createOwned<PageConsole>(*this))
+    , m_pageThrottler(std::make_unique<PageThrottler>(*this))
+    , m_console(std::make_unique<PageConsole>(*this))
     , m_lastSpatialNavigationCandidatesCount(0) // NOTE: Only called from Internals for Spatial Navigation testing.
     , m_framesHandlingBeforeUnloadEvent(0)
 {
@@ -440,7 +440,7 @@
     if (name.isEmpty())
         m_group = m_singlePageGroup.get();
     else {
-        m_singlePageGroup.clear();
+        m_singlePageGroup = nullptr;
         m_group = PageGroup::pageGroup(name);
         m_group->addPage(this);
     }
@@ -455,7 +455,7 @@
 {
     ASSERT(!m_singlePageGroup);
     ASSERT(!m_group);
-    m_singlePageGroup = PageGroup::create(this);
+    m_singlePageGroup = std::make_unique<PageGroup>(*this);
     m_group = m_singlePageGroup.get();
 }
 

Modified: trunk/Source/WebCore/page/Page.h (156659 => 156660)


--- trunk/Source/WebCore/page/Page.h	2013-09-30 16:32:07 UTC (rev 156659)
+++ trunk/Source/WebCore/page/Page.h	2013-09-30 16:50:34 UTC (rev 156660)
@@ -444,15 +444,15 @@
     void throttleTimers();
     void unthrottleTimers();
 
-    const OwnPtr<Chrome> m_chrome;
-    const OwnPtr<DragCaretController> m_dragCaretController;
+    const std::unique_ptr<Chrome> m_chrome;
+    const std::unique_ptr<DragCaretController> m_dragCaretController;
 
 #if ENABLE(DRAG_SUPPORT)
-    const OwnPtr<DragController> m_dragController;
+    const std::unique_ptr<DragController> m_dragController;
 #endif
-    const OwnPtr<FocusController> m_focusController;
+    const std::unique_ptr<FocusController> m_focusController;
 #if ENABLE(CONTEXT_MENUS)
-    const OwnPtr<ContextMenuController> m_contextMenuController;
+    const std::unique_ptr<ContextMenuController> m_contextMenuController;
 #endif
 #if ENABLE(INSPECTOR)
     OwnPtr<InspectorController> m_inspectorController;
@@ -463,9 +463,9 @@
     RefPtr<ScrollingCoordinator> m_scrollingCoordinator;
 
     const RefPtr<Settings> m_settings;
-    const OwnPtr<ProgressTracker> m_progress;
+    const std::unique_ptr<ProgressTracker> m_progress;
 
-    const OwnPtr<BackForwardController> m_backForwardController;
+    const std::unique_ptr<BackForwardController> m_backForwardController;
     const RefPtr<MainFrame> m_mainFrame;
 
     mutable RefPtr<PluginData> m_pluginData;
@@ -502,7 +502,7 @@
     mutable bool m_didLoadUserStyleSheet;
     mutable time_t m_userStyleSheetModificationTime;
 
-    OwnPtr<PageGroup> m_singlePageGroup;
+    std::unique_ptr<PageGroup> m_singlePageGroup;
     PageGroup* m_group;
 
     JSC::Debugger* m_debugger;
@@ -546,8 +546,8 @@
     AlternativeTextClient* m_alternativeTextClient;
 
     bool m_scriptedAnimationsSuspended;
-    const OwnPtr<PageThrottler> m_pageThrottler;
-    const OwnPtr<PageConsole> m_console;
+    const std::unique_ptr<PageThrottler> m_pageThrottler;
+    const std::unique_ptr<PageConsole> m_console;
 
     HashSet<String> m_seenPlugins;
     HashSet<String> m_seenMediaEngines;

Modified: trunk/Source/WebCore/page/PageGroup.cpp (156659 => 156660)


--- trunk/Source/WebCore/page/PageGroup.cpp	2013-09-30 16:32:07 UTC (rev 156659)
+++ trunk/Source/WebCore/page/PageGroup.cpp	2013-09-30 16:50:34 UTC (rev 156660)
@@ -67,13 +67,12 @@
 {
 }
 
-PageGroup::PageGroup(Page* page)
+PageGroup::PageGroup(Page& page)
     : m_visitedLinksPopulated(false)
     , m_identifier(getUniqueIdentifier())
     , m_groupSettings(GroupSettings::create())
 {
-    ASSERT(page);
-    addPage(page);
+    addPage(&page);
 }
 
 PageGroup::~PageGroup()
@@ -81,11 +80,6 @@
     removeAllUserContent();
 }
 
-PassOwnPtr<PageGroup> PageGroup::create(Page* page)
-{
-    return adoptPtr(new PageGroup(page));
-}
-
 typedef HashMap<String, PageGroup*> PageGroupMap;
 static PageGroupMap* pageGroups = 0;
 

Modified: trunk/Source/WebCore/page/PageGroup.h (156659 => 156660)


--- trunk/Source/WebCore/page/PageGroup.h	2013-09-30 16:32:07 UTC (rev 156659)
+++ trunk/Source/WebCore/page/PageGroup.h	2013-09-30 16:50:34 UTC (rev 156660)
@@ -51,9 +51,9 @@
         WTF_MAKE_NONCOPYABLE(PageGroup); WTF_MAKE_FAST_ALLOCATED;
     public:
         explicit PageGroup(const String& name);
+        explicit PageGroup(Page&);
         ~PageGroup();
 
-        static PassOwnPtr<PageGroup> create(Page*);
         static PageGroup* pageGroup(const String& groupName);
 
         static void closeLocalStorage();
@@ -116,13 +116,10 @@
 #endif
 
     private:
-        PageGroup(Page*);
-
         void addVisitedLink(LinkHash);
         void invalidateInjectedStyleSheetCacheInAllFrames();
 
         String m_name;
-
         HashSet<Page*> m_pages;
 
         HashSet<LinkHash, LinkHashHash> m_visitedLinkHashes;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to