Move cross-port Source/WebCore/page/ code to std::unique_ptr
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 21 Apr 2014 17:11:43 +0000 (17:11 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 21 Apr 2014 17:11:43 +0000 (17:11 +0000)
https://bugs.webkit.org/show_bug.cgi?id=130534

Reviewed by Darin Adler.

Source/WebCore:
Replace uses of OwnPtr and PassOwnPtr in cross-port code under Source/WebCore/page/ with
std::unique_ptr. Unnecessary OwnPtr.h and PassOwnPtr.h header inclusions are removed as well.

* dom/Document.cpp:
(WebCore::Document::initSecurityContext):
* dom/SecurityContext.cpp:
(WebCore::SecurityContext::setContentSecurityPolicy):
* dom/SecurityContext.h:
* page/CaptionUserPreferences.h:
* page/ContentSecurityPolicy.cpp:
(WebCore::CSPDirectiveList::create):
(WebCore::CSPDirectiveList::checkEvalAndReportViolation):
(WebCore::CSPDirectiveList::checkInlineAndReportViolation):
(WebCore::CSPDirectiveList::checkSourceAndReportViolation):
(WebCore::CSPDirectiveList::setCSPDirective):
(WebCore::ContentSecurityPolicy::didReceiveHeader):
* page/ContentSecurityPolicy.h:
* page/DOMSecurityPolicy.h:
* page/DOMWindow.cpp:
(WebCore::PostMessageTimer::fired):
(WebCore::DOMWindow::postMessageTimerFired):
* page/DOMWindow.h:
* page/EventHandler.cpp:
(WebCore::EventHandler::EventHandler):
* page/EventHandler.h:
* page/Frame.cpp:
(WebCore::Frame::Frame):
(WebCore::createRegExpForLabels):
(WebCore::Frame::searchForLabelsAboveCell):
(WebCore::Frame::searchForLabelsBeforeElement):
(WebCore::matchLabelsAgainstString):
(WebCore::Frame::setTiledBackingStoreEnabled):
* page/Frame.h:
* page/FrameView.cpp:
(WebCore::FrameView::addEmbeddedObjectToUpdate):
(WebCore::FrameView::addSlowRepaintObject):
(WebCore::FrameView::addViewportConstrainedObject):
(WebCore::FrameView::addScrollableArea):
* page/FrameView.h:
* page/Page.cpp:
(WebCore::Page::Page):
* page/Page.h:
* page/PageConsole.h:
* page/PageThrottler.h:
* page/SecurityPolicy.cpp:
(WebCore::SecurityPolicy::addOriginAccessWhitelistEntry):
* page/animation/AnimationController.h:
* page/animation/CSSPropertyAnimation.cpp:
(WebCore::PropertyWrapperVisitedAffectedColor::PropertyWrapperVisitedAffectedColor):
(WebCore::CSSPropertyAnimationWrapperMap::instance):
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
* page/mac/PageMac.cpp:
(WebCore::Page::addSchedulePair):
* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::applyContentSecurityPolicyFromString):

Source/WebKit/mac:
* WebView/WebHTMLRepresentation.mm:
(searchForLabelsBeforeElement): Pass a RegExp reference to Frame::searchForLabelsAboveCell().

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@167594 268f45cc-cd09-0410-ab3c-d52691b4dbfc

26 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/SecurityContext.cpp
Source/WebCore/dom/SecurityContext.h
Source/WebCore/page/CaptionUserPreferences.h
Source/WebCore/page/ContentSecurityPolicy.cpp
Source/WebCore/page/ContentSecurityPolicy.h
Source/WebCore/page/DOMSecurityPolicy.h
Source/WebCore/page/DOMWindow.cpp
Source/WebCore/page/DOMWindow.h
Source/WebCore/page/EventHandler.cpp
Source/WebCore/page/EventHandler.h
Source/WebCore/page/Frame.cpp
Source/WebCore/page/Frame.h
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/FrameView.h
Source/WebCore/page/Page.h
Source/WebCore/page/PageThrottler.h
Source/WebCore/page/SecurityPolicy.cpp
Source/WebCore/page/animation/AnimationController.h
Source/WebCore/page/animation/CSSPropertyAnimation.cpp
Source/WebCore/page/mac/PageMac.cpp
Source/WebCore/workers/WorkerGlobalScope.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebHTMLRepresentation.mm

