Changeset 224018 in webkit


Ignore:
Timestamp:
Oct 26, 2017 7:06:26 AM (6 years ago)
Author:
commit-queue@webkit.org
Message:

Remove scopeguard from platform
https://bugs.webkit.org/show_bug.cgi?id=178681

Patch by Christopher Reid <chris.reid@sony.com> on 2017-10-26
Reviewed by Brady Eidson.

Source/WebCore:

Replacing platform/ScopeGuard with WTF::ScopeExit.
No new tests, no change in behavior.

  • Modules/indexeddb/IDBRequest.cpp:
  • Modules/indexeddb/IDBRequest.h:
  • Modules/indexeddb/server/UniqueIDBDatabase.cpp:
  • WebCore.xcodeproj/project.pbxproj:
  • platform/FileSystem.cpp:
  • platform/ScopeGuard.h: Removed.
  • platform/network/BlobRegistryImpl.cpp:
  • workers/service/ServiceWorkerContainer.cpp:

Source/WebKit:

  • Shared/mac/ChildProcessMac.mm:

Tools:

  • TestWebKitAPI/Tests/WebCore/FileMonitor.cpp:
Location:
trunk
Files:
1 deleted
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/wtf/Scope.h

    r204538 r224018  
    3838    template<typename ExitFunctionParameter>
    3939    explicit ScopeExit(ExitFunctionParameter&& exitFunction)
    40         : m_exitFunction(std::forward<ExitFunction>(exitFunction))
     40        : m_exitFunction(WTFMove(exitFunction))
    4141    {
    4242    }
  • trunk/Source/WebCore/ChangeLog

    r224015 r224018  
     12017-10-26  Christopher Reid  <chris.reid@sony.com>
     2
     3        Remove scopeguard from platform
     4        https://bugs.webkit.org/show_bug.cgi?id=178681
     5
     6        Reviewed by Brady Eidson.
     7
     8        Replacing platform/ScopeGuard with WTF::ScopeExit.
     9        No new tests, no change in behavior.
     10
     11        * Modules/indexeddb/IDBRequest.cpp:
     12        * Modules/indexeddb/IDBRequest.h:
     13        * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
     14        * WebCore.xcodeproj/project.pbxproj:
     15        * platform/FileSystem.cpp:
     16        * platform/ScopeGuard.h: Removed.
     17        * platform/network/BlobRegistryImpl.cpp:
     18        * workers/service/ServiceWorkerContainer.cpp:
     19
    1202017-10-26  Carlos Garcia Campos  <cgarcia@igalia.com>
    221
  • trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp

    r223476 r224018  
    4646#include "JSDOMConvertSequences.h"
    4747#include "Logging.h"
    48 #include "ScopeGuard.h"
    4948#include "ScriptExecutionContext.h"
    5049#include "ThreadSafeDataBuffer.h"
    5150#include <heap/StrongInlines.h>
     51#include <wtf/Scope.h>
    5252#include <wtf/Variant.h>
    5353
     
    178178
    179179    m_source = Source { &cursor };
    180     m_cursorRequestNotifier = std::make_unique<ScopeGuard>([this]() {
     180    m_cursorRequestNotifier = std::make_unique<WTF::ScopeExit<WTF::Function<void()>>>([this]() {
    181181        ASSERT(WTF::holds_alternative<RefPtr<IDBCursor>>(m_source.value()));
    182182        WTF::get<RefPtr<IDBCursor>>(m_source.value())->decrementOutstandingRequestCount();
     
    488488    m_idbError = IDBError { };
    489489
    490     m_cursorRequestNotifier = std::make_unique<ScopeGuard>([this]() {
     490    m_cursorRequestNotifier = std::make_unique<WTF::ScopeExit<WTF::Function<void()>>>([this]() {
    491491        m_pendingCursor->decrementOutstandingRequestCount();
    492492    });
  • trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h

    r222250 r224018  
    3535#include "IndexedDB.h"
    3636#include <heap/Strong.h>
     37#include <wtf/Function.h>
     38#include <wtf/Scope.h>
    3739
    3840namespace WebCore {
     
    4850class IDBTransaction;
    4951class IDBValue;
    50 class ScopeGuard;
    5152class ThreadSafeDataBuffer;
    5253
     
    171172    RefPtr<IDBCursor> m_pendingCursor;
    172173
    173     std::unique_ptr<ScopeGuard> m_cursorRequestNotifier;
     174    std::unique_ptr<WTF::ScopeExit<WTF::Function<void()>>> m_cursorRequestNotifier;
    174175
    175176    Ref<IDBClient::IDBConnectionProxy> m_connectionProxy;
  • trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp

    r223476 r224018  
    4141#include "IDBValue.h"
    4242#include "Logging.h"
    43 #include "ScopeGuard.h"
    4443#include "SerializedScriptValue.h"
    4544#include "UniqueIDBDatabaseConnection.h"
     
    5049#include <wtf/MainThread.h>
    5150#include <wtf/NeverDestroyed.h>
     51#include <wtf/Scope.h>
    5252
    5353
     
    985985
    986986    bool usedKeyIsGenerated = false;
    987     ScopeGuard generatedKeyResetter;
     987    uint64_t keyNumber;
     988    auto generatedKeyResetter = WTF::makeScopeExit([this, transactionIdentifier, objectStoreIdentifier, &keyNumber, &usedKeyIsGenerated]() {
     989        if (usedKeyIsGenerated)
     990            m_backingStore->revertGeneratedKeyNumber(transactionIdentifier, objectStoreIdentifier, keyNumber);
     991    });
    988992    if (objectStoreInfo->autoIncrement() && !keyData.isValid()) {
    989         uint64_t keyNumber;
    990993        error = m_backingStore->generateKeyNumber(transactionIdentifier, objectStoreIdentifier, keyNumber);
    991994        if (!error.isNull()) {
     
    996999        usedKey.setNumberValue(keyNumber);
    9971000        usedKeyIsGenerated = true;
    998         generatedKeyResetter.enable([this, transactionIdentifier, objectStoreIdentifier, keyNumber]() {
    999             m_backingStore->revertGeneratedKeyNumber(transactionIdentifier, objectStoreIdentifier, keyNumber);
    1000         });
    10011001    } else
    10021002        usedKey = keyData;
     
    10661066        error = m_backingStore->maybeUpdateKeyGeneratorNumber(transactionIdentifier, objectStoreIdentifier, keyData.number());
    10671067
    1068     generatedKeyResetter.disable();
     1068    generatedKeyResetter.release();
    10691069    postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformPutOrAdd, callbackIdentifier, error, usedKey));
    10701070}
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r224009 r224018  
    13651365                513F14540AB634C400094DDF /* IconLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 513F14520AB634C400094DDF /* IconLoader.h */; };
    13661366                51405C89190B014400754F94 /* SelectionRectGatherer.h in Headers */ = {isa = PBXBuildFile; fileRef = 51405C87190B014400754F94 /* SelectionRectGatherer.h */; settings = {ATTRIBUTES = (Private, ); }; };
    1367                 514129901C601ACC0059E714 /* ScopeGuard.h in Headers */ = {isa = PBXBuildFile; fileRef = 5141298F1C601A890059E714 /* ScopeGuard.h */; settings = {ATTRIBUTES = (Private, ); }; };
    13681367                514129991C6976900059E714 /* IDBRequestCompletionEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 514129971C6976150059E714 /* IDBRequestCompletionEvent.h */; };
    13691368                5143B2631DDD15200014FAC6 /* LinkIcon.h in Headers */ = {isa = PBXBuildFile; fileRef = 5143B2621DDD14900014FAC6 /* LinkIcon.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    76927691                51405C87190B014400754F94 /* SelectionRectGatherer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SelectionRectGatherer.h; sourceTree = "<group>"; };
    76937692                5141298D1C5FD7E90059E714 /* JSIDBCursorWithValueCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBCursorWithValueCustom.cpp; sourceTree = "<group>"; };
    7694                 5141298F1C601A890059E714 /* ScopeGuard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScopeGuard.h; sourceTree = "<group>"; };
    76957693                514129961C6976150059E714 /* IDBRequestCompletionEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBRequestCompletionEvent.cpp; sourceTree = "<group>"; };
    76967694                514129971C6976150059E714 /* IDBRequestCompletionEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBRequestCompletionEvent.h; sourceTree = "<group>"; };
     
    2352423522                                5162C7F211F77EFA00612EFE /* SchemeRegistry.cpp */,
    2352523523                                5162C7F311F77EFB00612EFE /* SchemeRegistry.h */,
    23526                                 5141298F1C601A890059E714 /* ScopeGuard.h */,
    2352723524                                BC8AE34C12EA096A00EB3AE6 /* ScrollableArea.cpp */,
    2352823525                                BC8AE34D12EA096A00EB3AE6 /* ScrollableArea.h */,
     
    2881228809                                5162C7F511F77EFB00612EFE /* SchemeRegistry.h in Headers */,
    2881328810                                9BD0BF9312A42BF50072FD43 /* ScopedEventQueue.h in Headers */,
    28814                                 514129901C601ACC0059E714 /* ScopeGuard.h in Headers */,
    2881528811                                BCEC01BE0C274DAC009F4EC9 /* Screen.h in Headers */,
    2881628812                                A84D82C111D3474800972990 /* ScriptableDocumentParser.h in Headers */,
  • trunk/Source/WebCore/platform/FileSystem.cpp

    r221558 r224018  
    2929
    3030#include "FileMetadata.h"
    31 #include "ScopeGuard.h"
    3231#include <wtf/HexNumber.h>
     32#include <wtf/Scope.h>
    3333#include <wtf/text/CString.h>
    3434#include <wtf/text/StringBuilder.h>
     
    214214    Vector<char> buffer(bufferSize);
    215215
    216     ScopeGuard fileCloser([source]() {
     216    auto fileCloser = WTF::makeScopeExit([source]() {
    217217        PlatformFileHandle handle = source;
    218218        closeFile(handle);
  • trunk/Source/WebCore/platform/network/BlobRegistryImpl.cpp

    r223728 r224018  
    4242#include "ResourceRequest.h"
    4343#include "ResourceResponse.h"
    44 #include "ScopeGuard.h"
    4544#include <wtf/MainThread.h>
    4645#include <wtf/NeverDestroyed.h>
     46#include <wtf/Scope.h>
    4747#include <wtf/StdLibExtras.h>
    4848#include <wtf/WorkQueue.h>
     
    287287                String tempFilePath = openTemporaryFile(ASCIILiteral("Blob"), file);
    288288
    289                 ScopeGuard fileCloser([file]() mutable {
     289                auto fileCloser = WTF::makeScopeExit([file]() mutable {
    290290                    closeFile(file);
    291291                });
  • trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp

    r223964 r224018  
    3636#include "NavigatorBase.h"
    3737#include "ResourceError.h"
    38 #include "ScopeGuard.h"
    3938#include "ScriptExecutionContext.h"
    4039#include "SecurityOrigin.h"
     
    4544#include "URL.h"
    4645#include <wtf/RunLoop.h>
     46#include <wtf/Scope.h>
    4747
    4848namespace WebCore {
     
    203203void ServiceWorkerContainer::jobResolvedWithRegistration(ServiceWorkerJob& job, ServiceWorkerRegistrationData&& data)
    204204{
    205     ScopeGuard guard([this, &job] {
     205    auto guard = WTF::makeScopeExit([this, &job] {
    206206        jobDidFinish(job);
    207207    });
     
    222222void ServiceWorkerContainer::jobResolvedWithUnregistrationResult(ServiceWorkerJob& job, bool unregistrationResult)
    223223{
    224     ScopeGuard guard([this, &job] {
     224    auto guard = WTF::makeScopeExit([this, &job] {
    225225        jobDidFinish(job);
    226226    });
  • trunk/Source/WebKit/ChangeLog

    r223993 r224018  
     12017-10-26  Christopher Reid  <chris.reid@sony.com>
     2
     3        Remove scopeguard from platform
     4        https://bugs.webkit.org/show_bug.cgi?id=178681
     5
     6        Reviewed by Brady Eidson.
     7
     8        * Shared/mac/ChildProcessMac.mm:
     9
    1102017-10-25  Per Arne Vollan  <pvollan@apple.com>
    211
  • trunk/Source/WebKit/Shared/mac/ChildProcessMac.mm

    r222896 r224018  
    3434#import "SandboxInitializationParameters.h"
    3535#import <WebCore/FileSystem.h>
    36 #import <WebCore/ScopeGuard.h>
    3736#import <WebCore/SystemVersion.h>
    3837#import <mach/mach.h>
     
    4241#import <stdlib.h>
    4342#import <sysexits.h>
     43#import <wtf/Scope.h>
    4444#import <wtf/spi/darwin/SandboxSPI.h>
    4545
     
    8585    int error;
    8686    qtn_proc_t quarantineProperties = qtn_proc_alloc();
    87     ScopeGuard quarantinePropertiesDeleter([quarantineProperties]() {
     87    auto quarantinePropertiesDeleter = makeScopeExit([quarantineProperties]() {
    8888        qtn_proc_free(quarantineProperties);
    8989    });
  • trunk/Tools/ChangeLog

    r224014 r224018  
     12017-10-26  Christopher Reid  <chris.reid@sony.com>
     2
     3        Remove scopeguard from platform
     4        https://bugs.webkit.org/show_bug.cgi?id=178681
     5
     6        Reviewed by Brady Eidson.
     7
     8        * TestWebKitAPI/Tests/WebCore/FileMonitor.cpp:
     9
    1102017-09-21  Carlos Garcia Campos  <cgarcia@igalia.com>
    211
  • trunk/Tools/TestWebKitAPI/Tests/WebCore/FileMonitor.cpp

    r222962 r224018  
    3131#include <WebCore/FileMonitor.h>
    3232#include <WebCore/FileSystem.h>
    33 #include <WebCore/ScopeGuard.h>
    3433#include <wtf/MainThread.h>
    3534#include <wtf/RunLoop.h>
     35#include <wtf/Scope.h>
    3636#include <wtf/StringExtras.h>
    3737#include <wtf/WorkQueue.h>
     
    121121    StringBuffer<LChar> buffer(bufferSize);
    122122
    123     ScopeGuard fileCloser([source]() {
     123    auto fileCloser = WTF::makeScopeExit([source]() {
    124124        PlatformFileHandle handle = source;
    125125        closeFile(handle);
Note: See TracChangeset for help on using the changeset viewer.