Title: [253967] trunk/Source/WebCore
Revision
253967
Author
you...@apple.com
Date
2020-01-01 05:05:01 -0800 (Wed, 01 Jan 2020)

Log Message

ServiceWorkerJobData should have a move constructor
https://bugs.webkit.org/show_bug.cgi?id=205555
<rdar://problem/57853373>

Reviewed by Darin Adler.

Previously, ServiceWorkerJobData did not have a move constructor.
Refactor code to enable it.
This improves efficiency and ensures that strings and other ref counted fields are
properly moved and isolated.
Covered by existing tests.

* workers/service/ServiceWorkerJobData.cpp:
(WebCore::ServiceWorkerJobData::isolatedCopy const):
* workers/service/ServiceWorkerJobData.h:
(WebCore::ServiceWorkerJobData::decode):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (253966 => 253967)


--- trunk/Source/WebCore/ChangeLog	2020-01-01 12:55:46 UTC (rev 253966)
+++ trunk/Source/WebCore/ChangeLog	2020-01-01 13:05:01 UTC (rev 253967)
@@ -1,5 +1,24 @@
 2020-01-01  youenn fablet  <you...@apple.com>
 
+        ServiceWorkerJobData should have a move constructor
+        https://bugs.webkit.org/show_bug.cgi?id=205555
+        <rdar://problem/57853373>
+
+        Reviewed by Darin Adler.
+
+        Previously, ServiceWorkerJobData did not have a move constructor.
+        Refactor code to enable it.
+        This improves efficiency and ensures that strings and other ref counted fields are
+        properly moved and isolated.
+        Covered by existing tests.
+
+        * workers/service/ServiceWorkerJobData.cpp:
+        (WebCore::ServiceWorkerJobData::isolatedCopy const):
+        * workers/service/ServiceWorkerJobData.h:
+        (WebCore::ServiceWorkerJobData::decode):
+
+2020-01-01  youenn fablet  <you...@apple.com>
+
         Implement transceiver setCodecPreferences
         https://bugs.webkit.org/show_bug.cgi?id=190840
         <rdar://problem/45496326>

Modified: trunk/Source/WebCore/workers/service/ServiceWorkerJobData.cpp (253966 => 253967)


--- trunk/Source/WebCore/workers/service/ServiceWorkerJobData.cpp	2020-01-01 12:55:46 UTC (rev 253966)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerJobData.cpp	2020-01-01 13:05:01 UTC (rev 253967)
@@ -30,11 +30,6 @@
 
 namespace WebCore {
 
-ServiceWorkerJobData::ServiceWorkerJobData(const Identifier& identifier)
-    : m_identifier(identifier)
-{
-}
-
 ServiceWorkerJobData::ServiceWorkerJobData(SWServerConnectionIdentifier connectionIdentifier, const DocumentOrWorkerIdentifier& localSourceContext)
     : m_identifier { connectionIdentifier, ServiceWorkerJobIdentifier::generateThreadSafe() }
 {
@@ -54,7 +49,8 @@
 
 ServiceWorkerJobData ServiceWorkerJobData::isolatedCopy() const
 {
-    ServiceWorkerJobData result { identifier() };
+    ServiceWorkerJobData result;
+    result.m_identifier = identifier();
     result.sourceContext = sourceContext;
     result.type = type;
 

Modified: trunk/Source/WebCore/workers/service/ServiceWorkerJobData.h (253966 => 253967)


--- trunk/Source/WebCore/workers/service/ServiceWorkerJobData.h	2020-01-01 12:55:46 UTC (rev 253966)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerJobData.h	2020-01-01 13:05:01 UTC (rev 253967)
@@ -41,8 +41,6 @@
 struct ServiceWorkerJobData {
     using Identifier = ServiceWorkerJobDataIdentifier;
     ServiceWorkerJobData(SWServerConnectionIdentifier, const DocumentOrWorkerIdentifier& sourceContext);
-    ServiceWorkerJobData(const ServiceWorkerJobData&) = default;
-    ServiceWorkerJobData() = default;
 
     SWServerConnectionIdentifier connectionIdentifier() const { return m_identifier.connectionIdentifier; }
 
@@ -65,7 +63,7 @@
     template<class Decoder> static Optional<ServiceWorkerJobData> decode(Decoder&);
 
 private:
-    WEBCORE_EXPORT explicit ServiceWorkerJobData(const Identifier&);
+    ServiceWorkerJobData() = default;
 
     Identifier m_identifier;
 };
@@ -93,7 +91,8 @@
     if (!identifier)
         return WTF::nullopt;
 
-    ServiceWorkerJobData jobData { WTFMove(*identifier) };
+    ServiceWorkerJobData jobData;
+    jobData.m_identifier = *identifier;
 
     if (!decoder.decode(jobData.scriptURL))
         return WTF::nullopt;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to