Title: [168578] trunk/Source/WebCore
Revision
168578
Author
[email protected]
Date
2014-05-10 12:14:21 -0700 (Sat, 10 May 2014)

Log Message

Move Source/WebCore/workers/ code to std::unique_ptr
https://bugs.webkit.org/show_bug.cgi?id=132401

Reviewed by Andreas Kling.

Replace uses of OwnPtr and PassOwnPtr in code under Source/WebCore/workers (and related places)
with std::unique_ptr.

* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::JSDOMWindow::setTimeout):
(WebCore::JSDOMWindow::setInterval):
* bindings/js/JSWorkerGlobalScopeCustom.cpp:
(WebCore::JSWorkerGlobalScope::setTimeout):
(WebCore::JSWorkerGlobalScope::setInterval):
* bindings/js/ScheduledAction.cpp:
(WebCore::ScheduledAction::create):
* bindings/js/ScheduledAction.h:
* page/DOMTimer.cpp:
(WebCore::DOMTimer::DOMTimer):
(WebCore::DOMTimer::install):
(WebCore::DOMTimer::fired):
(WebCore::DOMTimer::didStop):
* page/DOMTimer.h:
* page/DOMWindow.cpp:
(WebCore::DOMWindow::setTimeout):
(WebCore::DOMWindow::setInterval):
* page/DOMWindow.h:
* workers/WorkerEventQueue.h:
* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::WorkerGlobalScope):
(WebCore::WorkerGlobalScope::setTimeout):
(WebCore::WorkerGlobalScope::setInterval):
* workers/WorkerGlobalScope.h:
(WebCore::WorkerGlobalScope::clearScript):
* workers/WorkerLoaderProxy.h:
* workers/WorkerMessagingProxy.h:
* workers/WorkerRunLoop.cpp:
(WebCore::WorkerRunLoop::WorkerRunLoop):
* workers/WorkerRunLoop.h:
* workers/WorkerScriptLoader.cpp:
(WebCore::WorkerScriptLoader::loadSynchronously):
(WebCore::WorkerScriptLoader::loadAsynchronously):
(WebCore::WorkerScriptLoader::createResourceRequest):
* workers/WorkerScriptLoader.h:
* workers/WorkerThread.cpp:
(WebCore::WorkerThread::WorkerThread):
(WebCore::WorkerThread::workerThread):
(WebCore::WorkerThreadStartupData::create): Deleted.
* workers/WorkerThread.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (168577 => 168578)


--- trunk/Source/WebCore/ChangeLog	2014-05-10 09:30:02 UTC (rev 168577)
+++ trunk/Source/WebCore/ChangeLog	2014-05-10 19:14:21 UTC (rev 168578)
@@ -1,3 +1,55 @@
+2014-05-10  Zan Dobersek  <[email protected]>
+
+        Move Source/WebCore/workers/ code to std::unique_ptr
+        https://bugs.webkit.org/show_bug.cgi?id=132401
+
+        Reviewed by Andreas Kling.
+
+        Replace uses of OwnPtr and PassOwnPtr in code under Source/WebCore/workers (and related places)
+        with std::unique_ptr.
+
+        * bindings/js/JSDOMWindowCustom.cpp:
+        (WebCore::JSDOMWindow::setTimeout):
+        (WebCore::JSDOMWindow::setInterval):
+        * bindings/js/JSWorkerGlobalScopeCustom.cpp:
+        (WebCore::JSWorkerGlobalScope::setTimeout):
+        (WebCore::JSWorkerGlobalScope::setInterval):
+        * bindings/js/ScheduledAction.cpp:
+        (WebCore::ScheduledAction::create):
+        * bindings/js/ScheduledAction.h:
+        * page/DOMTimer.cpp:
+        (WebCore::DOMTimer::DOMTimer):
+        (WebCore::DOMTimer::install):
+        (WebCore::DOMTimer::fired):
+        (WebCore::DOMTimer::didStop):
+        * page/DOMTimer.h:
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::setTimeout):
+        (WebCore::DOMWindow::setInterval):
+        * page/DOMWindow.h:
+        * workers/WorkerEventQueue.h:
+        * workers/WorkerGlobalScope.cpp:
+        (WebCore::WorkerGlobalScope::WorkerGlobalScope):
+        (WebCore::WorkerGlobalScope::setTimeout):
+        (WebCore::WorkerGlobalScope::setInterval):
+        * workers/WorkerGlobalScope.h:
+        (WebCore::WorkerGlobalScope::clearScript):
+        * workers/WorkerLoaderProxy.h:
+        * workers/WorkerMessagingProxy.h:
+        * workers/WorkerRunLoop.cpp:
+        (WebCore::WorkerRunLoop::WorkerRunLoop):
+        * workers/WorkerRunLoop.h:
+        * workers/WorkerScriptLoader.cpp:
+        (WebCore::WorkerScriptLoader::loadSynchronously):
+        (WebCore::WorkerScriptLoader::loadAsynchronously):
+        (WebCore::WorkerScriptLoader::createResourceRequest):
+        * workers/WorkerScriptLoader.h:
+        * workers/WorkerThread.cpp:
+        (WebCore::WorkerThread::WorkerThread):
+        (WebCore::WorkerThread::workerThread):
+        (WebCore::WorkerThreadStartupData::create): Deleted.
+        * workers/WorkerThread.h:
+
 2014-05-09  Dean Jackson  <[email protected]>
 
         -webkit-filter prevents rendering at retina scale

Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp (168577 => 168578)


--- trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp	2014-05-10 09:30:02 UTC (rev 168577)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp	2014-05-10 19:14:21 UTC (rev 168578)
@@ -594,7 +594,7 @@
 JSValue JSDOMWindow::setTimeout(ExecState* exec)
 {
     ContentSecurityPolicy* contentSecurityPolicy = impl().document() ? impl().document()->contentSecurityPolicy() : 0;
-    OwnPtr<ScheduledAction> action = "" globalObject()->world(), contentSecurityPolicy);
+    std::unique_ptr<ScheduledAction> action = "" globalObject()->world(), contentSecurityPolicy);
     if (exec->hadException())
         return jsUndefined();
 
@@ -604,7 +604,7 @@
     int delay = exec->argument(1).toInt32(exec);
 
     ExceptionCode ec = 0;
-    int result = impl().setTimeout(action.release(), delay, ec);
+    int result = impl().setTimeout(std::move(action), delay, ec);
     setDOMException(exec, ec);
 
     return jsNumber(result);
@@ -613,7 +613,7 @@
 JSValue JSDOMWindow::setInterval(ExecState* exec)
 {
     ContentSecurityPolicy* contentSecurityPolicy = impl().document() ? impl().document()->contentSecurityPolicy() : 0;
-    OwnPtr<ScheduledAction> action = "" globalObject()->world(), contentSecurityPolicy);
+    std::unique_ptr<ScheduledAction> action = "" globalObject()->world(), contentSecurityPolicy);
     if (exec->hadException())
         return jsUndefined();
     int delay = exec->argument(1).toInt32(exec);
@@ -622,7 +622,7 @@
         return jsNumber(0);
 
     ExceptionCode ec = 0;
-    int result = impl().setInterval(action.release(), delay, ec);
+    int result = impl().setInterval(std::move(action), delay, ec);
     setDOMException(exec, ec);
 
     return jsNumber(result);

Modified: trunk/Source/WebCore/bindings/js/JSWorkerGlobalScopeCustom.cpp (168577 => 168578)


--- trunk/Source/WebCore/bindings/js/JSWorkerGlobalScopeCustom.cpp	2014-05-10 09:30:02 UTC (rev 168577)
+++ trunk/Source/WebCore/bindings/js/JSWorkerGlobalScopeCustom.cpp	2014-05-10 19:14:21 UTC (rev 168578)
@@ -87,24 +87,24 @@
 
 JSValue JSWorkerGlobalScope::setTimeout(ExecState* exec)
 {
-    OwnPtr<ScheduledAction> action = "" globalObject()->world(), impl().contentSecurityPolicy());
+    std::unique_ptr<ScheduledAction> action = "" globalObject()->world(), impl().contentSecurityPolicy());
     if (exec->hadException())
         return jsUndefined();
     if (!action)
         return jsNumber(0);
     int delay = exec->argument(1).toInt32(exec);