index 53396b6..b3d3618 100644 (file)
@@ -1,3 +1,66 @@
+2014-04-21  Zan Dobersek  <zdobersek@igalia.com>
+
+        Move cross-port Source/WebCore/page/ code to std::unique_ptr
+        https://bugs.webkit.org/show_bug.cgi?id=130534
+
+        Reviewed by Darin Adler.
+
+        Replace uses of OwnPtr and PassOwnPtr in cross-port code under Source/WebCore/page/ with
+        std::unique_ptr. Unnecessary OwnPtr.h and PassOwnPtr.h header inclusions are removed as well.
+
+        * dom/Document.cpp:
+        (WebCore::Document::initSecurityContext):
+        * dom/SecurityContext.cpp:
+        (WebCore::SecurityContext::setContentSecurityPolicy):
+        * dom/SecurityContext.h:
+        * page/CaptionUserPreferences.h:
+        * page/ContentSecurityPolicy.cpp:
+        (WebCore::CSPDirectiveList::create):
+        (WebCore::CSPDirectiveList::checkEvalAndReportViolation):
+        (WebCore::CSPDirectiveList::checkInlineAndReportViolation):
+        (WebCore::CSPDirectiveList::checkSourceAndReportViolation):
+        (WebCore::CSPDirectiveList::setCSPDirective):
+        (WebCore::ContentSecurityPolicy::didReceiveHeader):
+        * page/ContentSecurityPolicy.h:
+        * page/DOMSecurityPolicy.h:
+        * page/DOMWindow.cpp:
+        (WebCore::PostMessageTimer::fired):
+        (WebCore::DOMWindow::postMessageTimerFired):
+        * page/DOMWindow.h:
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::EventHandler):
+        * page/EventHandler.h:
+        * page/Frame.cpp:
+        (WebCore::Frame::Frame):
+        (WebCore::createRegExpForLabels):
+        (WebCore::Frame::searchForLabelsAboveCell):
+        (WebCore::Frame::searchForLabelsBeforeElement):
+        (WebCore::matchLabelsAgainstString):
+        (WebCore::Frame::setTiledBackingStoreEnabled):
+        * page/Frame.h:
+        * page/FrameView.cpp:
+        (WebCore::FrameView::addEmbeddedObjectToUpdate):
+        (WebCore::FrameView::addSlowRepaintObject):
+        (WebCore::FrameView::addViewportConstrainedObject):
+        (WebCore::FrameView::addScrollableArea):
+        * page/FrameView.h:
+        * page/Page.cpp:
+        (WebCore::Page::Page):
+        * page/Page.h:
+        * page/PageConsole.h:
+        * page/PageThrottler.h:
+        * page/SecurityPolicy.cpp:
+        (WebCore::SecurityPolicy::addOriginAccessWhitelistEntry):
+        * page/animation/AnimationController.h:
+        * page/animation/CSSPropertyAnimation.cpp:
+        (WebCore::PropertyWrapperVisitedAffectedColor::PropertyWrapperVisitedAffectedColor):
+        (WebCore::CSSPropertyAnimationWrapperMap::instance):
+        (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
+        * page/mac/PageMac.cpp:
+        (WebCore::Page::addSchedulePair):
+        * workers/WorkerGlobalScope.cpp:
+        (WebCore::WorkerGlobalScope::applyContentSecurityPolicyFromString):
+
 2014-04-21  Darin Adler  <darin@apple.com>
 
         Add HashSet::takeAny
index 8f8ad98..bd86f9f 100644 (file)
@@ -1110,7 +1110,7 @@ __ZN7WebCore5Frame14frameForWidgetEPKNS_6WidgetE
 __ZN7WebCore5Frame17setPageZoomFactorEf
 __ZN7WebCore5Frame17setTextZoomFactorEf
 __ZN7WebCore5Frame23visiblePositionForPointERKNS_8IntPointE
-__ZN7WebCore5Frame24searchForLabelsAboveCellEPN3JSC4Yarr17RegularExpressionEPNS_20HTMLTableCellElementEPm
+__ZN7WebCore5Frame24searchForLabelsAboveCellERKN3JSC4Yarr17RegularExpressionEPNS_20HTMLTableCellElementEPm
 __ZN7WebCore5Frame25setPageAndTextZoomFactorsEff
 __ZN7WebCore5Frame27resizePageRectsKeepingRatioERKNS_9FloatSizeES3_
 __ZN7WebCore5Frame6createEPNS_4PageEPNS_21HTMLFrameOwnerElementEPNS_17FrameLoaderClientE
index 9d5b4fb..45bb47d 100644 (file)
@@ -4619,7 +4619,7 @@ void Document::initSecurityContext()
         // This can occur via document.implementation.createDocument().
         m_cookieURL = URL(ParsedURLString, emptyString());
         setSecurityOrigin(SecurityOrigin::createUnique());
-        setContentSecurityPolicy(ContentSecurityPolicy::create(this));
+        setContentSecurityPolicy(std::make_unique<ContentSecurityPolicy>(this));
         return;
     }
 
@@ -4639,7 +4639,7 @@ void Document::initSecurityContext()
 #endif
 
     setSecurityOrigin(isSandboxed(SandboxOrigin) ? SecurityOrigin::createUnique() : SecurityOrigin::create(m_url));
-    setContentSecurityPolicy(ContentSecurityPolicy::create(this));
+    setContentSecurityPolicy(std::make_unique<ContentSecurityPolicy>(this));
 
     if (Settings* settings = this->settings()) {
         if (!settings->webSecurityEnabled()) {
index 95e1c52..24778b0 100644 (file)
@@ -50,9 +50,9 @@ void SecurityContext::setSecurityOrigin(PassRefPtr<SecurityOrigin> securityOrigi
     m_haveInitializedSecurityOrigin = true;
 }
 
-void SecurityContext::setContentSecurityPolicy(PassOwnPtr<ContentSecurityPolicy> contentSecurityPolicy)
+void SecurityContext::setContentSecurityPolicy(std::unique_ptr<ContentSecurityPolicy> contentSecurityPolicy)
 {
-    m_contentSecurityPolicy = contentSecurityPolicy;
+    m_contentSecurityPolicy = std::move(contentSecurityPolicy);
 }
 
 bool SecurityContext::isSecureTransitionTo(const URL& url) const
index 785301c..7ccab17 100644 (file)
@@ -27,6 +27,7 @@
 #ifndef SecurityContext_h
 #define SecurityContext_h
 
+#include <memory>
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefPtr.h>
 #include <wtf/text/WTFString.h>
@@ -76,7 +77,7 @@ protected:
     SecurityContext();
     virtual ~SecurityContext();
 
-    void setContentSecurityPolicy(PassOwnPtr<ContentSecurityPolicy>);
+    void setContentSecurityPolicy(std::unique_ptr<ContentSecurityPolicy>);
 
     void didFailToInitializeSecurityOrigin() { m_haveInitializedSecurityOrigin = false; }
     bool haveInitializedSecurityOrigin() const { return m_haveInitializedSecurityOrigin; }
@@ -85,7 +86,7 @@ private:
     bool m_haveInitializedSecurityOrigin;
     SandboxFlags m_sandboxFlags;
     RefPtr<SecurityOrigin> m_securityOrigin;
-    OwnPtr<ContentSecurityPolicy> m_contentSecurityPolicy;
+    std::unique_ptr<ContentSecurityPolicy> m_contentSecurityPolicy;
 };
 
 } // namespace WebCore
index 3e5a3b9..a8af7a6 100644 (file)
@@ -32,7 +32,6 @@
 #include "LocalizedStrings.h"
 #include "TextTrack.h"
 #include "Timer.h"
