Changeset 253967 in webkit


Ignore:
Timestamp:
Jan 1, 2020 5:05:01 AM (4 years ago)
Author:
youenn@apple.com
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):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r253966 r253967  
     12020-01-01  youenn fablet  <youenn@apple.com>
     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
    1202020-01-01  youenn fablet  <youenn@apple.com>
    221
  • trunk/Source/WebCore/workers/service/ServiceWorkerJobData.cpp

    r253102 r253967  
    3131namespace WebCore {
    3232
    33 ServiceWorkerJobData::ServiceWorkerJobData(const Identifier& identifier)
    34     : m_identifier(identifier)
    35 {
    36 }
    37 
    3833ServiceWorkerJobData::ServiceWorkerJobData(SWServerConnectionIdentifier connectionIdentifier, const DocumentOrWorkerIdentifier& localSourceContext)
    3934    : m_identifier { connectionIdentifier, ServiceWorkerJobIdentifier::generateThreadSafe() }
     
    5550ServiceWorkerJobData ServiceWorkerJobData::isolatedCopy() const
    5651{
    57     ServiceWorkerJobData result { identifier() };
     52    ServiceWorkerJobData result;
     53    result.m_identifier = identifier();
    5854    result.sourceContext = sourceContext;
    5955    result.type = type;
  • trunk/Source/WebCore/workers/service/ServiceWorkerJobData.h

    r253102 r253967  
    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; }
     
    6664
    6765private:
    68     WEBCORE_EXPORT explicit ServiceWorkerJobData(const Identifier&);
     66    ServiceWorkerJobData() = default;
    6967
    7068    Identifier m_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))
Note: See TracChangeset for help on using the changeset viewer.