-    return jsNumber(impl().setTimeout(action.release(), delay));
+    return jsNumber(impl().setTimeout(std::move(action), delay));
 }
 
 JSValue JSWorkerGlobalScope::setInterval(ExecState* exec)
 {
-    OwnPtr<ScheduledAction> action = "" globalObject()->world(), impl().contentSecurityPolicy());
+    std::unique_ptr<ScheduledAction> action = "" globalObject()->world(), impl().contentSecurityPolicy());
     if (exec->hadException())
         return jsUndefined();
     if (!action)
         return jsNumber(0);
     int delay = exec->argument(1).toInt32(exec);
-    return jsNumber(impl().setInterval(action.release(), delay));
+    return jsNumber(impl().setInterval(std::move(action), delay));
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/bindings/js/ScheduledAction.cpp (168577 => 168578)


--- trunk/Source/WebCore/bindings/js/ScheduledAction.cpp	2014-05-10 09:30:02 UTC (rev 168577)
+++ trunk/Source/WebCore/bindings/js/ScheduledAction.cpp	2014-05-10 19:14:21 UTC (rev 168578)
@@ -46,7 +46,7 @@
 
 namespace WebCore {
 
-PassOwnPtr<ScheduledAction> ScheduledAction::create(ExecState* exec, DOMWrapperWorld& isolatedWorld, ContentSecurityPolicy* policy)
+std::unique_ptr<ScheduledAction> ScheduledAction::create(ExecState* exec, DOMWrapperWorld& isolatedWorld, ContentSecurityPolicy* policy)
 {
     JSValue v = exec->argument(0);
     CallData callData;
@@ -56,10 +56,10 @@
         String string = v.toString(exec)->value(exec);
         if (exec->hadException())
             return nullptr;
-        return adoptPtr(new ScheduledAction(string, isolatedWorld));
+        return std::unique_ptr<ScheduledAction>(new ScheduledAction(string, isolatedWorld));
     }
 
-    return adoptPtr(new ScheduledAction(exec, v, isolatedWorld));
+    return std::unique_ptr<ScheduledAction>(new ScheduledAction(exec, v, isolatedWorld));
 }
 
 ScheduledAction::ScheduledAction(ExecState* exec, JSValue function, DOMWrapperWorld& isolatedWorld)

Modified: trunk/Source/WebCore/bindings/js/ScheduledAction.h (168577 => 168578)


--- trunk/Source/WebCore/bindings/js/ScheduledAction.h	2014-05-10 09:30:02 UTC (rev 168577)
+++ trunk/Source/WebCore/bindings/js/ScheduledAction.h	2014-05-10 19:14:21 UTC (rev 168578)
@@ -23,8 +23,8 @@
 #include "JSDOMBinding.h"
 #include <heap/Strong.h>
 #include <heap/StrongInlines.h>
+#include <memory>
 #include <runtime/JSCell.h>
-#include <wtf/PassOwnPtr.h>
 #include <wtf/Vector.h>
 #include <wtf/text/WTFString.h>
 
@@ -46,7 +46,7 @@
     class ScheduledAction {
         WTF_MAKE_NONCOPYABLE(ScheduledAction); WTF_MAKE_FAST_ALLOCATED;
     public:
-        static PassOwnPtr<ScheduledAction> create(JSC::ExecState*, DOMWrapperWorld& isolatedWorld, ContentSecurityPolicy*);
+        static std::unique_ptr<ScheduledAction> create(JSC::ExecState*, DOMWrapperWorld& isolatedWorld, ContentSecurityPolicy*);
 
         void execute(ScriptExecutionContext*);
 

Modified: trunk/Source/WebCore/page/DOMTimer.cpp (168577 => 168578)


--- trunk/Source/WebCore/page/DOMTimer.cpp	2014-05-10 09:30:02 UTC (rev 168577)
+++ trunk/Source/WebCore/page/DOMTimer.cpp	2014-05-10 19:14:21 UTC (rev 168578)
@@ -58,10 +58,10 @@
         && nestingLevel == 1; // Gestures should not be forwarded to nested timers.
 }
 
-DOMTimer::DOMTimer(ScriptExecutionContext* context, PassOwnPtr<ScheduledAction> action, int interval, bool singleShot)
+DOMTimer::DOMTimer(ScriptExecutionContext* context, std::unique_ptr<ScheduledAction> action, int interval, bool singleShot)
     : SuspendableTimer(context)
     , m_nestingLevel(timerNestingLevel + 1)
