Commit 60edc2c7 authored by weinig@apple.com's avatar weinig@apple.com

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:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156660 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ac11ea23
2013-09-29 Sam Weinig <sam@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 <antti@apple.com>
Remove FontTranscoder
......@@ -91,11 +91,6 @@ ProgressTracker::~ProgressTracker()
{
}
PassOwnPtr<ProgressTracker> ProgressTracker::create()
{
return adoptPtr(new ProgressTracker);
}
double ProgressTracker::estimatedProgress() const
{
return m_progressValue;
......
......@@ -42,9 +42,9 @@ struct ProgressItem;
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 @@ public:
bool isMainLoadProgressing() const;
private:
ProgressTracker();
void reset();
void finalProgressComplete();
......
......@@ -124,14 +124,14 @@ float deviceScaleFactor(Frame* frame)
}
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 @@ Page::Page(PageClients& pageClients)
, 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 @@ Page::Page(PageClients& pageClients)
#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 @@ void Page::setGroupName(const String& name)
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 @@ void Page::initGroup()
{
ASSERT(!m_singlePageGroup);
ASSERT(!m_group);
m_singlePageGroup = PageGroup::create(this);
m_singlePageGroup = std::make_unique<PageGroup>(*this);
m_group = m_singlePageGroup.get();
}
......
......@@ -444,15 +444,15 @@ private:
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 @@ private:
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 @@ private:
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 @@ private:
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;
......
......@@ -67,13 +67,12 @@ PageGroup::PageGroup(const String& name)
{
}
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 @@ PageGroup::~PageGroup()
removeAllUserContent();
}
PassOwnPtr<PageGroup> PageGroup::create(Page* page)
{
return adoptPtr(new PageGroup(page));
}
typedef HashMap<String, PageGroup*> PageGroupMap;
static PageGroupMap* pageGroups = 0;
......
......@@ -51,9 +51,9 @@ namespace WebCore {
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 @@ namespace WebCore {
#endif
private:
PageGroup(Page*);
void addVisitedLink(LinkHash);
void invalidateInjectedStyleSheetCacheInAllFrames();
String m_name;
HashSet<Page*> m_pages;
HashSet<LinkHash, LinkHashHash> m_visitedLinkHashes;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment