Changeset 241820 in webkit


Ignore:
Timestamp:
Feb 20, 2019 10:23:19 AM (5 years ago)
Author:
don.olmstead@sony.com
Message:

[MSVC] Fix compilation errors with lambdas in Service Workers
https://bugs.webkit.org/show_bug.cgi?id=194841

Reviewed by Alex Christensen.

Source/WebCore:

No new tests. No change in behavior.

MSVC has problems with the scoping of this within a nested lambda. In these cases this is
referring to the enclosing lambda according to MSVC. This patch works around this behavior
through by using the protectedThis pattern in WebKit code.

  • workers/service/server/RegistrationDatabase.cpp:

(WebCore::RegistrationDatabase::openSQLiteDatabase):

Source/WebKit:

  • WebProcess/Storage/ServiceWorkerClientFetch.cpp:

(WebKit::ServiceWorkerClientFetch::didReceiveRedirectResponse):

Location:
trunk/Source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r241790 r241820  
     12019-02-20  Don Olmstead  <don.olmstead@sony.com>
     2
     3        [MSVC] Fix compilation errors with lambdas in Service Workers
     4        https://bugs.webkit.org/show_bug.cgi?id=194841
     5
     6        Reviewed by Alex Christensen.
     7
     8        No new tests. No change in behavior.
     9
     10        MSVC has problems with the scoping of `this` within a nested lambda. In these cases `this` is
     11        referring to the enclosing lambda according to MSVC. This patch works around this behavior
     12        through by using the `protectedThis` pattern in WebKit code.
     13
     14        * workers/service/server/RegistrationDatabase.cpp:
     15        (WebCore::RegistrationDatabase::openSQLiteDatabase):
     16
    1172019-02-20  Adrian Perez de Castro  <aperez@igalia.com>
    218
  • trunk/Source/WebCore/workers/service/server/RegistrationDatabase.cpp

    r241244 r241820  
    134134
    135135    String errorMessage;
    136     auto scopeExit = makeScopeExit([&, errorMessage = &errorMessage] {
     136    auto scopeExit = makeScopeExit([this, protectedThis = makeRef(*this), errorMessage = &errorMessage] {
    137137        ASSERT_UNUSED(errorMessage, !errorMessage->isNull());
    138138
     
    144144
    145145        m_database = nullptr;
    146         callOnMainThread([protectedThis = makeRef(*this)] {
     146        callOnMainThread([protectedThis = protectedThis.copyRef()] {
    147147            protectedThis->databaseFailedToOpen();
    148148        });
  • trunk/Source/WebKit/ChangeLog

    r241817 r241820  
     12019-02-20  Don Olmstead  <don.olmstead@sony.com>
     2
     3        [MSVC] Fix compilation errors with lambdas in Service Workers
     4        https://bugs.webkit.org/show_bug.cgi?id=194841
     5
     6        Reviewed by Alex Christensen.
     7
     8        * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
     9        (WebKit::ServiceWorkerClientFetch::didReceiveRedirectResponse):
     10
    1112019-02-20  Carlos Garcia Campos  <cgarcia@igalia.com>
    212
  • trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerClientFetch.cpp

    r241603 r241820  
    116116        response.setSource(ResourceResponse::Source::ServiceWorker);
    117117
    118         m_loader->willSendRequest(m_loader->request().redirectedRequest(response, m_shouldClearReferrerOnHTTPSToHTTPRedirect), response, [protectedThis = makeRef(*this), this](ResourceRequest&& request) {
     118        m_loader->willSendRequest(m_loader->request().redirectedRequest(response, m_shouldClearReferrerOnHTTPSToHTTPRedirect), response, [this, protectedThis = protectedThis.copyRef()](ResourceRequest&& request) {
    119119            if (!m_loader || request.isNull()) {
    120120                if (auto callback = WTFMove(m_callback))
Note: See TracChangeset for help on using the changeset viewer.