Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

Commit 59ee5ec

Browse files
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): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@253967 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent cba03ac commit 59ee5ec

File tree

3 files changed

+24
-10
lines changed

3 files changed

+24
-10
lines changed

Source/WebCore/ChangeLog

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
2020-01-01 youenn fablet <[email protected]>
2+
3+
ServiceWorkerJobData should have a move constructor
4+
https://bugs.webkit.org/show_bug.cgi?id=205555
5+
<rdar://problem/57853373>
6+
7+
Reviewed by Darin Adler.
8+
9+
Previously, ServiceWorkerJobData did not have a move constructor.
10+
Refactor code to enable it.
11+
This improves efficiency and ensures that strings and other ref counted fields are
12+
properly moved and isolated.
13+
Covered by existing tests.
14+
15+
* workers/service/ServiceWorkerJobData.cpp:
16+
(WebCore::ServiceWorkerJobData::isolatedCopy const):
17+
* workers/service/ServiceWorkerJobData.h:
18+
(WebCore::ServiceWorkerJobData::decode):
19+
120
2020-01-01 youenn fablet <[email protected]>
221

322
Implement transceiver setCodecPreferences

Source/WebCore/workers/service/ServiceWorkerJobData.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@
3030

3131
namespace WebCore {
3232

33-
ServiceWorkerJobData::ServiceWorkerJobData(const Identifier& identifier)
34-
: m_identifier(identifier)
35-
{
36-
}
37-
3833
ServiceWorkerJobData::ServiceWorkerJobData(SWServerConnectionIdentifier connectionIdentifier, const DocumentOrWorkerIdentifier& localSourceContext)
3934
: m_identifier { connectionIdentifier, ServiceWorkerJobIdentifier::generateThreadSafe() }
4035
{
@@ -54,7 +49,8 @@ ServiceWorkerRegistrationKey ServiceWorkerJobData::registrationKey() const
5449

5550
ServiceWorkerJobData ServiceWorkerJobData::isolatedCopy() const
5651
{
57-
ServiceWorkerJobData result { identifier() };
52+
ServiceWorkerJobData result;
53+
result.m_identifier = identifier();
5854
result.sourceContext = sourceContext;
5955
result.type = type;
6056

Source/WebCore/workers/service/ServiceWorkerJobData.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ namespace WebCore {
4141
struct ServiceWorkerJobData {
4242
using Identifier = ServiceWorkerJobDataIdentifier;
4343
ServiceWorkerJobData(SWServerConnectionIdentifier, const DocumentOrWorkerIdentifier& sourceContext);
44-
ServiceWorkerJobData(const ServiceWorkerJobData&) = default;
45-
ServiceWorkerJobData() = default;
4644

4745
SWServerConnectionIdentifier connectionIdentifier() const { return m_identifier.connectionIdentifier; }
4846

@@ -65,7 +63,7 @@ struct ServiceWorkerJobData {
6563
template<class Decoder> static Optional<ServiceWorkerJobData> decode(Decoder&);
6664

6765
private:
68-
WEBCORE_EXPORT explicit ServiceWorkerJobData(const Identifier&);
66+
ServiceWorkerJobData() = default;
6967

7068
Identifier m_identifier;
7169
};
@@ -93,7 +91,8 @@ Optional<ServiceWorkerJobData> ServiceWorkerJobData::decode(Decoder& decoder)
9391
if (!identifier)
9492
return WTF::nullopt;
9593

96-
ServiceWorkerJobData jobData { WTFMove(*identifier) };
94+
ServiceWorkerJobData jobData;
95+
jobData.m_identifier = *identifier;
9796

9897
if (!decoder.decode(jobData.scriptURL))
9998
return WTF::nullopt;

0 commit comments

Comments
 (0)