-#include <wtf/PassOwnPtr.h>
 #include <wtf/text/AtomicString.h>
 
 namespace WebCore {
index 57488b1..f0a9cea 100644 (file)
@@ -810,7 +810,8 @@ private:
 class CSPDirectiveList {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    static PassOwnPtr<CSPDirectiveList> create(ContentSecurityPolicy*, const String&, ContentSecurityPolicy::HeaderType);
+    static std::unique_ptr<CSPDirectiveList> create(ContentSecurityPolicy*, const String&, ContentSecurityPolicy::HeaderType);
+    CSPDirectiveList(ContentSecurityPolicy*, ContentSecurityPolicy::HeaderType);
 
     const String& header() const { return m_header; }
     ContentSecurityPolicy::HeaderType headerType() const { return m_headerType; }
@@ -841,8 +842,6 @@ public:
     const Vector<URL>& reportURIs() const { return m_reportURIs; }
 
 private:
-    CSPDirectiveList(ContentSecurityPolicy*, ContentSecurityPolicy::HeaderType);
-
     void parse(const String&);
 
     bool parseDirective(const UChar* begin, const UChar* end, String& name, String& value);
@@ -854,7 +853,7 @@ private:
     void applySandboxPolicy(const String& name, const String& sandboxPolicy);
 
     template <class CSPDirectiveType>
-    void setCSPDirective(const String& name, const String& value, OwnPtr<CSPDirectiveType>&);
+    void setCSPDirective(const String& name, const String& value, std::unique_ptr<CSPDirectiveType>&);
 
     SourceListDirective* operativeDirective(SourceListDirective*) const;
     void reportViolation(const String& directiveText, const String& effectiveDirective, const String& consoleMessage, const URL& blockedURL = URL(), const String& contextURL = String(), const WTF::OrdinalNumber& contextLine = WTF::OrdinalNumber::beforeFirst(), JSC::ExecState* = 0) const;
@@ -885,19 +884,19 @@ private:
     bool m_haveSandboxPolicy;
     ContentSecurityPolicy::ReflectedXSSDisposition m_reflectedXSSDisposition;
 
-    OwnPtr<MediaListDirective> m_pluginTypes;
-    OwnPtr<NonceDirective> m_scriptNonce;
-    OwnPtr<SourceListDirective> m_baseURI;
-    OwnPtr<SourceListDirective> m_connectSrc;
-    OwnPtr<SourceListDirective> m_defaultSrc;
-    OwnPtr<SourceListDirective> m_fontSrc;
-    OwnPtr<SourceListDirective> m_formAction;
-    OwnPtr<SourceListDirective> m_frameSrc;
-    OwnPtr<SourceListDirective> m_imgSrc;
-    OwnPtr<SourceListDirective> m_mediaSrc;
-    OwnPtr<SourceListDirective> m_objectSrc;
-    OwnPtr<SourceListDirective> m_scriptSrc;
-    OwnPtr<SourceListDirective> m_styleSrc;
+    std::unique_ptr<MediaListDirective> m_pluginTypes;
+    std::unique_ptr<NonceDirective> m_scriptNonce;
+    std::unique_ptr<SourceListDirective> m_baseURI;
+    std::unique_ptr<SourceListDirective> m_connectSrc;
+    std::unique_ptr<SourceListDirective> m_defaultSrc;
+    std::unique_ptr<SourceListDirective> m_fontSrc;
+    std::unique_ptr<SourceListDirective> m_formAction;
+    std::unique_ptr<SourceListDirective> m_frameSrc;
+    std::unique_ptr<SourceListDirective> m_imgSrc;
+    std::unique_ptr<SourceListDirective> m_mediaSrc;
+    std::unique_ptr<SourceListDirective> m_objectSrc;
+    std::unique_ptr<SourceListDirective> m_scriptSrc;
+    std::unique_ptr<SourceListDirective> m_styleSrc;
 
     Vector<URL> m_reportURIs;
 
@@ -914,9 +913,9 @@ CSPDirectiveList::CSPDirectiveList(ContentSecurityPolicy* policy, ContentSecurit
     m_reportOnly = (type == ContentSecurityPolicy::Report || type == ContentSecurityPolicy::PrefixedReport);
 }
 
-PassOwnPtr<CSPDirectiveList> CSPDirectiveList::create(ContentSecurityPolicy* policy, const String& header, ContentSecurityPolicy::HeaderType type)
+std::unique_ptr<CSPDirectiveList> CSPDirectiveList::create(ContentSecurityPolicy* policy, const String& header, ContentSecurityPolicy::HeaderType type)
 {
-    OwnPtr<CSPDirectiveList> directives = adoptPtr(new CSPDirectiveList(policy, type));
+    auto directives = std::make_unique<CSPDirectiveList>(policy, type);
     directives->parse(header);
 
     if (!directives->checkEval(directives->operativeDirective(directives->m_scriptSrc.get()))) {
@@ -927,7 +926,7 @@ PassOwnPtr<CSPDirectiveList> CSPDirectiveList::create(ContentSecurityPolicy* pol
     if (directives->isReportOnly() && directives->reportURIs().isEmpty())
         policy->reportMissingReportURI(header);
 
-    return directives.release();
+    return directives;
 }
 
 void CSPDirectiveList::reportViolation(const String& directiveText, const String& effectiveDirective, const String& consoleMessage, const URL& blockedURL, const String& contextURL, const WTF::OrdinalNumber& contextLine, JSC::ExecState* state) const
@@ -976,7 +975,7 @@ bool CSPDirectiveList::checkEvalAndReportViolation(SourceListDirective* directiv
         return true;
 
     String suffix = String();
-    if (directive == m_defaultSrc)
+    if (directive == m_defaultSrc.get())
         suffix = " Note that 'script-src' was not explicitly set, so 'default-src' is used as a fallback.";
 
     reportViolation(directive->text(), scriptSrc, consoleMessage + "\"" + directive->text() + "\"." + suffix + "\n", URL(), contextURL, contextLine, state);
@@ -1014,7 +1013,7 @@ bool CSPDirectiveList::checkInlineAndReportViolation(SourceListDirective* direct
         return true;
 
     String suffix = String();
-    if (directive == m_defaultSrc)
+    if (directive == m_defaultSrc.get())
         suffix = makeString(" Note that '", (isScript ? "script" : "style"), "-src' was not explicitly set, so 'default-src' is used as a fallback.");
 
     reportViolation(directive->text(), isScript ? scriptSrc : styleSrc, consoleMessage + "\"" + directive->text() + "\"." + suffix + "\n", URL(), contextURL, contextLine);
@@ -1055,7 +1054,7 @@ bool CSPDirectiveList::checkSourceAndReportViolation(SourceListDirective* direct
         prefix = "Refused to load the stylesheet '";
 
     String suffix = String();
-    if (directive == m_defaultSrc)
+    if (directive == m_defaultSrc.get())
         suffix = " Note that '" + effectiveDirective + "' was not explicitly set, so 'default-src' is used as a fallback.";
 
     reportViolation(directive->text(), effectiveDirective, prefix + url.stringCenterEllipsizedToLength() + "' because it violates the following Content Security Policy directive: \"" + directive->text() + "\"." + suffix + "\n", url);
@@ -1314,13 +1313,13 @@ void CSPDirectiveList::parseReportURI(const String& name, const String& value)
 
 
 template<class CSPDirectiveType>
-void CSPDirectiveList::setCSPDirective(const String& name, const String& value, OwnPtr<CSPDirectiveType>& directive)
+void CSPDirectiveList::setCSPDirective(const String& name, const String& value, std::unique_ptr<CSPDirectiveType>& directive)
 {
     if (directive) {
         m_policy->reportDuplicateDirective(name);
         return;
     }
-    directive = adoptPtr(new CSPDirectiveType(name, value, m_policy));
+    directive = std::make_unique<CSPDirectiveType>(name, value, m_policy);
 }
 
 void CSPDirectiveList::applySandboxPolicy(const String& name, const String& sandboxPolicy)
@@ -1459,7 +1458,7 @@ void ContentSecurityPolicy::didReceiveHeader(const String& header, HeaderType ty
 
         // header1,header2 OR header1
         //        ^                  ^
-        OwnPtr<CSPDirectiveList> policy = CSPDirectiveList::create(this, String(begin, position - begin), type);
+        std::unique_ptr<CSPDirectiveList> policy = CSPDirectiveList::create(this, String(begin, position - begin), type);
         if (!policy->isReportOnly() && !policy->allowEval(0, SuppressReport))
             m_scriptExecutionContext->disableEval(policy->evalDisabledErrorMessage());
 
index 80ff256..1a5216c 100644 (file)
@@ -28,7 +28,7 @@
 
 #include "URL.h"
 #include "ScriptState.h"
-#include <wtf/PassOwnPtr.h>
+#include <memory>
 #include <wtf/RefCounted.h>
 #include <wtf/Vector.h>
 #include <wtf/text/TextPosition.h>
@@ -46,15 +46,12 @@ class ScriptExecutionContext;
 class SecurityOrigin;
 
 typedef int SandboxFlags;
-typedef Vector<OwnPtr<CSPDirectiveList>> CSPDirectiveListVector;
+typedef Vector<std::unique_ptr<CSPDirectiveList>> CSPDirectiveListVector;
 
 class ContentSecurityPolicy {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    static PassOwnPtr<ContentSecurityPolicy> create(ScriptExecutionContext* scriptExecutionContext)
-    {
-        return adoptPtr(new ContentSecurityPolicy(scriptExecutionContext));
-    }
+    explicit ContentSecurityPolicy(ScriptExecutionContext*);
     ~ContentSecurityPolicy();
 
     void copyStateFrom(const ContentSecurityPolicy*);
@@ -137,8 +134,6 @@ public:
     bool experimentalFeaturesEnabled() const;
 
 private:
-    explicit ContentSecurityPolicy(ScriptExecutionContext*);
-
     void logToConsole(const String& message, const String& contextURL = String(), const WTF::OrdinalNumber& contextLine = WTF::OrdinalNumber::beforeFirst(), JSC::ExecState* = 0) const;
 
     ScriptExecutionContext* m_scriptExecutionContext;
index e3afd70..42ae518 100644 (file)
@@ -27,7 +27,6 @@
 #define DOMSecurityPolicy_h
 
 #include "ContextDestructionObserver.h"
-#include <wtf/PassOwnPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/Vector.h>
 #include <wtf/text/WTFString.h>
index a47c69b..7f9aaf8 100644 (file)
 #include <algorithm>
 #include <inspector/ScriptCallStack.h>
 #include <inspector/ScriptCallStackFactory.h>
+#include <memory>
 #include <wtf/CurrentTime.h>
 #include <wtf/MainThread.h>
 #include <wtf/MathExtras.h>
@@ -152,8 +153,9 @@ public:
 private:
     virtual void fired()
     {
-        m_window->postMessageTimerFired(adoptPtr(this));
-        // This object is deleted now.
+        // This object gets deleted when std::unique_ptr falls out of scope..
+        std::unique_ptr<PostMessageTimer> timer(this);
+        m_window->postMessageTimerFired(*timer);
     }
 
     RefPtr<DOMWindow> m_window;
@@ -841,14 +843,12 @@ void DOMWindow::postMessage(PassRefPtr<SerializedScriptValue> message, const Mes
     timer->startOneShot(0);
 }
 
-void DOMWindow::postMessageTimerFired(PassOwnPtr<PostMessageTimer> t)
+void DOMWindow::postMessageTimerFired(PostMessageTimer& timer)
 {
-    OwnPtr<PostMessageTimer> timer(t);
-
     if (!document() || !isCurrentlyDisplayedInFrame())
         return;
 
-    dispatchMessageEventWithOriginCheck(timer->targetOrigin(), timer->event(document()), timer->stackTrace());
+    dispatchMessageEventWithOriginCheck(timer.targetOrigin(), timer.event(document()), timer.stackTrace());
 }
 
 void DOMWindow::dispatchMessageEventWithOriginCheck(SecurityOrigin* intendedTargetOrigin, PassRefPtr<Event> event, PassRefPtr<ScriptCallStack> stackTrace)
index b8b5aa6..ac94c8a 100644 (file)
@@ -239,7 +239,7 @@ namespace WebCore {
         void postMessage(PassRefPtr<SerializedScriptValue> message, const MessagePortArray*, const String& targetOrigin, DOMWindow& source, ExceptionCode&);
         // Needed for Objective-C bindings (see bug 28774).
         void postMessage(PassRefPtr<SerializedScriptValue> message, MessagePort*, const String& targetOrigin, DOMWindow& source, ExceptionCode&);
-        void postMessageTimerFired(PassOwnPtr<PostMessageTimer>);
+        void postMessageTimerFired(PostMessageTimer&);
         void dispatchMessageEventWithOriginCheck(SecurityOrigin* intendedTargetOrigin, PassRefPtr<Event>, PassRefPtr<Inspector::ScriptCallStack>);
 
         void scrollBy(int x, int y) const;
index d9689b8..c7a98ae 100644 (file)
@@ -336,7 +336,7 @@ EventHandler::EventHandler(Frame& frame)
 #if ENABLE(CURSOR_SUPPORT)
     , m_cursorUpdateTimer(this, &EventHandler::cursorUpdateTimerFired)
 #endif
-    , m_autoscrollController(adoptPtr(new AutoscrollController))
+    , m_autoscrollController(std::make_unique<AutoscrollController>())
     , m_mouseDownMayStartAutoscroll(false)
     , m_mouseDownWasInSubframe(false)
 #if !ENABLE(IOS_TOUCH_EVENTS)
@@ -357,7 +357,7 @@ EventHandler::EventHandler(Frame& frame)
 #endif
     , m_mousePositionIsUnknown(true)
     , m_mouseDownTimestamp(0)
-    , m_recentWheelEventDeltaTracker(adoptPtr(new WheelEventDeltaTracker))
+    , m_recentWheelEventDeltaTracker(std::make_unique<WheelEventDeltaTracker>())
     , m_widgetIsLatched(false)
 #if PLATFORM(COCOA)
     , m_mouseDownView(nil)
index 90e3f14..7a8751f 100644 (file)
@@ -38,8 +38,8 @@
 #include "TextGranularity.h"
 #include "Timer.h"
 #include "WheelEventDeltaTracker.h"
+#include <memory>
 #include <wtf/Forward.h>
-#include <wtf/OwnPtr.h>
 #include <wtf/RefPtr.h>
 
 #if PLATFORM(IOS)
@@ -464,7 +464,7 @@ private:
     Timer<EventHandler> m_cursorUpdateTimer;
 #endif
 
-    OwnPtr<AutoscrollController> m_autoscrollController;
+    std::unique_ptr<AutoscrollController> m_autoscrollController;
     bool m_mouseDownMayStartAutoscroll;
     bool m_mouseDownWasInSubframe;
 
@@ -521,7 +521,7 @@ private:
     double m_mouseDownTimestamp;
     PlatformMouseEvent m_mouseDown;
 
-    OwnPtr<WheelEventDeltaTracker> m_recentWheelEventDeltaTracker;
+    std::unique_ptr<WheelEventDeltaTracker> m_recentWheelEventDeltaTracker;
     RefPtr<Element> m_latchedWheelEventElement;
     bool m_widgetIsLatched;
 
index d4112b4..237451e 100644 (file)
 #include "npruntime_impl.h"
 #include "runtime_root.h"
 #include <bindings/ScriptValue.h>
-#include <wtf/PassOwnPtr.h>
 #include <wtf/RefCountedLeakCounter.h>
 #include <wtf/StdLibExtras.h>
 #include <yarr/RegularExpression.h>
@@ -163,8 +162,8 @@ Frame::Frame(Page& page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient&
     , m_ownerElement(ownerElement)
     , m_script(std::make_unique<ScriptController>(*this))
     , m_editor(std::make_unique<Editor>(*this))
-    , m_selection(adoptPtr(new FrameSelection(this)))
-    , m_eventHandler(adoptPtr(new EventHandler(*this)))
+    , m_selection(std::make_unique<FrameSelection>(this))
+    , m_eventHandler(std::make_unique<EventHandler>(*this))
     , m_animationController(std::make_unique<AnimationController>(*this))
 #if PLATFORM(IOS)
     , m_overflowAutoScrollTimer(this, &Frame::overflowAutoScrollTimerFired)
@@ -312,7 +311,7 @@ void Frame::sendOrientationChangeEvent(int orientation)
 }
 #endif // ENABLE(ORIENTATION_EVENTS)
 
-static PassOwnPtr<JSC::Yarr::RegularExpression> createRegExpForLabels(const Vector<String>& labels)
+static JSC::Yarr::RegularExpression createRegExpForLabels(const Vector<String>& labels)
 {
     // REVIEW- version of this call in FrameMac.mm caches based on the NSArray ptrs being
     // the same across calls.  We can't do that.
@@ -344,10 +343,10 @@ static PassOwnPtr<JSC::Yarr::RegularExpression> createRegExpForLabels(const Vect
             pattern.appendLiteral("\\b");
     }
     pattern.append(')');
-    return adoptPtr(new JSC::Yarr::RegularExpression(pattern.toString(), TextCaseInsensitive));
+    return JSC::Yarr::RegularExpression(pattern.toString(), TextCaseInsensitive);
 }
 
-String Frame::searchForLabelsAboveCell(JSC::Yarr::RegularExpression* regExp, HTMLTableCellElement* cell, size_t* resultDistanceFromStartOfCell)
+String Frame::searchForLabelsAboveCell(const JSC::Yarr::RegularExpression& regExp, HTMLTableCellElement* cell, size_t* resultDistanceFromStartOfCell)
 {
     HTMLTableCellElement* aboveCell = cell->cellAbove();
     if (aboveCell) {
@@ -358,11 +357,11 @@ String Frame::searchForLabelsAboveCell(JSC::Yarr::RegularExpression* regExp, HTM
                 continue;
             // For each text chunk, run the regexp
             String nodeString = textNode->data();
-            int pos = regExp->searchRev(nodeString);
+            int pos = regExp.searchRev(nodeString);
             if (pos >= 0) {
                 if (resultDistanceFromStartOfCell)
                     *resultDistanceFromStartOfCell = lengthSearched;
-                return nodeString.substring(pos, regExp->matchedLength());
+                return nodeString.substring(pos, regExp.matchedLength());
             }
             lengthSearched += nodeString.length();
         }
@@ -376,7 +375,7 @@ String Frame::searchForLabelsAboveCell(JSC::Yarr::RegularExpression* regExp, HTM
 
 String Frame::searchForLabelsBeforeElement(const Vector<String>& labels, Element* element, size_t* resultDistance, bool* resultIsInCellAbove)
 {
-    OwnPtr<JSC::Yarr::RegularExpression> regExp(createRegExpForLabels(labels));
+    JSC::Yarr::RegularExpression regExp = createRegExpForLabels(labels);
     // We stop searching after we've seen this many chars
     const unsigned int charsSearchedThreshold = 500;
     // This is the absolute max we search.  We allow a little more slop than
@@ -402,7 +401,7 @@ String Frame::searchForLabelsBeforeElement(const Vector<String>& labels, Element
         if (n->hasTagName(tdTag) && !startingTableCell) {
             startingTableCell = toHTMLTableCellElement(n);
         } else if (n->hasTagName(trTag) && startingTableCell) {
-            String result = searchForLabelsAboveCell(regExp.get(), startingTableCell, resultDistance);
+            String result = searchForLabelsAboveCell(regExp, startingTableCell, resultDistance);
             if (!result.isEmpty()) {
                 if (resultIsInCellAbove)
                     *resultIsInCellAbove = true;
@@ -415,11 +414,11 @@ String Frame::searchForLabelsBeforeElement(const Vector<String>& labels, Element
             // add 100 for slop, to make it more likely that we'll search whole nodes
             if (lengthSearched + nodeString.length() > maxCharsSearched)
                 nodeString = nodeString.right(charsSearchedThreshold - lengthSearched);
-            int pos = regExp->searchRev(nodeString);
+            int pos = regExp.searchRev(nodeString);
             if (pos >= 0) {
                 if (resultDistance)
                     *resultDistance = lengthSearched;
-                return nodeString.substring(pos, regExp->matchedLength());
+                return nodeString.substring(pos, regExp.matchedLength());
             }
             lengthSearched += nodeString.length();
         }
@@ -428,7 +427,7 @@ String Frame::searchForLabelsBeforeElement(const Vector<String>& labels, Element
     // If we started in a cell, but bailed because we found the start of the form or the
     // previous element, we still might need to search the row above us for a label.
     if (startingTableCell && !searchedCellAbove) {
-         String result = searchForLabelsAboveCell(regExp.get(), startingTableCell, resultDistance);
+        String result = searchForLabelsAboveCell(regExp, startingTableCell, resultDistance);
         if (!result.isEmpty()) {
             if (resultIsInCellAbove)
                 *resultIsInCellAbove = true;
@@ -449,7 +448,7 @@ static String matchLabelsAgainstString(const Vector<String>& labels, const Strin
     replace(mutableStringToMatch, JSC::Yarr::RegularExpression("\\d", TextCaseSensitive), " ");
     mutableStringToMatch.replace('_', ' ');
     
-    OwnPtr<JSC::Yarr::RegularExpression> regExp(createRegExpForLabels(labels));
+    JSC::Yarr::RegularExpression regExp = createRegExpForLabels(labels);
     // Use the largest match we can find in the whole string
     int pos;
     int length;
@@ -457,9 +456,9 @@ static String matchLabelsAgainstString(const Vector<String>& labels, const Strin
     int bestLength = -1;
     int start = 0;
     do {
-        pos = regExp->match(mutableStringToMatch, start);
+        pos = regExp.match(mutableStringToMatch, start);
         if (pos != -1) {
-            length = regExp->matchedLength();
+            length = regExp.matchedLength();
             if (length >= bestLength) {
                 bestPos = pos;
                 bestLength = length;
@@ -946,12 +945,12 @@ void Frame::createView(const IntSize& viewportSize, const Color& backgroundColor
 void Frame::setTiledBackingStoreEnabled(bool enabled)
 {
     if (!enabled) {
-        m_tiledBackingStore.clear();
+        m_tiledBackingStore = nullptr;
         return;
     }
     if (m_tiledBackingStore)
         return;
-    m_tiledBackingStore = adoptPtr(new TiledBackingStore(this));
+    m_tiledBackingStore = std::make_unique<TiledBackingStore>(this);
     m_tiledBackingStore->setCommitTileUpdatesOnIdleEventLoop(true);
     if (m_view)
         m_view->setPaintsEntireContents(true);
index c4380a7..93e75d1 100644 (file)
@@ -35,6 +35,7 @@
 #include "NavigationScheduler.h"
 #include "ScrollTypes.h"
 #include "UserScriptTypes.h"
+#include <memory>
 #include <wtf/RefCounted.h>
 
 #if PLATFORM(IOS)
@@ -235,7 +236,7 @@ namespace WebCore {
         Document* documentAtPoint(const IntPoint& windowPoint);
         PassRefPtr<Range> rangeForPoint(const IntPoint& framePoint);
 
-        String searchForLabelsAboveCell(JSC::Yarr::RegularExpression*, HTMLTableCellElement*, size_t* resultDistanceFromStartOfCell);
+        String searchForLabelsAboveCell(const JSC::Yarr::RegularExpression&, HTMLTableCellElement*, size_t* resultDistanceFromStartOfCell);
         String searchForLabelsBeforeElement(const Vector<String>& labels, Element*, size_t* resultDistance, bool* resultIsInCellAbove);
         String matchLabelsAgainstElement(const Vector<String>& labels, Element*);
 
@@ -299,8 +300,8 @@ namespace WebCore {
 
         const std::unique_ptr<ScriptController> m_script;
         const std::unique_ptr<Editor> m_editor;
-        const OwnPtr<FrameSelection> m_selection;
-        const OwnPtr<EventHandler> m_eventHandler;
+        const std::unique_ptr<FrameSelection> m_selection;
+        const std::unique_ptr<EventHandler> m_eventHandler;
         const std::unique_ptr<AnimationController> m_animationController;
 
 #if PLATFORM(IOS)
@@ -351,7 +352,7 @@ namespace WebCore {
         virtual IntRect tiledBackingStoreVisibleRect() override final;
         virtual Color tiledBackingStoreBackgroundColor() const override final;
 
-        OwnPtr<TiledBackingStore> m_tiledBackingStore;
+        std::unique_ptr<TiledBackingStore> m_tiledBackingStore;
 #endif
 
         int m_activeDOMObjectsAndAnimationsSuspendedCount;
index 0bbadc3..4ecba8a 100644 (file)
@@ -1382,7 +1382,7 @@ RenderBox* FrameView::embeddedContentBox() const
 void FrameView::addEmbeddedObjectToUpdate(RenderEmbeddedObject& embeddedObject)
 {
     if (!m_embeddedObjectsToUpdate)
-        m_embeddedObjectsToUpdate = adoptPtr(new ListHashSet<RenderEmbeddedObject*>);
+        m_embeddedObjectsToUpdate = std::make_unique<ListHashSet<RenderEmbeddedObject*>>();
 
     HTMLFrameOwnerElement& element = embeddedObject.frameOwnerElement();
     if (isHTMLObjectElement(element) || isHTMLEmbedElement(element)) {
@@ -1489,7 +1489,7 @@ void FrameView::addSlowRepaintObject(RenderElement* o)
     bool hadSlowRepaintObjects = hasSlowRepaintObjects();
 
     if (!m_slowRepaintObjects)
-        m_slowRepaintObjects = adoptPtr(new HashSet<RenderElement*>);
+        m_slowRepaintObjects = std::make_unique<HashSet<RenderElement*>>();
 
     m_slowRepaintObjects->add(o);
 
@@ -1523,7 +1523,7 @@ void FrameView::removeSlowRepaintObject(RenderElement* o)
 void FrameView::addViewportConstrainedObject(RenderElement* object)
 {
     if (!m_viewportConstrainedObjects)
-        m_viewportConstrainedObjects = adoptPtr(new ViewportConstrainedObjectSet);
+        m_viewportConstrainedObjects = std::make_unique<ViewportConstrainedObjectSet>();
 
     if (!m_viewportConstrainedObjects->contains(object)) {
         m_viewportConstrainedObjects->add(object);
@@ -3989,7 +3989,7 @@ String FrameView::trackedRepaintRectsAsText() const
 bool FrameView::addScrollableArea(ScrollableArea* scrollableArea)
 {
     if (!m_scrollableAreas)
-        m_scrollableAreas = adoptPtr(new ScrollableAreaSet);
+        m_scrollableAreas = std::make_unique<ScrollableAreaSet>();
     return m_scrollableAreas->add(scrollableArea).isNewEntry;
 }
 
index 96e905f..e0a54e0 100644 (file)
@@ -33,9 +33,9 @@
 #include "PaintPhase.h"
 #include "RenderPtr.h"
 #include "ScrollView.h"
+#include <memory>
 #include <wtf/Forward.h>
 #include <wtf/ListHashSet.h>
-#include <wtf/OwnPtr.h>
 #include <wtf/text/WTFString.h>
 
 namespace WebCore {
@@ -602,10 +602,10 @@ private:
     LayoutSize m_size;
     LayoutSize m_margins;
 
-    OwnPtr<ListHashSet<RenderEmbeddedObject*>> m_embeddedObjectsToUpdate;
+    std::unique_ptr<ListHashSet<RenderEmbeddedObject*>> m_embeddedObjectsToUpdate;
     const RefPtr<Frame> m_frame;
 
-    OwnPtr<HashSet<RenderElement*>> m_slowRepaintObjects;
+    std::unique_ptr<HashSet<RenderElement*>> m_slowRepaintObjects;
 
     bool m_needsFullRepaint;
     
@@ -697,8 +697,8 @@ private:
     // The intrinsic content size decided by autosizing.
     IntSize m_autoSizeContentSize;
 
-    OwnPtr<ScrollableAreaSet> m_scrollableAreas;
-    OwnPtr<ViewportConstrainedObjectSet> m_viewportConstrainedObjects;
+    std::unique_ptr<ScrollableAreaSet> m_scrollableAreas;
+    std::unique_ptr<ViewportConstrainedObjectSet> m_viewportConstrainedObjects;
 
     int m_headerHeight;
     int m_footerHeight;
index 963d93d..ea059c2 100644 (file)
@@ -35,6 +35,7 @@
 #include "Supplementable.h"
 #include "ViewState.h"
 #include "ViewportArguments.h"
+#include <memory>
 #include <wtf/Forward.h>
 #include <wtf/HashMap.h>
 #include <wtf/HashSet.h>
@@ -257,7 +258,7 @@ public:
     void removeSchedulePair(PassRefPtr<SchedulePair>);
     SchedulePairHashSet* scheduledRunLoopPairs() { return m_scheduledRunLoopPairs.get(); }
 
-    OwnPtr<SchedulePairHashSet> m_scheduledRunLoopPairs;
+    std::unique_ptr<SchedulePairHashSet> m_scheduledRunLoopPairs;
 #endif
 
     const VisibleSelection& selection() const;
index 16338fc..27bfb0f 100644 (file)
@@ -31,8 +31,6 @@
 #include "UserActivity.h"
 #include "ViewState.h"
 #include <wtf/HashSet.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
 #include <wtf/WeakPtr.h>
 
 namespace WebCore {
index d220e7e..70d69a0 100644 (file)
@@ -33,8 +33,7 @@
 #include <wtf/MainThread.h>
 #include "OriginAccessEntry.h"
 #include "SecurityOrigin.h"
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
+#include <memory>
 #include <wtf/text/StringHash.h>
 
 namespace WebCore {
@@ -42,7 +41,7 @@ namespace WebCore {
 static SecurityPolicy::LocalLoadPolicy localLoadPolicy = SecurityPolicy::AllowLocalLoadsForLocalOnly;
 
 typedef Vector<OriginAccessEntry> OriginAccessWhiteList;
-typedef HashMap<String, OwnPtr<OriginAccessWhiteList>> OriginAccessMap;
+typedef HashMap<String, std::unique_ptr<OriginAccessWhiteList>> OriginAccessMap;
 
 static OriginAccessMap& originAccessMap()
 {
@@ -136,7 +135,7 @@ void SecurityPolicy::addOriginAccessWhitelistEntry(const SecurityOrigin& sourceO
     String sourceString = sourceOrigin.toString();
     OriginAccessMap::AddResult result = originAccessMap().add(sourceString, nullptr);
     if (result.isNewEntry)
-        result.iterator->value = adoptPtr(new OriginAccessWhiteList);
+        result.iterator->value = std::make_unique<OriginAccessWhiteList>();
 
     OriginAccessWhiteList* list = result.iterator->value.get();
     list->append(OriginAccessEntry(destinationProtocol, destinationDomain, allowDestinationSubdomains ? OriginAccessEntry::AllowSubdomains : OriginAccessEntry::DisallowSubdomains));
index 85669cf..be112b1 100644 (file)
@@ -32,7 +32,6 @@
 #include "AnimationBase.h"
 #include "CSSPropertyNames.h"
 #include <wtf/Forward.h>
-#include <wtf/OwnPtr.h>
 
 namespace WebCore {
 
index d8924f8..8aad1b2 100644 (file)
@@ -51,6 +51,7 @@
 #include "StylePropertyShorthand.h"
 #include "StyleResolver.h"
 #include <algorithm>
+#include <memory>
 #include <wtf/MathExtras.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/RefCounted.h>
@@ -765,15 +766,15 @@ public:
     PropertyWrapperVisitedAffectedColor(CSSPropertyID prop, Color (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&),
                                         Color (RenderStyle::*visitedGetter)() const, void (RenderStyle::*visitedSetter)(const Color&))
         : AnimationPropertyWrapperBase(prop)
-        , m_wrapper(adoptPtr(new PropertyWrapperColor(prop, getter, setter)))
-        , m_visitedWrapper(adoptPtr(new PropertyWrapperColor(prop, visitedGetter, visitedSetter)))
+        , m_wrapper(std::make_unique<PropertyWrapperColor>(prop, getter, setter))
+        , m_visitedWrapper(std::make_unique<PropertyWrapperColor>(prop, visitedGetter, visitedSetter))
     {
     }
     PropertyWrapperVisitedAffectedColor(CSSPropertyID prop, MaybeInvalidColorTag, Color (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&),
                                         Color (RenderStyle::*visitedGetter)() const, void (RenderStyle::*visitedSetter)(const Color&))
         : AnimationPropertyWrapperBase(prop)
-        , m_wrapper(adoptPtr(new PropertyWrapperMaybeInvalidColor(prop, getter, setter)))
-        , m_visitedWrapper(adoptPtr(new PropertyWrapperMaybeInvalidColor(prop, visitedGetter, visitedSetter)))
+        , m_wrapper(std::make_unique<PropertyWrapperMaybeInvalidColor>(prop, getter, setter))
+        , m_visitedWrapper(std::make_unique<PropertyWrapperMaybeInvalidColor>(prop, visitedGetter, visitedSetter))
     {
     }
     virtual bool equals(const RenderStyle* a, const RenderStyle* b) const
@@ -787,8 +788,8 @@ public:
     }
 
 private:
-    OwnPtr<AnimationPropertyWrapperBase> m_wrapper;
-    OwnPtr<AnimationPropertyWrapperBase> m_visitedWrapper;
+    std::unique_ptr<AnimationPropertyWrapperBase> m_wrapper;
+    std::unique_ptr<AnimationPropertyWrapperBase> m_visitedWrapper;
 };
 
 // Wrapper base class for an animatable property in a FillLayer
@@ -1079,10 +1080,8 @@ public:
     static CSSPropertyAnimationWrapperMap& instance()
     {
         // FIXME: This data is never destroyed. Maybe we should ref count it and toss it when the last AnimationController is destroyed?
-        DEPRECATED_DEFINE_STATIC_LOCAL(OwnPtr<CSSPropertyAnimationWrapperMap>, map, ());
-        if (!map)
-            map = adoptPtr(new CSSPropertyAnimationWrapperMap);
-        return *map;
+        static NeverDestroyed<CSSPropertyAnimationWrapperMap> map;
+        return map;
     }
 
     AnimationPropertyWrapperBase* wrapperForProperty(CSSPropertyID propertyID)
@@ -1115,10 +1114,12 @@ private:
         return m_propertyToIdMap[propertyID - firstCSSProperty];
     }
 
-    Vector<OwnPtr<AnimationPropertyWrapperBase>> m_propertyWrappers;
+    Vector<std::unique_ptr<AnimationPropertyWrapperBase>> m_propertyWrappers;
     unsigned char m_propertyToIdMap[numCSSProperties];
 
     static const unsigned char cInvalidPropertyWrapperIndex = UCHAR_MAX;
+
+    friend class WTF::NeverDestroyed<CSSPropertyAnimationWrapperMap>;
 };
 
 CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap()
@@ -1313,7 +1314,7 @@ CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap()
 
     for (unsigned i = 0; i < animatableLonghandPropertiesCount; ++i) {
         AnimationPropertyWrapperBase* wrapper = animatableLonghandPropertyWrappers[i];
-        m_propertyWrappers.uncheckedAppend(adoptPtr(wrapper));
+        m_propertyWrappers.uncheckedAppend(std::unique_ptr<AnimationPropertyWrapperBase>(wrapper));
         indexFromPropertyID(wrapper->property()) = i;
     }
 
@@ -1334,7 +1335,7 @@ CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap()
             longhandWrappers.uncheckedAppend(m_propertyWrappers[wrapperIndex].get());
         }
 
-        m_propertyWrappers.uncheckedAppend(adoptPtr(new ShorthandPropertyWrapper(propertyID, longhandWrappers)));
+        m_propertyWrappers.uncheckedAppend(std::make_unique<ShorthandPropertyWrapper>(propertyID, longhandWrappers));
         indexFromPropertyID(propertyID) = animatableLonghandPropertiesCount + i;
     }
 }
index abf538e..a2f548c 100644 (file)
@@ -41,7 +41,7 @@ void Page::addSchedulePair(PassRefPtr<SchedulePair> prpPair)
     RefPtr<SchedulePair> pair = prpPair;
 
     if (!m_scheduledRunLoopPairs)
-        m_scheduledRunLoopPairs = adoptPtr(new SchedulePairHashSet);
+        m_scheduledRunLoopPairs = std::make_unique<SchedulePairHashSet>();
     m_scheduledRunLoopPairs->add(pair);
 
 #if !PLATFORM(IOS)
index b6639bc..4171c2f 100644 (file)
@@ -109,7 +109,7 @@ WorkerGlobalScope::~WorkerGlobalScope()
 
 void WorkerGlobalScope::applyContentSecurityPolicyFromString(const String& policy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType)
 {
-    setContentSecurityPolicy(ContentSecurityPolicy::create(this));
+    setContentSecurityPolicy(std::make_unique<ContentSecurityPolicy>(this));
     contentSecurityPolicy()->didReceiveHeader(policy, contentSecurityPolicyType);
 }
 
index bab1433..3811b96 100644 (file)
@@ -1,3 +1,13 @@
+2014-04-21  Zan Dobersek  <zdobersek@igalia.com>
+
+        Move cross-port Source/WebCore/page/ code to std::unique_ptr
+        https://bugs.webkit.org/show_bug.cgi?id=130534
+
+        Reviewed by Darin Adler.
+
+        * WebView/WebHTMLRepresentation.mm:
+        (searchForLabelsBeforeElement): Pass a RegExp reference to Frame::searchForLabelsAboveCell().
+
 2014-04-19  Darin Adler  <darin@apple.com>
 
         [Mac] WebView adjusts the cursor even when another window is in front
index 7b4dbe6..fc3a81c 100644 (file)
@@ -456,7 +456,7 @@ static NSString* searchForLabelsBeforeElement(Frame* frame, NSArray* labels, Ele
         } else if (n->hasTagName(tdTag) && !startingTableCell) {
             startingTableCell = static_cast<HTMLTableCellElement*>(n);
         } else if (n->hasTagName(trTag) && startingTableCell) {
-            NSString* result = frame->searchForLabelsAboveCell(regExp, startingTableCell, resultDistance);
+            NSString* result = frame->searchForLabelsAboveCell(*regExp, startingTableCell, resultDistance);
             if (result && [result length] > 0) {
                 if (resultIsInCellAbove)
                     *resultIsInCellAbove = true;
@@ -482,7 +482,7 @@ static NSString* searchForLabelsBeforeElement(Frame* frame, NSArray* labels, Ele
     // If we started in a cell, but bailed because we found the start of the form or the
     // previous element, we still might need to search the row above us for a label.
     if (startingTableCell && !searchedCellAbove) {
-        NSString* result = frame->searchForLabelsAboveCell(regExp, startingTableCell, resultDistance);
+        NSString* result = frame->searchForLabelsAboveCell(*regExp, startingTableCell, resultDistance);
         if (result && [result length] > 0) {
             if (resultIsInCellAbove)
                 *resultIsInCellAbove = true;