Skip to content
Permalink
Browse files
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:

Canonical link: https://commits.webkit.org/195010@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224018 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
c29reid authored and webkit-commit-queue committed Oct 26, 2017
1 parent 110d7f8 commit 2113b78677afdf0e5e6a2624a1a1f15e12273c35
Showing 14 changed files with 62 additions and 93 deletions.
@@ -37,7 +37,7 @@ class ScopeExit final {
public:
template<typename ExitFunctionParameter>
explicit ScopeExit(ExitFunctionParameter&& exitFunction)
: m_exitFunction(std::forward<ExitFunction>(exitFunction))
: m_exitFunction(WTFMove(exitFunction))
{
}

@@ -1,3 +1,22 @@
2017-10-26 Christopher Reid <chris.reid@sony.com>

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

Reviewed by Brady Eidson.

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:

2017-10-26 Carlos Garcia Campos <cgarcia@igalia.com>

REGRESSION(r222090): [HarfBuzz] Arabic shaping is broken except for first word in line
@@ -45,10 +45,10 @@
#include "JSDOMConvertNumbers.h"
#include "JSDOMConvertSequences.h"
#include "Logging.h"
#include "ScopeGuard.h"
#include "ScriptExecutionContext.h"
#include "ThreadSafeDataBuffer.h"
#include <heap/StrongInlines.h>
#include <wtf/Scope.h>
#include <wtf/Variant.h>


@@ -177,7 +177,7 @@ void IDBRequest::setSource(IDBCursor& cursor)
ASSERT(!m_cursorRequestNotifier);

m_source = Source { &cursor };
m_cursorRequestNotifier = std::make_unique<ScopeGuard>([this]() {
m_cursorRequestNotifier = std::make_unique<WTF::ScopeExit<WTF::Function<void()>>>([this]() {
ASSERT(WTF::holds_alternative<RefPtr<IDBCursor>>(m_source.value()));
WTF::get<RefPtr<IDBCursor>>(m_source.value())->decrementOutstandingRequestCount();
});
@@ -487,7 +487,7 @@ void IDBRequest::willIterateCursor(IDBCursor& cursor)
m_domError = nullptr;
m_idbError = IDBError { };

m_cursorRequestNotifier = std::make_unique<ScopeGuard>([this]() {
m_cursorRequestNotifier = std::make_unique<WTF::ScopeExit<WTF::Function<void()>>>([this]() {
m_pendingCursor->decrementOutstandingRequestCount();
});
}
@@ -34,6 +34,8 @@
#include "IDBResourceIdentifier.h"
#include "IndexedDB.h"
#include <heap/Strong.h>
#include <wtf/Function.h>
#include <wtf/Scope.h>

namespace WebCore {

@@ -47,7 +49,6 @@ class IDBObjectStore;
class IDBResultData;
class IDBTransaction;
class IDBValue;
class ScopeGuard;
class ThreadSafeDataBuffer;

namespace IDBClient {
@@ -170,7 +171,7 @@ class IDBRequest : public EventTargetWithInlineData, public IDBActiveDOMObject,

RefPtr<IDBCursor> m_pendingCursor;

std::unique_ptr<ScopeGuard> m_cursorRequestNotifier;
std::unique_ptr<WTF::ScopeExit<WTF::Function<void()>>> m_cursorRequestNotifier;

Ref<IDBClient::IDBConnectionProxy> m_connectionProxy;
};
@@ -40,7 +40,6 @@
#include "IDBTransactionInfo.h"
#include "IDBValue.h"
#include "Logging.h"
#include "ScopeGuard.h"
#include "SerializedScriptValue.h"
#include "UniqueIDBDatabaseConnection.h"
#include <heap/HeapInlines.h>
@@ -49,6 +48,7 @@
#include <runtime/StructureInlines.h>
#include <wtf/MainThread.h>
#include <wtf/NeverDestroyed.h>
#include <wtf/Scope.h>


namespace WebCore {
@@ -984,9 +984,12 @@ void UniqueIDBDatabase::performPutOrAdd(uint64_t callbackIdentifier, const IDBRe
}

bool usedKeyIsGenerated = false;
ScopeGuard generatedKeyResetter;
uint64_t keyNumber;
auto generatedKeyResetter = WTF::makeScopeExit([this, transactionIdentifier, objectStoreIdentifier, &keyNumber, &usedKeyIsGenerated]() {
if (usedKeyIsGenerated)
m_backingStore->revertGeneratedKeyNumber(transactionIdentifier, objectStoreIdentifier, keyNumber);
});
if (objectStoreInfo->autoIncrement() && !keyData.isValid()) {
uint64_t keyNumber;
error = m_backingStore->generateKeyNumber(transactionIdentifier, objectStoreIdentifier, keyNumber);
if (!error.isNull()) {
postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformPutOrAdd, callbackIdentifier, error, usedKey));
@@ -995,9 +998,6 @@ void UniqueIDBDatabase::performPutOrAdd(uint64_t callbackIdentifier, const IDBRe

usedKey.setNumberValue(keyNumber);
usedKeyIsGenerated = true;
generatedKeyResetter.enable([this, transactionIdentifier, objectStoreIdentifier, keyNumber]() {
m_backingStore->revertGeneratedKeyNumber(transactionIdentifier, objectStoreIdentifier, keyNumber);
});
} else
usedKey = keyData;

@@ -1065,7 +1065,7 @@ void UniqueIDBDatabase::performPutOrAdd(uint64_t callbackIdentifier, const IDBRe
if (overwriteMode != IndexedDB::ObjectStoreOverwriteMode::OverwriteForCursor && objectStoreInfo->autoIncrement() && keyData.type() == IndexedDB::KeyType::Number)
error = m_backingStore->maybeUpdateKeyGeneratorNumber(transactionIdentifier, objectStoreIdentifier, keyData.number());

generatedKeyResetter.disable();
generatedKeyResetter.release();
postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformPutOrAdd, callbackIdentifier, error, usedKey));
}

@@ -1364,7 +1364,6 @@
51327D6011A33A2B004F9D65 /* SinkDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = 51327D5E11A33A2B004F9D65 /* SinkDocument.h */; };
513F14540AB634C400094DDF /* IconLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 513F14520AB634C400094DDF /* IconLoader.h */; };
51405C89190B014400754F94 /* SelectionRectGatherer.h in Headers */ = {isa = PBXBuildFile; fileRef = 51405C87190B014400754F94 /* SelectionRectGatherer.h */; settings = {ATTRIBUTES = (Private, ); }; };
514129901C601ACC0059E714 /* ScopeGuard.h in Headers */ = {isa = PBXBuildFile; fileRef = 5141298F1C601A890059E714 /* ScopeGuard.h */; settings = {ATTRIBUTES = (Private, ); }; };
514129991C6976900059E714 /* IDBRequestCompletionEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 514129971C6976150059E714 /* IDBRequestCompletionEvent.h */; };
5143B2631DDD15200014FAC6 /* LinkIcon.h in Headers */ = {isa = PBXBuildFile; fileRef = 5143B2621DDD14900014FAC6 /* LinkIcon.h */; settings = {ATTRIBUTES = (Private, ); }; };
5145B10A1BC48E2E00E86219 /* IDBResourceIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 5145B1081BC4890B00E86219 /* IDBResourceIdentifier.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -7691,7 +7690,6 @@
51405C86190B014400754F94 /* SelectionRectGatherer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SelectionRectGatherer.cpp; sourceTree = "<group>"; };
51405C87190B014400754F94 /* SelectionRectGatherer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SelectionRectGatherer.h; sourceTree = "<group>"; };
5141298D1C5FD7E90059E714 /* JSIDBCursorWithValueCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBCursorWithValueCustom.cpp; sourceTree = "<group>"; };
5141298F1C601A890059E714 /* ScopeGuard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScopeGuard.h; sourceTree = "<group>"; };
514129961C6976150059E714 /* IDBRequestCompletionEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBRequestCompletionEvent.cpp; sourceTree = "<group>"; };
514129971C6976150059E714 /* IDBRequestCompletionEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBRequestCompletionEvent.h; sourceTree = "<group>"; };
5141299A1C6C166D0059E714 /* JSIDBIndexCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBIndexCustom.cpp; sourceTree = "<group>"; };
@@ -23523,7 +23521,6 @@
293EAE1E1356B2FE0067ACF9 /* RuntimeApplicationChecks.h */,
5162C7F211F77EFA00612EFE /* SchemeRegistry.cpp */,
5162C7F311F77EFB00612EFE /* SchemeRegistry.h */,
5141298F1C601A890059E714 /* ScopeGuard.h */,
BC8AE34C12EA096A00EB3AE6 /* ScrollableArea.cpp */,
BC8AE34D12EA096A00EB3AE6 /* ScrollableArea.h */,
CA3BF67B10D99BAE00E6CE53 /* ScrollAnimator.cpp */,
@@ -28811,7 +28808,6 @@
5DFE8F570D16477C0076E937 /* ScheduledAction.h in Headers */,
5162C7F511F77EFB00612EFE /* SchemeRegistry.h in Headers */,
9BD0BF9312A42BF50072FD43 /* ScopedEventQueue.h in Headers */,
514129901C601ACC0059E714 /* ScopeGuard.h in Headers */,
BCEC01BE0C274DAC009F4EC9 /* Screen.h in Headers */,
A84D82C111D3474800972990 /* ScriptableDocumentParser.h in Headers */,
41F1D21F0EF35C2A00DA8753 /* ScriptCachedFrameData.h in Headers */,
@@ -28,8 +28,8 @@
#include "FileSystem.h"

#include "FileMetadata.h"
#include "ScopeGuard.h"
#include <wtf/HexNumber.h>
#include <wtf/Scope.h>
#include <wtf/text/CString.h>
#include <wtf/text/StringBuilder.h>

@@ -213,7 +213,7 @@ bool appendFileContentsToFileHandle(const String& path, PlatformFileHandle& targ
static int bufferSize = 1 << 19;
Vector<char> buffer(bufferSize);

ScopeGuard fileCloser([source]() {
auto fileCloser = WTF::makeScopeExit([source]() {
PlatformFileHandle handle = source;
closeFile(handle);
});

This file was deleted.

@@ -41,9 +41,9 @@
#include "ResourceHandle.h"
#include "ResourceRequest.h"
#include "ResourceResponse.h"
#include "ScopeGuard.h"
#include <wtf/MainThread.h>
#include <wtf/NeverDestroyed.h>
#include <wtf/Scope.h>
#include <wtf/StdLibExtras.h>
#include <wtf/WorkQueue.h>

@@ -286,7 +286,7 @@ void BlobRegistryImpl::writeBlobsToTemporaryFiles(const Vector<String>& blobURLs
PlatformFileHandle file;
String tempFilePath = openTemporaryFile(ASCIILiteral("Blob"), file);

ScopeGuard fileCloser([file]() mutable {
auto fileCloser = WTF::makeScopeExit([file]() mutable {
closeFile(file);
});

@@ -35,7 +35,6 @@
#include "Logging.h"
#include "NavigatorBase.h"
#include "ResourceError.h"
#include "ScopeGuard.h"
#include "ScriptExecutionContext.h"
#include "SecurityOrigin.h"
#include "ServiceWorker.h"
@@ -44,6 +43,7 @@
#include "ServiceWorkerProvider.h"
#include "URL.h"
#include <wtf/RunLoop.h>
#include <wtf/Scope.h>

namespace WebCore {

@@ -202,7 +202,7 @@ void ServiceWorkerContainer::jobFailedWithException(ServiceWorkerJob& job, const

void ServiceWorkerContainer::jobResolvedWithRegistration(ServiceWorkerJob& job, ServiceWorkerRegistrationData&& data)
{
ScopeGuard guard([this, &job] {
auto guard = WTF::makeScopeExit([this, &job] {
jobDidFinish(job);
});

@@ -221,7 +221,7 @@ void ServiceWorkerContainer::jobResolvedWithRegistration(ServiceWorkerJob& job,

void ServiceWorkerContainer::jobResolvedWithUnregistrationResult(ServiceWorkerJob& job, bool unregistrationResult)
{
ScopeGuard guard([this, &job] {
auto guard = WTF::makeScopeExit([this, &job] {
jobDidFinish(job);
});

@@ -1,3 +1,12 @@
2017-10-26 Christopher Reid <chris.reid@sony.com>

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

Reviewed by Brady Eidson.

* Shared/mac/ChildProcessMac.mm:

2017-10-25 Per Arne Vollan <pvollan@apple.com>

Network process crash under WebKit::AuthenticationManager::rejectProtectionSpaceAndContinueForSingleChallenge.
@@ -33,14 +33,14 @@
#import "QuarantineSPI.h"
#import "SandboxInitializationParameters.h"
#import <WebCore/FileSystem.h>
#import <WebCore/ScopeGuard.h>
#import <WebCore/SystemVersion.h>
#import <mach/mach.h>
#import <mach/task.h>
#import <pal/spi/cf/CFNetworkSPI.h>
#import <pwd.h>
#import <stdlib.h>
#import <sysexits.h>
#import <wtf/Scope.h>
#import <wtf/spi/darwin/SandboxSPI.h>

#if USE(APPLE_INTERNAL_SDK)
@@ -84,7 +84,7 @@ static OSStatus enableSandboxStyleFileQuarantine()
{
int error;
qtn_proc_t quarantineProperties = qtn_proc_alloc();
ScopeGuard quarantinePropertiesDeleter([quarantineProperties]() {
auto quarantinePropertiesDeleter = makeScopeExit([quarantineProperties]() {
qtn_proc_free(quarantineProperties);
});

@@ -1,3 +1,12 @@
2017-10-26 Christopher Reid <chris.reid@sony.com>

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

Reviewed by Brady Eidson.

* TestWebKitAPI/Tests/WebCore/FileMonitor.cpp:

2017-09-21 Carlos Garcia Campos <cgarcia@igalia.com>

WebDriver: Add support to import and run W3C tests
@@ -30,9 +30,9 @@
#include "WTFStringUtilities.h"
#include <WebCore/FileMonitor.h>
#include <WebCore/FileSystem.h>
#include <WebCore/ScopeGuard.h>
#include <wtf/MainThread.h>
#include <wtf/RunLoop.h>
#include <wtf/Scope.h>
#include <wtf/StringExtras.h>
#include <wtf/WorkQueue.h>
#include <wtf/text/StringBuffer.h>
@@ -120,7 +120,7 @@ static String readContentsOfFile(const String& path)

StringBuffer<LChar> buffer(bufferSize);

ScopeGuard fileCloser([source]() {
auto fileCloser = WTF::makeScopeExit([source]() {
PlatformFileHandle handle = source;
closeFile(handle);
});

0 comments on commit 2113b78

Please sign in to comment.