-    , m_action(action)
+    , m_action(std::move(action))
     , m_originalInterval(interval)
     , m_shouldForwardUserGesture(shouldForwardUserGesture(interval, m_nestingLevel))
 {
@@ -83,12 +83,12 @@
         scriptExecutionContext()->removeTimeout(m_timeoutId);
 }
 
-int DOMTimer::install(ScriptExecutionContext* context, PassOwnPtr<ScheduledAction> action, int timeout, bool singleShot)
+int DOMTimer::install(ScriptExecutionContext* context, std::unique_ptr<ScheduledAction> action, int timeout, bool singleShot)
 {
     // DOMTimer constructor links the new timer into a list of ActiveDOMObjects held by the 'context'.
     // The timer is deleted when context is deleted (DOMTimer::contextDestroyed) or explicitly via DOMTimer::removeById(),
     // or if it is a one-time timer and it has fired (DOMTimer::fired).
-    DOMTimer* timer = new DOMTimer(context, action, timeout, singleShot);
+    DOMTimer* timer = new DOMTimer(context, std::move(action), timeout, singleShot);
 #if PLATFORM(IOS)
     if (context->isDocument()) {
         Document& document = toDocument(*context);
@@ -157,7 +157,7 @@
     }
 
     // Delete timer before executing the action for one-shot timers.
-    OwnPtr<ScheduledAction> action = ""
+    ScheduledAction* action = ""
 
     // No access to member variables after this point.
     delete this;
@@ -207,7 +207,7 @@
     // Need to release JS objects potentially protected by ScheduledAction
     // because they can form circular references back to the ScriptExecutionContext
     // which will cause a memory leak.
-    m_action.clear();
+    m_action = nullptr;
 }
 
 void DOMTimer::adjustMinimumTimerInterval(double oldMinimumTimerInterval)

Modified: trunk/Source/WebCore/page/DOMTimer.h (168577 => 168578)


--- trunk/Source/WebCore/page/DOMTimer.h	2014-05-10 09:30:02 UTC (rev 168577)
+++ trunk/Source/WebCore/page/DOMTimer.h	2014-05-10 19:14:21 UTC (rev 168578)
@@ -28,8 +28,7 @@
 #define DOMTimer_h
 
 #include "SuspendableTimer.h"
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
+#include <memory>
 
 namespace WebCore {
 
@@ -40,7 +39,7 @@
         virtual ~DOMTimer();
         // Creates a new timer owned by specified ScriptExecutionContext, starts it
         // and returns its Id.
-        static int install(ScriptExecutionContext*, PassOwnPtr<ScheduledAction>, int timeout, bool singleShot);
+        static int install(ScriptExecutionContext*, std::unique_ptr<ScheduledAction>, int timeout, bool singleShot);
         static void removeById(ScriptExecutionContext*, int timeoutId);
 
         // Adjust to a change in the ScriptExecutionContext's minimum timer interval.
@@ -49,7 +48,7 @@
         void adjustMinimumTimerInterval(double oldMinimumTimerInterval);
 
     private:
-        DOMTimer(ScriptExecutionContext*, PassOwnPtr<ScheduledAction>, int interval, bool singleShot);
+        DOMTimer(ScriptExecutionContext*, std::unique_ptr<ScheduledAction>, int interval, bool singleShot);
         virtual void fired() override;
 
         // ActiveDOMObject
@@ -65,7 +64,7 @@
 
         int m_timeoutId;
         int m_nestingLevel;
-        OwnPtr<ScheduledAction> m_action;
+        std::unique_ptr<ScheduledAction> m_action;
         int m_originalInterval;
         bool m_shouldForwardUserGesture;
     };

Modified: trunk/Source/WebCore/page/DOMWindow.cpp (168577 => 168578)


--- trunk/Source/WebCore/page/DOMWindow.cpp	2014-05-10 09:30:02 UTC (rev 168577)
+++ trunk/Source/WebCore/page/DOMWindow.cpp	2014-05-10 19:14:21 UTC (rev 168578)
@@ -1513,14 +1513,14 @@
     page->chrome().setWindowRect(adjustWindowRect(page, update));
 }
 
