Title: [202313] trunk/Source/WebCore
Revision
202313
Author
[email protected]
Date
2016-06-21 20:06:36 -0700 (Tue, 21 Jun 2016)

Log Message

Pass ScriptExecutionContext::Task as rvalue reference
https://bugs.webkit.org/show_bug.cgi?id=159007

Reviewed by Anders Carlsson.

Pass ScriptExecutionContext::Task as rvalue reference since its non-copyable
and has to be moved in.

* workers/WorkerLoaderProxy.h:
* workers/WorkerMessagingProxy.cpp:
(WebCore::WorkerMessagingProxy::postTaskToLoader):
(WebCore::WorkerMessagingProxy::postTaskForModeToWorkerGlobalScope):
* workers/WorkerMessagingProxy.h:
* workers/WorkerRunLoop.cpp:
(WebCore::WorkerRunLoop::postTask):
(WebCore::WorkerRunLoop::postTaskAndTerminate):
(WebCore::WorkerRunLoop::postTaskForMode):
(WebCore::WorkerRunLoop::Task::Task):
* workers/WorkerRunLoop.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (202312 => 202313)


--- trunk/Source/WebCore/ChangeLog	2016-06-22 02:52:46 UTC (rev 202312)
+++ trunk/Source/WebCore/ChangeLog	2016-06-22 03:06:36 UTC (rev 202313)
@@ -1,3 +1,25 @@
+2016-06-21  Chris Dumez  <[email protected]>
+
+        Pass ScriptExecutionContext::Task as rvalue reference
+        https://bugs.webkit.org/show_bug.cgi?id=159007
+
+        Reviewed by Anders Carlsson.
+
+        Pass ScriptExecutionContext::Task as rvalue reference since its non-copyable
+        and has to be moved in.
+
+        * workers/WorkerLoaderProxy.h:
+        * workers/WorkerMessagingProxy.cpp:
+        (WebCore::WorkerMessagingProxy::postTaskToLoader):
+        (WebCore::WorkerMessagingProxy::postTaskForModeToWorkerGlobalScope):
+        * workers/WorkerMessagingProxy.h:
+        * workers/WorkerRunLoop.cpp:
+        (WebCore::WorkerRunLoop::postTask):
+        (WebCore::WorkerRunLoop::postTaskAndTerminate):
+        (WebCore::WorkerRunLoop::postTaskForMode):
+        (WebCore::WorkerRunLoop::Task::Task):
+        * workers/WorkerRunLoop.h:
+
 2016-06-21  Anders Carlsson  <[email protected]>
 
         Include IdentifierInlines.h.

Modified: trunk/Source/WebCore/workers/WorkerLoaderProxy.h (202312 => 202313)


--- trunk/Source/WebCore/workers/WorkerLoaderProxy.h	2016-06-22 02:52:46 UTC (rev 202312)
+++ trunk/Source/WebCore/workers/WorkerLoaderProxy.h	2016-06-22 03:06:36 UTC (rev 202313)
@@ -46,12 +46,12 @@
         virtual ~WorkerLoaderProxy() { }
 
         // Posts a task to the thread which runs the loading code (normally, the main thread).
-        virtual void postTaskToLoader(ScriptExecutionContext::Task) = 0;
+        virtual void postTaskToLoader(ScriptExecutionContext::Task&&) = 0;
 
         // Posts callbacks from loading code to the WorkerGlobalScope. The 'mode' is used to differentiate
         // specific synchronous loading requests so they can be 'nested', per spec.
         // Returns true if the task was posted successfully.
-        virtual bool postTaskForModeToWorkerGlobalScope(ScriptExecutionContext::Task, const String& mode) = 0;
+        virtual bool postTaskForModeToWorkerGlobalScope(ScriptExecutionContext::Task&&, const String& mode) = 0;
     };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp (202312 => 202313)


--- trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp	2016-06-22 02:52:46 UTC (rev 202312)
+++ trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp	2016-06-22 03:06:36 UTC (rev 202313)
@@ -120,7 +120,7 @@
         m_queuedEarlyTasks.append(std::make_unique<ScriptExecutionContext::Task>(WTFMove(task)));
 }
 
-void WorkerMessagingProxy::postTaskToLoader(ScriptExecutionContext::Task task)
+void WorkerMessagingProxy::postTaskToLoader(ScriptExecutionContext::Task&& task)
 {
     // FIXME: In case of nested workers, this should go directly to the root Document context.
     ASSERT(m_scriptExecutionContext->isDocument());
@@ -127,7 +127,7 @@
     m_scriptExecutionContext->postTask(WTFMove(task));
 }
 
-bool WorkerMessagingProxy::postTaskForModeToWorkerGlobalScope(ScriptExecutionContext::Task task, const String& mode)
+bool WorkerMessagingProxy::postTaskForModeToWorkerGlobalScope(ScriptExecutionContext::Task&& task, const String& mode)
 {
     if (m_askedToTerminate)
         return false;

Modified: trunk/Source/WebCore/workers/WorkerMessagingProxy.h (202312 => 202313)


--- trunk/Source/WebCore/workers/WorkerMessagingProxy.h	2016-06-22 02:52:46 UTC (rev 202312)
+++ trunk/Source/WebCore/workers/WorkerMessagingProxy.h	2016-06-22 03:06:36 UTC (rev 202313)
@@ -72,8 +72,8 @@
         // Implementation of WorkerLoaderProxy.
         // These methods are called on different threads to schedule loading
         // requests and to send callbacks back to WorkerGlobalScope.
-        void postTaskToLoader(ScriptExecutionContext::Task) override;
-        bool postTaskForModeToWorkerGlobalScope(ScriptExecutionContext::Task, const String& mode) override;
+        void postTaskToLoader(ScriptExecutionContext::Task&&) override;
+        bool postTaskForModeToWorkerGlobalScope(ScriptExecutionContext::Task&&, const String& mode) override;
 
         void workerThreadCreated(PassRefPtr<DedicatedWorkerThread>);
 

Modified: trunk/Source/WebCore/workers/WorkerRunLoop.cpp (202312 => 202313)


--- trunk/Source/WebCore/workers/WorkerRunLoop.cpp	2016-06-22 02:52:46 UTC (rev 202312)
+++ trunk/Source/WebCore/workers/WorkerRunLoop.cpp	2016-06-22 03:06:36 UTC (rev 202313)
@@ -212,17 +212,17 @@
     m_messageQueue.kill();
 }
 
-void WorkerRunLoop::postTask(ScriptExecutionContext::Task task)
+void WorkerRunLoop::postTask(ScriptExecutionContext::Task&& task)
 {
     postTaskForMode(WTFMove(task), defaultMode());
 }
 
-void WorkerRunLoop::postTaskAndTerminate(ScriptExecutionContext::Task task)
+void WorkerRunLoop::postTaskAndTerminate(ScriptExecutionContext::Task&& task)
 {
     m_messageQueue.appendAndKill(std::make_unique<Task>(WTFMove(task), defaultMode()));
 }
 
-void WorkerRunLoop::postTaskForMode(ScriptExecutionContext::Task task, const String& mode)
+void WorkerRunLoop::postTaskForMode(ScriptExecutionContext::Task&& task, const String& mode)
 {
     m_messageQueue.append(std::make_unique<Task>(WTFMove(task), mode));
 }
@@ -233,7 +233,7 @@
         m_task.performTask(*context);
 }
 
-WorkerRunLoop::Task::Task(ScriptExecutionContext::Task task, const String& mode)
+WorkerRunLoop::Task::Task(ScriptExecutionContext::Task&& task, const String& mode)
     : m_task(WTFMove(task))
     , m_mode(mode.isolatedCopy())
 {

Modified: trunk/Source/WebCore/workers/WorkerRunLoop.h (202312 => 202313)


--- trunk/Source/WebCore/workers/WorkerRunLoop.h	2016-06-22 02:52:46 UTC (rev 202312)
+++ trunk/Source/WebCore/workers/WorkerRunLoop.h	2016-06-22 03:06:36 UTC (rev 202313)
@@ -57,9 +57,9 @@
         void terminate();
         bool terminated() const { return m_messageQueue.killed(); }
 
-        void postTask(ScriptExecutionContext::Task);
-        void postTaskAndTerminate(ScriptExecutionContext::Task);
-        void postTaskForMode(ScriptExecutionContext::Task, const String& mode);
+        void postTask(ScriptExecutionContext::Task&&);
+        void postTaskAndTerminate(ScriptExecutionContext::Task&&);
+        void postTaskForMode(ScriptExecutionContext::Task&&, const String& mode);
 
         unsigned long createUniqueId() { return ++m_uniqueId; }
 
@@ -68,7 +68,7 @@
         class Task {
             WTF_MAKE_NONCOPYABLE(Task); WTF_MAKE_FAST_ALLOCATED;
         public:
-            Task(ScriptExecutionContext::Task, const String& mode);
+            Task(ScriptExecutionContext::Task&&, const String& mode);
             const String& mode() const { return m_mode; }
             void performTask(const WorkerRunLoop&, WorkerGlobalScope*);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to