-int DOMWindow::setTimeout(PassOwnPtr<ScheduledAction> action, int timeout, ExceptionCode& ec)
+int DOMWindow::setTimeout(std::unique_ptr<ScheduledAction> action, int timeout, ExceptionCode& ec)
 {
     ScriptExecutionContext* context = scriptExecutionContext();
     if (!context) {
         ec = INVALID_ACCESS_ERR;
         return -1;
     }
-    return DOMTimer::install(context, action, timeout, true);
+    return DOMTimer::install(context, std::move(action), timeout, true);
 }
 
 void DOMWindow::clearTimeout(int timeoutId)
@@ -1547,14 +1547,14 @@
     DOMTimer::removeById(context, timeoutId);
 }
 
-int DOMWindow::setInterval(PassOwnPtr<ScheduledAction> action, int timeout, ExceptionCode& ec)
+int DOMWindow::setInterval(std::unique_ptr<ScheduledAction> action, int timeout, ExceptionCode& ec)
 {
     ScriptExecutionContext* context = scriptExecutionContext();
     if (!context) {
         ec = INVALID_ACCESS_ERR;
         return -1;
     }
-    return DOMTimer::install(context, action, timeout, false);
+    return DOMTimer::install(context, std::move(action), timeout, false);
 }
 
 void DOMWindow::clearInterval(int timeoutId)

Modified: trunk/Source/WebCore/page/DOMWindow.h (168577 => 168578)


--- trunk/Source/WebCore/page/DOMWindow.h	2014-05-10 09:30:02 UTC (rev 168577)
+++ trunk/Source/WebCore/page/DOMWindow.h	2014-05-10 19:14:21 UTC (rev 168578)
@@ -33,6 +33,7 @@
 #include "URL.h"
 #include "Supplementable.h"
 #include <functional>
+#include <memory>
 
 namespace Inspector {
 class ScriptCallStack;
@@ -253,9 +254,9 @@
         void resizeTo(float width, float height) const;
 
         // Timers
-        int setTimeout(PassOwnPtr<ScheduledAction>, int timeout, ExceptionCode&);
+        int setTimeout(std::unique_ptr<ScheduledAction>, int timeout, ExceptionCode&);
         void clearTimeout(int timeoutId);
-        int setInterval(PassOwnPtr<ScheduledAction>, int timeout, ExceptionCode&);
+        int setInterval(std::unique_ptr<ScheduledAction>, int timeout, ExceptionCode&);
         void clearInterval(int timeoutId);
 
         // WebKit animation extensions

Modified: trunk/Source/WebCore/workers/WorkerEventQueue.h (168577 => 168578)


--- trunk/Source/WebCore/workers/WorkerEventQueue.h	2014-05-10 09:30:02 UTC (rev 168577)
+++ trunk/Source/WebCore/workers/WorkerEventQueue.h	2014-05-10 19:14:21 UTC (rev 168578)
@@ -29,7 +29,6 @@
 
 #include "EventQueue.h"
 #include <wtf/HashMap.h>
-#include <wtf/PassOwnPtr.h>
 
 namespace WebCore {
 

Modified: trunk/Source/WebCore/workers/WorkerGlobalScope.cpp (168577 => 168578)


--- trunk/Source/WebCore/workers/WorkerGlobalScope.cpp	2014-05-10 09:30:02 UTC (rev 168577)
+++ trunk/Source/WebCore/workers/WorkerGlobalScope.cpp	2014-05-10 19:14:21 UTC (rev 168578)
@@ -67,7 +67,7 @@
     : m_url(url)
     , m_userAgent(userAgent)
     , m_groupSettings(std::move(settings))
-    , m_script(adoptPtr(new WorkerScriptController(this)))
+    , m_script(std::make_unique<WorkerScriptController>(this))
     , m_thread(thread)
 #if ENABLE(INSPECTOR)
     , m_workerInspectorController(std::make_unique<WorkerInspectorController>(*this))
@@ -152,9 +152,9 @@
     thread().runLoop().postTask(std::move(task));
 }
 
-int WorkerGlobalScope::setTimeout(PassOwnPtr<ScheduledAction> action, int timeout)
+int WorkerGlobalScope::setTimeout(std::unique_ptr<ScheduledAction> action, int timeout)
 {
-    return DOMTimer::install(scriptExecutionContext(), action, timeout, true);
+    return DOMTimer::install(scriptExecutionContext(), std::move(action), timeout, true);
 }
 
 void WorkerGlobalScope::clearTimeout(int timeoutId)
@@ -162,9 +162,9 @@
     DOMTimer::removeById(scriptExecutionContext(), timeoutId);
 }
 
-int WorkerGlobalScope::setInterval(PassOwnPtr<ScheduledAction> action, int timeout)
+int WorkerGlobalScope::setInterval(std::unique_ptr<ScheduledAction> action, int timeout)
 {
-    return DOMTimer::install(scriptExecutionContext(), action, timeout, false);
+    return DOMTimer::install(scriptExecutionContext(), std::move(action), timeout, false);
 }
 
 void WorkerGlobalScope::clearInterval(int timeoutId)

Modified: trunk/Source/WebCore/workers/WorkerGlobalScope.h (168577 => 168578)


--- trunk/Source/WebCore/workers/WorkerGlobalScope.h	2014-05-10 09:30:02 UTC (rev 168577)
+++ trunk/Source/WebCore/workers/WorkerGlobalScope.h	2014-05-10 19:14:21 UTC (rev 168578)
@@ -35,9 +35,9 @@
 #include "ScriptExecutionContext.h"
 #include "WorkerEventQueue.h"
 #include "WorkerScriptController.h"
+#include <memory>
 #include <wtf/Assertions.h>
 #include <wtf/HashMap.h>
-#include <wtf/OwnPtr.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/RefPtr.h>
@@ -72,7 +72,7 @@
         virtual void disableEval(const String& errorMessage) override;
 
         WorkerScriptController* script() { return m_script.get(); }
-        void clearScript() { m_script.clear(); }
+        void clearScript() { m_script = nullptr; }
 
         WorkerThread& thread() const { return m_thread; }
 
@@ -94,9 +94,9 @@
         WorkerNavigator* navigator() const;
 
         // Timers
-        int setTimeout(PassOwnPtr<ScheduledAction>, int timeout);
+        int setTimeout(std::unique_ptr<ScheduledAction>, int timeout);
         void clearTimeout(int timeoutId);
-        int setInterval(PassOwnPtr<ScheduledAction>, int timeout);
+        int setInterval(std::unique_ptr<ScheduledAction>, int timeout);
         void clearInterval(int timeoutId);
 
         virtual bool isContextThread() const override;
@@ -167,7 +167,7 @@
         mutable RefPtr<WorkerLocation> m_location;
         mutable RefPtr<WorkerNavigator> m_navigator;
 
-        OwnPtr<WorkerScriptController> m_script;
+        std::unique_ptr<WorkerScriptController> m_script;
         WorkerThread& m_thread;
 
 #if ENABLE(INSPECTOR)

Modified: trunk/Source/WebCore/workers/WorkerLoaderProxy.h (168577 => 168578)


--- trunk/Source/WebCore/workers/WorkerLoaderProxy.h	2014-05-10 09:30:02 UTC (rev 168577)
+++ trunk/Source/WebCore/workers/WorkerLoaderProxy.h	2014-05-10 19:14:21 UTC (rev 168578)
@@ -33,7 +33,6 @@
 
 #include "ScriptExecutionContext.h"
 #include <wtf/Forward.h>
-#include <wtf/PassOwnPtr.h>
 
 namespace WebCore {
 

Modified: trunk/Source/WebCore/workers/WorkerMessagingProxy.h (168577 => 168578)


--- trunk/Source/WebCore/workers/WorkerMessagingProxy.h	2014-05-10 09:30:02 UTC (rev 168577)
+++ trunk/Source/WebCore/workers/WorkerMessagingProxy.h	2014-05-10 19:14:21 UTC (rev 168578)
@@ -34,7 +34,6 @@
 #include <memory>
 #include <wtf/Forward.h>
 #include <wtf/Noncopyable.h>
-#include <wtf/PassOwnPtr.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefPtr.h>
 #include <wtf/Vector.h>

Modified: trunk/Source/WebCore/workers/WorkerRunLoop.cpp (168577 => 168578)


--- trunk/Source/WebCore/workers/WorkerRunLoop.cpp	2014-05-10 09:30:02 UTC (rev 168577)
+++ trunk/Source/WebCore/workers/WorkerRunLoop.cpp	2014-05-10 19:14:21 UTC (rev 168578)
@@ -87,7 +87,7 @@
 };
 
 WorkerRunLoop::WorkerRunLoop()
-    : m_sharedTimer(adoptPtr(new WorkerSharedTimer))
+    : m_sharedTimer(std::make_unique<WorkerSharedTimer>())
     , m_nestedCount(0)
     , m_uniqueId(0)
 {

Modified: trunk/Source/WebCore/workers/WorkerRunLoop.h (168577 => 168578)


--- trunk/Source/WebCore/workers/WorkerRunLoop.h	2014-05-10 09:30:02 UTC (rev 168577)
+++ trunk/Source/WebCore/workers/WorkerRunLoop.h	2014-05-10 19:14:21 UTC (rev 168578)
@@ -32,9 +32,8 @@
 #define WorkerRunLoop_h
 
 #include "ScriptExecutionContext.h"
+#include <memory>
 #include <wtf/MessageQueue.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
 
 namespace WebCore {
 
@@ -90,7 +89,7 @@
         void runCleanupTasks(WorkerGlobalScope*);
 
         MessageQueue<Task> m_messageQueue;
-        OwnPtr<WorkerSharedTimer> m_sharedTimer;
+        std::unique_ptr<WorkerSharedTimer> m_sharedTimer;
         int m_nestedCount;
         unsigned long m_uniqueId;
     };

Modified: trunk/Source/WebCore/workers/WorkerScriptLoader.cpp (168577 => 168578)


--- trunk/Source/WebCore/workers/WorkerScriptLoader.cpp	2014-05-10 09:30:02 UTC (rev 168577)
+++ trunk/Source/WebCore/workers/WorkerScriptLoader.cpp	2014-05-10 19:14:21 UTC (rev 168578)
@@ -37,7 +37,6 @@
 #include "WorkerGlobalScope.h"
 #include "WorkerScriptLoaderClient.h"
 #include "WorkerThreadableLoader.h"
-#include <wtf/OwnPtr.h>
 #include <wtf/Ref.h>
 #include <wtf/RefPtr.h>
 
@@ -59,7 +58,7 @@
 {
     m_url = url;
 
-    OwnPtr<ResourceRequest> request(createResourceRequest());
+    std::unique_ptr<ResourceRequest> request(createResourceRequest());
     if (!request)
         return;
 
@@ -79,7 +78,7 @@
     m_client = client;
     m_url = url;
 
-    OwnPtr<ResourceRequest> request(createResourceRequest());
+    std::unique_ptr<ResourceRequest> request(createResourceRequest());
     if (!request)
         return;
 
@@ -99,11 +98,11 @@
     return m_responseURL;
 }
 
-PassOwnPtr<ResourceRequest> WorkerScriptLoader::createResourceRequest()
+std::unique_ptr<ResourceRequest> WorkerScriptLoader::createResourceRequest()
 {
-    OwnPtr<ResourceRequest> request = adoptPtr(new ResourceRequest(m_url));
+    auto request = std::make_unique<ResourceRequest>(m_url);
     request->setHTTPMethod("GET");
-    return request.release();
+    return std::move(request);
 }
     
 void WorkerScriptLoader::didReceiveResponse(unsigned long identifier, const ResourceResponse& response)

Modified: trunk/Source/WebCore/workers/WorkerScriptLoader.h (168577 => 168578)


--- trunk/Source/WebCore/workers/WorkerScriptLoader.h	2014-05-10 09:30:02 UTC (rev 168577)
+++ trunk/Source/WebCore/workers/WorkerScriptLoader.h	2014-05-10 19:14:21 UTC (rev 168578)
@@ -32,7 +32,7 @@
 #include "ResourceRequest.h"
 #include "ThreadableLoader.h"
 #include "ThreadableLoaderClient.h"
-
+#include <memory>
 #include <wtf/FastMalloc.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
@@ -77,7 +77,7 @@
         WorkerScriptLoader();
         ~WorkerScriptLoader();
 
-        PassOwnPtr<ResourceRequest> createResourceRequest();
+        std::unique_ptr<ResourceRequest> createResourceRequest();
         void notifyFinished();
 
         WorkerScriptLoaderClient* m_client;

Modified: trunk/Source/WebCore/workers/WorkerThread.cpp (168577 => 168578)


--- trunk/Source/WebCore/workers/WorkerThread.cpp	2014-05-10 09:30:02 UTC (rev 168577)
+++ trunk/Source/WebCore/workers/WorkerThread.cpp	2014-05-10 19:14:21 UTC (rev 168578)
@@ -79,10 +79,7 @@
 struct WorkerThreadStartupData {
     WTF_MAKE_NONCOPYABLE(WorkerThreadStartupData); WTF_MAKE_FAST_ALLOCATED;
 public:
-    static PassOwnPtr<WorkerThreadStartupData> create(const URL& scriptURL, const String& userAgent, const GroupSettings* settings, const String& sourceCode, WorkerThreadStartMode startMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType, const SecurityOrigin* topOrigin)
-    {
-        return adoptPtr(new WorkerThreadStartupData(scriptURL, userAgent, settings, sourceCode, startMode, contentSecurityPolicy, contentSecurityPolicyType, topOrigin));
-    }
+    WorkerThreadStartupData(const URL& scriptURL, const String& userAgent, const GroupSettings*, const String& sourceCode, WorkerThreadStartMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType, const SecurityOrigin* topOrigin);
 
     URL m_scriptURL;
     String m_userAgent;
@@ -92,8 +89,6 @@
     String m_contentSecurityPolicy;
     ContentSecurityPolicy::HeaderType m_contentSecurityPolicyType;
     RefPtr<SecurityOrigin> m_topOrigin;
-private:
-    WorkerThreadStartupData(const URL& scriptURL, const String& userAgent, const GroupSettings*, const String& sourceCode, WorkerThreadStartMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType, const SecurityOrigin* topOrigin);
 };
 
 WorkerThreadStartupData::WorkerThreadStartupData(const URL& scriptURL, const String& userAgent, const GroupSettings* settings, const String& sourceCode, WorkerThreadStartMode startMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType, const SecurityOrigin* topOrigin)
@@ -118,7 +113,7 @@
     : m_threadID(0)
     , m_workerLoaderProxy(workerLoaderProxy)
     , m_workerReportingProxy(workerReportingProxy)
-    , m_startupData(WorkerThreadStartupData::create(scriptURL, userAgent, settings, sourceCode, startMode, contentSecurityPolicy, contentSecurityPolicyType, topOrigin))
+    , m_startupData(std::make_unique<WorkerThreadStartupData>(scriptURL, userAgent, settings, sourceCode, startMode, contentSecurityPolicy, contentSecurityPolicyType, topOrigin))
 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
     , m_notificationClient(0)
 #endif
@@ -180,7 +175,7 @@
     // Free the startup data to cause its member variable deref's happen on the worker's thread (since
     // all ref/derefs of these objects are happening on the thread at this point). Note that
     // WorkerThread::~WorkerThread happens on a different thread where it was created.
-    m_startupData.clear();
+    m_startupData = nullptr;
 
     runEventLoop();
 

Modified: trunk/Source/WebCore/workers/WorkerThread.h (168577 => 168578)


--- trunk/Source/WebCore/workers/WorkerThread.h	2014-05-10 09:30:02 UTC (rev 168577)
+++ trunk/Source/WebCore/workers/WorkerThread.h	2014-05-10 19:14:21 UTC (rev 168578)
@@ -30,8 +30,8 @@
 #include "ContentSecurityPolicy.h"
 #include "GroupSettings.h"
 #include "WorkerRunLoop.h"
+#include <memory>
 #include <wtf/Forward.h>
-#include <wtf/OwnPtr.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 
@@ -92,7 +92,7 @@
         RefPtr<WorkerGlobalScope> m_workerGlobalScope;
         Mutex m_threadCreationMutex;
 
-        OwnPtr<WorkerThreadStartupData> m_startupData;
+        std::unique_ptr<WorkerThreadStartupData> m_startupData;
 
 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
         NotificationClient* m_notificationClient;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to