Diff
Modified: trunk/Source/WebCore/ChangeLog (283270 => 283271)
--- trunk/Source/WebCore/ChangeLog 2021-09-29 22:44:55 UTC (rev 283270)
+++ trunk/Source/WebCore/ChangeLog 2021-09-29 22:45:23 UTC (rev 283271)
@@ -1,3 +1,46 @@
+2021-09-29 Sihui Liu <[email protected]>
+
+ Replace FileSystemHandleImpl with FileSystemStorageConnection
+ https://bugs.webkit.org/show_bug.cgi?id=230861
+ <rdar://problem/83606465>
+
+ Reviewed by Youenn Fablet.
+
+ Introduce WorkerStorageConnection class, which dispatches StorageManager task to main-thread StorageConnection
+ and dispatches result back to worker thread.
+
+ Rebaselined existing test.
+
+ * Headers.cmake:
+ * Modules/filesystemaccess/FileSystemDirectoryHandle.cpp:
+ (WebCore::FileSystemDirectoryHandle::create):
+ (WebCore::FileSystemDirectoryHandle::FileSystemDirectoryHandle):
+ (WebCore::FileSystemDirectoryHandle::getFileHandle):
+ (WebCore::FileSystemDirectoryHandle::getDirectoryHandle):
+ (WebCore::FileSystemDirectoryHandle::removeEntry):
+ (WebCore::FileSystemDirectoryHandle::resolve):
+ * Modules/filesystemaccess/FileSystemDirectoryHandle.h:
+ * Modules/filesystemaccess/FileSystemFileHandle.cpp:
+ (WebCore::FileSystemFileHandle::create):
+ (WebCore::FileSystemFileHandle::FileSystemFileHandle):
+ * Modules/filesystemaccess/FileSystemFileHandle.h:
+ * Modules/filesystemaccess/FileSystemHandle.cpp:
+ (WebCore::FileSystemHandle::FileSystemHandle):
+ (WebCore::FileSystemHandle::isSameEntry const):
+ * Modules/filesystemaccess/FileSystemHandle.h:
+ (WebCore::FileSystemHandle::identifier const):
+ (WebCore::FileSystemHandle::connection):
+ (WebCore::FileSystemHandle::impl const): Deleted.
+ * Modules/filesystemaccess/FileSystemHandleIdentifier.h: Renamed from Source/WebKit/NetworkProcess/storage/FileSystemStorageHandleIdentifier.h.
+ * Modules/filesystemaccess/FileSystemStorageConnection.h: Renamed from Source/WebCore/Modules/filesystemaccess/FileSystemHandleImpl.h.
+ (WebCore::FileSystemStorageConnection::~FileSystemStorageConnection):
+ * Modules/storage/DummyStorageProvider.h:
+ * Modules/storage/StorageConnection.h:
+ * Modules/storage/StorageManager.cpp:
+ (WebCore::StorageManager::fileSystemAccessGetDirectory):
+ * Modules/storage/WorkerStorageConnection.cpp:
+ * WebCore.xcodeproj/project.pbxproj:
+
2021-09-29 Aditya Keerthi <[email protected]>
[css-ui] getComputedStyle() must return the specified value for '-webkit-appearance'
Modified: trunk/Source/WebCore/Headers.cmake (283270 => 283271)
--- trunk/Source/WebCore/Headers.cmake 2021-09-29 22:44:55 UTC (rev 283270)
+++ trunk/Source/WebCore/Headers.cmake 2021-09-29 22:45:23 UTC (rev 283271)
@@ -40,7 +40,8 @@
Modules/filesystemaccess/FileSystemDirectoryHandle.h
Modules/filesystemaccess/FileSystemFileHandle.h
Modules/filesystemaccess/FileSystemHandle.h
- Modules/filesystemaccess/FileSystemHandleImpl.h
+ Modules/filesystemaccess/FileSystemHandleIdentifier.h
+ Modules/filesystemaccess/FileSystemStorageConnection.h
Modules/filesystemaccess/StorageManagerFileSystemAccess.h
Modules/geolocation/Geolocation.h
Modified: trunk/Source/WebCore/Modules/filesystemaccess/FileSystemDirectoryHandle.cpp (283270 => 283271)
--- trunk/Source/WebCore/Modules/filesystemaccess/FileSystemDirectoryHandle.cpp 2021-09-29 22:44:55 UTC (rev 283270)
+++ trunk/Source/WebCore/Modules/filesystemaccess/FileSystemDirectoryHandle.cpp 2021-09-29 22:45:23 UTC (rev 283271)
@@ -26,7 +26,7 @@
#include "config.h"
#include "FileSystemDirectoryHandle.h"
-#include "FileSystemHandleImpl.h"
+#include "FileSystemStorageConnection.h"
#include "JSDOMPromiseDeferred.h"
#include "JSFileSystemDirectoryHandle.h"
#include "JSFileSystemFileHandle.h"
@@ -36,13 +36,13 @@
WTF_MAKE_ISO_ALLOCATED_IMPL(FileSystemDirectoryHandle);
-Ref<FileSystemDirectoryHandle> FileSystemDirectoryHandle::create(String&& name, Ref<FileSystemHandleImpl>&& impl)
+Ref<FileSystemDirectoryHandle> FileSystemDirectoryHandle::create(String&& name, FileSystemHandleIdentifier identifier, Ref<FileSystemStorageConnection>&& connection)
{
- return adoptRef(*new FileSystemDirectoryHandle(WTFMove(name), WTFMove(impl)));
+ return adoptRef(*new FileSystemDirectoryHandle(WTFMove(name), identifier, WTFMove(connection)));
}
-FileSystemDirectoryHandle::FileSystemDirectoryHandle(String&& name, Ref<FileSystemHandleImpl>&& impl)
- : FileSystemHandle(FileSystemHandle::Kind::Directory, WTFMove(name), WTFMove(impl))
+FileSystemDirectoryHandle::FileSystemDirectoryHandle(String&& name, FileSystemHandleIdentifier identifier, Ref<FileSystemStorageConnection>&& connection)
+ : FileSystemHandle(FileSystemHandle::Kind::Directory, WTFMove(name), identifier, WTFMove(connection))
{
}
@@ -49,11 +49,11 @@
void FileSystemDirectoryHandle::getFileHandle(const String& name, std::optional<FileSystemDirectoryHandle::GetFileOptions> options, DOMPromiseDeferred<IDLInterface<FileSystemFileHandle>>&& promise)
{
bool createIfNecessary = options ? options->create : false;
- impl().getFileHandle(name, createIfNecessary, [name, promise = WTFMove(promise)](auto result) mutable {
+ connection().getFileHandle(identifier(), name, createIfNecessary, [connection = Ref { connection() }, name, promise = WTFMove(promise)](auto result) mutable {
if (result.hasException())
return promise.reject(result.releaseException());
- promise.resolve(FileSystemFileHandle::create(String { name }, result.releaseReturnValue()));
+ promise.settle(FileSystemFileHandle::create(String { name }, result.returnValue(), WTFMove(connection)));
});
}
@@ -60,11 +60,11 @@
void FileSystemDirectoryHandle::getDirectoryHandle(const String& name, std::optional<FileSystemDirectoryHandle::GetDirectoryOptions> options, DOMPromiseDeferred<IDLInterface<FileSystemDirectoryHandle>>&& promise)
{
bool createIfNecessary = options ? options->create : false;
- impl().getDirectoryHandle(name, createIfNecessary, [name, promise = WTFMove(promise)](auto result) mutable {
+ connection().getDirectoryHandle(identifier(), name, createIfNecessary, [connection = Ref { connection() }, name, promise = WTFMove(promise)](auto result) mutable {
if (result.hasException())
return promise.reject(result.releaseException());
- promise.resolve(FileSystemDirectoryHandle::create(String { name }, result.releaseReturnValue()));
+ promise.settle(FileSystemDirectoryHandle::create(String { name }, result.returnValue(), WTFMove(connection)));
});
}
@@ -71,7 +71,7 @@
void FileSystemDirectoryHandle::removeEntry(const String& name, std::optional<FileSystemDirectoryHandle::RemoveOptions> options, DOMPromiseDeferred<void>&& promise)
{
bool deleteRecursively = options ? options->recursive : false;
- impl().removeEntry(name, deleteRecursively, [promise = WTFMove(promise)](auto result) mutable {
+ connection().removeEntry(identifier(), name, deleteRecursively, [promise = WTFMove(promise)](auto result) mutable {
promise.settle(WTFMove(result));
});
}
@@ -78,7 +78,7 @@
void FileSystemDirectoryHandle::resolve(const FileSystemHandle& handle, DOMPromiseDeferred<IDLSequence<IDLUSVString>>&& promise)
{
- impl().resolve(handle.impl(), [promise = WTFMove(promise)](auto result) mutable {
+ connection().resolve(identifier(), handle.identifier(), [promise = WTFMove(promise)](auto result) mutable {
if (result.hasException())
return promise.reject(result.releaseException());
Modified: trunk/Source/WebCore/Modules/filesystemaccess/FileSystemDirectoryHandle.h (283270 => 283271)
--- trunk/Source/WebCore/Modules/filesystemaccess/FileSystemDirectoryHandle.h 2021-09-29 22:44:55 UTC (rev 283270)
+++ trunk/Source/WebCore/Modules/filesystemaccess/FileSystemDirectoryHandle.h 2021-09-29 22:45:23 UTC (rev 283271)
@@ -46,7 +46,7 @@
bool recursive { false };
};
- WEBCORE_EXPORT static Ref<FileSystemDirectoryHandle> create(String&&, Ref<FileSystemHandleImpl>&&);
+ WEBCORE_EXPORT static Ref<FileSystemDirectoryHandle> create(String&&, FileSystemHandleIdentifier, Ref<FileSystemStorageConnection>&&);
void getFileHandle(const String& name, std::optional<GetFileOptions>, DOMPromiseDeferred<IDLInterface<FileSystemFileHandle>>&&);
void getDirectoryHandle(const String& name, std::optional<GetDirectoryOptions>, DOMPromiseDeferred<IDLInterface<FileSystemDirectoryHandle>>&&);
void removeEntry(const String& name, std::optional<RemoveOptions>, DOMPromiseDeferred<void>&&);
@@ -53,7 +53,7 @@
void resolve(const FileSystemHandle&, DOMPromiseDeferred<IDLSequence<IDLUSVString>>&&);
private:
- FileSystemDirectoryHandle(String&&, Ref<FileSystemHandleImpl>&&);
+ FileSystemDirectoryHandle(String&&, FileSystemHandleIdentifier, Ref<FileSystemStorageConnection>&&);
};
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/filesystemaccess/FileSystemFileHandle.cpp (283270 => 283271)
--- trunk/Source/WebCore/Modules/filesystemaccess/FileSystemFileHandle.cpp 2021-09-29 22:44:55 UTC (rev 283270)
+++ trunk/Source/WebCore/Modules/filesystemaccess/FileSystemFileHandle.cpp 2021-09-29 22:45:23 UTC (rev 283271)
@@ -26,7 +26,7 @@
#include "config.h"
#include "FileSystemFileHandle.h"
-#include "FileSystemHandleImpl.h"
+#include "FileSystemStorageConnection.h"
#include "JSDOMPromiseDeferred.h"
#include <wtf/IsoMallocInlines.h>
@@ -34,13 +34,13 @@
WTF_MAKE_ISO_ALLOCATED_IMPL(FileSystemFileHandle);
-Ref<FileSystemFileHandle> FileSystemFileHandle::create(String&& name, Ref<FileSystemHandleImpl>&& impl)
+Ref<FileSystemFileHandle> FileSystemFileHandle::create(String&& name, FileSystemHandleIdentifier identifier, Ref<FileSystemStorageConnection>&& connection)
{
- return adoptRef(*new FileSystemFileHandle(WTFMove(name), WTFMove(impl)));
+ return adoptRef(*new FileSystemFileHandle(WTFMove(name), identifier, WTFMove(connection)));
}
-FileSystemFileHandle::FileSystemFileHandle(String&& name, Ref<FileSystemHandleImpl>&& impl)
- : FileSystemHandle(FileSystemHandle::Kind::File, WTFMove(name), WTFMove(impl))
+FileSystemFileHandle::FileSystemFileHandle(String&& name, FileSystemHandleIdentifier identifier, Ref<FileSystemStorageConnection>&& connection)
+ : FileSystemHandle(FileSystemHandle::Kind::File, WTFMove(name), identifier, WTFMove(connection))
{
}
Modified: trunk/Source/WebCore/Modules/filesystemaccess/FileSystemFileHandle.h (283270 => 283271)
--- trunk/Source/WebCore/Modules/filesystemaccess/FileSystemFileHandle.h 2021-09-29 22:44:55 UTC (rev 283270)
+++ trunk/Source/WebCore/Modules/filesystemaccess/FileSystemFileHandle.h 2021-09-29 22:45:23 UTC (rev 283271)
@@ -34,11 +34,11 @@
class FileSystemFileHandle final : public FileSystemHandle {
WTF_MAKE_ISO_ALLOCATED(FileSystemFileHandle);
public:
- WEBCORE_EXPORT static Ref<FileSystemFileHandle> create(String&&, Ref<FileSystemHandleImpl>&&);
+ WEBCORE_EXPORT static Ref<FileSystemFileHandle> create(String&&, FileSystemHandleIdentifier, Ref<FileSystemStorageConnection>&&);
void getFile(DOMPromiseDeferred<IDLInterface<File>>&&);
private:
- FileSystemFileHandle(String&&, Ref<FileSystemHandleImpl>&&);
+ FileSystemFileHandle(String&&, FileSystemHandleIdentifier, Ref<FileSystemStorageConnection>&&);
};
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/filesystemaccess/FileSystemHandle.cpp (283270 => 283271)
--- trunk/Source/WebCore/Modules/filesystemaccess/FileSystemHandle.cpp 2021-09-29 22:44:55 UTC (rev 283270)
+++ trunk/Source/WebCore/Modules/filesystemaccess/FileSystemHandle.cpp 2021-09-29 22:45:23 UTC (rev 283271)
@@ -26,7 +26,6 @@
#include "config.h"
#include "FileSystemHandle.h"
-#include "FileSystemHandleImpl.h"
#include "JSDOMPromiseDeferred.h"
#include <wtf/IsoMallocInlines.h>
@@ -34,10 +33,11 @@
WTF_MAKE_ISO_ALLOCATED_IMPL(FileSystemHandle);
-FileSystemHandle::FileSystemHandle(FileSystemHandle::Kind kind, String&& name, Ref<FileSystemHandleImpl>&& impl)
+FileSystemHandle::FileSystemHandle(FileSystemHandle::Kind kind, String&& name, FileSystemHandleIdentifier identifier, Ref<FileSystemStorageConnection>&& connection)
: m_kind(kind)
, m_name(WTFMove(name))
- , m_impl(WTFMove(impl))
+ , m_identifier(identifier)
+ , m_connection(WTFMove(connection))
{
}
@@ -48,7 +48,7 @@
if (m_kind != handle.kind() || m_name != handle.name())
return promise.resolve(false);
- m_impl->isSameEntry(handle.impl(), [promise = WTFMove(promise)](auto result) mutable {
+ m_connection->isSameEntry(m_identifier, handle.identifier(), [promise = WTFMove(promise)](auto result) mutable {
promise.settle(WTFMove(result));
});
}
Modified: trunk/Source/WebCore/Modules/filesystemaccess/FileSystemHandle.h (283270 => 283271)
--- trunk/Source/WebCore/Modules/filesystemaccess/FileSystemHandle.h 2021-09-29 22:44:55 UTC (rev 283270)
+++ trunk/Source/WebCore/Modules/filesystemaccess/FileSystemHandle.h 2021-09-29 22:45:23 UTC (rev 283271)
@@ -25,6 +25,7 @@
#pragma once
+#include "FileSystemHandleIdentifier.h"
#include "IDLTypes.h"
#include <wtf/IsoMalloc.h>
@@ -32,7 +33,7 @@
template<typename> class DOMPromiseDeferred;
-class FileSystemHandleImpl;
+class FileSystemStorageConnection;
enum class PermissionState : uint8_t;
class FileSystemHandle : public RefCounted<FileSystemHandle> {
@@ -46,17 +47,19 @@
};
Kind kind() const { return m_kind; }
const String& name() const { return m_name; }
- FileSystemHandleImpl& impl() const { return m_impl.get(); }
+ FileSystemHandleIdentifier identifier() const { return m_identifier; }
void isSameEntry(FileSystemHandle&, DOMPromiseDeferred<IDLBoolean>&&) const;
protected:
- FileSystemHandle(Kind, String&& name, Ref<FileSystemHandleImpl>&&);
+ FileSystemHandle(Kind, String&& name, FileSystemHandleIdentifier, Ref<FileSystemStorageConnection>&&);
+ FileSystemStorageConnection& connection() { return m_connection.get(); }
private:
Kind m_kind { Kind::File };
String m_name;
- Ref<FileSystemHandleImpl> m_impl;
+ FileSystemHandleIdentifier m_identifier;
+ Ref<FileSystemStorageConnection> m_connection;
};
} // namespace WebCore
Copied: trunk/Source/WebCore/Modules/filesystemaccess/FileSystemHandleIdentifier.h (from rev 283270, trunk/Source/WebKit/NetworkProcess/storage/FileSystemStorageHandleIdentifier.h) (0 => 283271)
--- trunk/Source/WebCore/Modules/filesystemaccess/FileSystemHandleIdentifier.h (rev 0)
+++ trunk/Source/WebCore/Modules/filesystemaccess/FileSystemHandleIdentifier.h 2021-09-29 22:45:23 UTC (rev 283271)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <wtf/ObjectIdentifier.h>
+
+namespace WebCore {
+
+enum FileSystemHandleIdentifierType { };
+using FileSystemHandleIdentifier = ObjectIdentifier<FileSystemHandleIdentifierType>;
+
+} // namespace WebCore
Deleted: trunk/Source/WebCore/Modules/filesystemaccess/FileSystemHandleImpl.h (283270 => 283271)
--- trunk/Source/WebCore/Modules/filesystemaccess/FileSystemHandleImpl.h 2021-09-29 22:44:55 UTC (rev 283270)
+++ trunk/Source/WebCore/Modules/filesystemaccess/FileSystemHandleImpl.h 2021-09-29 22:45:23 UTC (rev 283271)
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2021 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <wtf/CompletionHandler.h>
-
-namespace WebCore {
-
-class FileSystemDirectoryHandle;
-class FileSystemFileHandle;
-template<typename> class ExceptionOr;
-
-class FileSystemHandleImpl : public RefCounted<FileSystemHandleImpl> {
-public:
- virtual ~FileSystemHandleImpl() { }
- virtual std::optional<uint64_t> storageHandleIdentifier() = 0;
- virtual void isSameEntry(FileSystemHandleImpl&, CompletionHandler<void(ExceptionOr<bool>&&)>&&) = 0;
- virtual void getFileHandle(const String& name, bool createIfNecessary, CompletionHandler<void(ExceptionOr<Ref<FileSystemHandleImpl>>&&)>&&) = 0;
- virtual void getDirectoryHandle(const String& name, bool createIfNecessary, CompletionHandler<void(ExceptionOr<Ref<FileSystemHandleImpl>>&&)>&&) = 0;
- virtual void removeEntry(const String& name, bool recursive, CompletionHandler<void(ExceptionOr<void>&&)>&&) = 0;
- virtual void resolve(FileSystemHandleImpl&, CompletionHandler<void(ExceptionOr<Vector<String>>&&)>&&) = 0;
-};
-
-} // namespace WebCore
Copied: trunk/Source/WebCore/Modules/filesystemaccess/FileSystemStorageConnection.h (from rev 283270, trunk/Source/WebCore/Modules/filesystemaccess/FileSystemHandleImpl.h) (0 => 283271)
--- trunk/Source/WebCore/Modules/filesystemaccess/FileSystemStorageConnection.h (rev 0)
+++ trunk/Source/WebCore/Modules/filesystemaccess/FileSystemStorageConnection.h 2021-09-29 22:45:23 UTC (rev 283271)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "FileSystemHandleIdentifier.h"
+#include <wtf/CompletionHandler.h>
+#include <wtf/ThreadSafeRefCounted.h>
+
+namespace WebCore {
+
+class FileSystemDirectoryHandle;
+class FileSystemFileHandle;
+template<typename> class ExceptionOr;
+
+class FileSystemStorageConnection : public ThreadSafeRefCounted<FileSystemStorageConnection> {
+public:
+ virtual ~FileSystemStorageConnection() { }
+ using SameEntryCallback = CompletionHandler<void(ExceptionOr<bool>&&)>;
+ using GetHandleCallback = CompletionHandler<void(ExceptionOr<FileSystemHandleIdentifier>&&)>;
+ using RemoveEntryCallback = CompletionHandler<void(ExceptionOr<void>&&)>;
+ using ResolveCallback = CompletionHandler<void(ExceptionOr<Vector<String>>&&)>;
+ virtual void isSameEntry(FileSystemHandleIdentifier, FileSystemHandleIdentifier, SameEntryCallback&&) = 0;
+ virtual void getFileHandle(FileSystemHandleIdentifier, const String& name, bool createIfNecessary, GetHandleCallback&&) = 0;
+ virtual void getDirectoryHandle(FileSystemHandleIdentifier, const String& name, bool createIfNecessary, GetHandleCallback&&) = 0;
+ virtual void removeEntry(FileSystemHandleIdentifier, const String& name, bool deleteRecursively, RemoveEntryCallback&&) = 0;
+ virtual void resolve(FileSystemHandleIdentifier, FileSystemHandleIdentifier, ResolveCallback&&) = 0;
+};
+
+} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/storage/DummyStorageProvider.h (283270 => 283271)
--- trunk/Source/WebCore/Modules/storage/DummyStorageProvider.h 2021-09-29 22:44:55 UTC (rev 283270)
+++ trunk/Source/WebCore/Modules/storage/DummyStorageProvider.h 2021-09-29 22:45:23 UTC (rev 283271)
@@ -25,7 +25,7 @@
#pragma once
-#include "FileSystemHandleImpl.h"
+#include "FileSystemStorageConnection.h"
#include "StorageProvider.h"
namespace WebCore {
Modified: trunk/Source/WebCore/Modules/storage/StorageConnection.h (283270 => 283271)
--- trunk/Source/WebCore/Modules/storage/StorageConnection.h 2021-09-29 22:44:55 UTC (rev 283270)
+++ trunk/Source/WebCore/Modules/storage/StorageConnection.h 2021-09-29 22:45:23 UTC (rev 283271)
@@ -25,12 +25,13 @@
#pragma once
+#include "FileSystemHandleIdentifier.h"
#include <wtf/CompletionHandler.h>
#include <wtf/ThreadSafeRefCounted.h>
namespace WebCore {
-class FileSystemHandleImpl;
+class FileSystemStorageConnection;
template<typename> class ExceptionOr;
struct ClientOrigin;
@@ -40,7 +41,7 @@
using PersistCallback = CompletionHandler<void(bool)>;
virtual void getPersisted(const ClientOrigin&, PersistCallback&&) = 0;
virtual void persist(const ClientOrigin&, PersistCallback&& completionHandler) { completionHandler(false); }
- using GetDirectoryCallback = CompletionHandler<void(ExceptionOr<Ref<FileSystemHandleImpl>>&&)>;
+ using GetDirectoryCallback = CompletionHandler<void(ExceptionOr<std::pair<FileSystemHandleIdentifier, RefPtr<FileSystemStorageConnection>>>)>;
virtual void fileSystemGetDirectory(const ClientOrigin&, GetDirectoryCallback&&) = 0;
};
Modified: trunk/Source/WebCore/Modules/storage/StorageManager.cpp (283270 => 283271)
--- trunk/Source/WebCore/Modules/storage/StorageManager.cpp 2021-09-29 22:44:55 UTC (rev 283270)
+++ trunk/Source/WebCore/Modules/storage/StorageManager.cpp 2021-09-29 22:45:23 UTC (rev 283271)
@@ -30,7 +30,7 @@
#include "Document.h"
#include "ExceptionOr.h"
#include "FileSystemDirectoryHandle.h"
-#include "FileSystemHandleImpl.h"
+#include "FileSystemStorageConnection.h"
#include "JSDOMPromiseDeferred.h"
#include "JSFileSystemDirectoryHandle.h"
#include "NavigatorBase.h"
@@ -119,7 +119,8 @@
if (result.hasException())
return promise.reject(result.releaseException());
- promise.resolve(FileSystemDirectoryHandle::create({ }, result.releaseReturnValue()));
+ auto identifierConnectionPair = result.releaseReturnValue();
+ promise.resolve(FileSystemDirectoryHandle::create({ }, identifierConnectionPair.first, Ref { * identifierConnectionPair.second }));
});
}
Modified: trunk/Source/WebCore/Modules/storage/WorkerStorageConnection.cpp (283270 => 283271)
--- trunk/Source/WebCore/Modules/storage/WorkerStorageConnection.cpp 2021-09-29 22:44:55 UTC (rev 283270)
+++ trunk/Source/WebCore/Modules/storage/WorkerStorageConnection.cpp 2021-09-29 22:45:23 UTC (rev 283271)
@@ -27,7 +27,6 @@
#include "WorkerStorageConnection.h"
#include "ClientOrigin.h"
-#include "FileSystemHandleImpl.h"
#include "WorkerGlobalScope.h"
#include "WorkerLoaderProxy.h"
#include "WorkerThread.h"
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (283270 => 283271)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-09-29 22:44:55 UTC (rev 283270)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-09-29 22:45:23 UTC (rev 283271)
@@ -2807,7 +2807,6 @@
930AAC9A250EB8490013DA9F /* CSSConditionRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 930AAC98250EB8170013DA9F /* CSSConditionRule.h */; settings = {ATTRIBUTES = (Private, ); }; };
930AAC9F250ED4090013DA9F /* JSCSSConditionRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 930AAC9D250ED4090013DA9F /* JSCSSConditionRule.h */; };
930AACA2250ED4110013DA9F /* JSCSSGroupingRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 930AACA0250ED4110013DA9F /* JSCSSGroupingRule.h */; };
- 9312BAD926F3AC9A00FDDF5F /* FileSystemHandleImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 931A075826F1B44F004474CD /* FileSystemHandleImpl.h */; settings = {ATTRIBUTES = (Private, ); }; };
93153BDA14181F7A00FCF5BE /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 93153BD914181F7A00FCF5BE /* [email protected] */; };
93153BDC141959BC00FCF5BE /* textAreaResizeCorner.png in Resources */ = {isa = PBXBuildFile; fileRef = 93153BDB141959BB00FCF5BE /* textAreaResizeCorner.png */; };
93153BE214195A5700FCF5BE /* missingImage.png in Resources */ = {isa = PBXBuildFile; fileRef = 93153BE114195A5700FCF5BE /* missingImage.png */; };
@@ -2877,6 +2876,8 @@
934F713C0D5A6F1900018D69 /* ResourceErrorBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 934F713B0D5A6F1900018D69 /* ResourceErrorBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
93500F3213FDE3BE0099EC24 /* NSScrollerImpDetails.h in Headers */ = {isa = PBXBuildFile; fileRef = 93500F3113FDE3BE0099EC24 /* NSScrollerImpDetails.h */; settings = {ATTRIBUTES = (Private, ); }; };
935207BE09BD410A00F2038D /* LocalizedStrings.h in Headers */ = {isa = PBXBuildFile; fileRef = 935207BD09BD410A00F2038D /* LocalizedStrings.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 9354242F2703CA51005CA72C /* FileSystemHandleIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 935424272703BC88005CA72C /* FileSystemHandleIdentifier.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 935424302703CB86005CA72C /* FileSystemStorageConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 935424292703BCAD005CA72C /* FileSystemStorageConnection.h */; settings = {ATTRIBUTES = (Private, ); }; };
9355EF51253A4279006FF4A4 /* JSAbstractRange.h in Headers */ = {isa = PBXBuildFile; fileRef = 9355EF4F253A4278006FF4A4 /* JSAbstractRange.h */; settings = {ATTRIBUTES = (Private, ); }; };
935C476309AC4CE600A6AAB4 /* MouseEventWithHitTestResults.h in Headers */ = {isa = PBXBuildFile; fileRef = 935C476209AC4CE600A6AAB4 /* MouseEventWithHitTestResults.h */; };
935C476809AC4D4300A6AAB4 /* PlatformKeyboardEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 935C476609AC4D4300A6AAB4 /* PlatformKeyboardEvent.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -11677,7 +11678,6 @@
9316DDF8240C64B3009340AA /* SimpleRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleRange.h; sourceTree = "<group>"; };
9316DDFA240C64B3009340AA /* SimpleRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SimpleRange.cpp; sourceTree = "<group>"; };
9316DDFE240C64F8009340AA /* BoundaryPoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BoundaryPoint.h; sourceTree = "<group>"; };
- 931A075826F1B44F004474CD /* FileSystemHandleImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileSystemHandleImpl.h; sourceTree = "<group>"; };
931A1BDD26F7ED090081A7E5 /* JSFileSystemHandleCustom.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSFileSystemHandleCustom.cpp; sourceTree = "<group>"; };
931AE3B81FB80EAE00F5EFB2 /* JSValueInWrappedObject.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSValueInWrappedObject.h; sourceTree = "<group>"; };
931BCC601124DFCB00BE70DD /* MediaCanStartListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaCanStartListener.h; sourceTree = "<group>"; };
@@ -11823,6 +11823,8 @@
93500F3113FDE3BE0099EC24 /* NSScrollerImpDetails.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSScrollerImpDetails.h; sourceTree = "<group>"; };
935207BD09BD410A00F2038D /* LocalizedStrings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalizedStrings.h; sourceTree = "<group>"; };
9353676A09AED88B00D35CD6 /* ScrollViewMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ScrollViewMac.mm; sourceTree = "<group>"; };
+ 935424272703BC88005CA72C /* FileSystemHandleIdentifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileSystemHandleIdentifier.h; sourceTree = "<group>"; };
+ 935424292703BCAD005CA72C /* FileSystemStorageConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileSystemStorageConnection.h; sourceTree = "<group>"; };
9355EF4F253A4278006FF4A4 /* JSAbstractRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAbstractRange.h; sourceTree = "<group>"; };
9355EF50253A4279006FF4A4 /* JSAbstractRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAbstractRange.cpp; sourceTree = "<group>"; };
9355EF53253A4D5A006FF4A4 /* JSAbstractRangeCustom.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSAbstractRangeCustom.cpp; sourceTree = "<group>"; };
@@ -23380,7 +23382,8 @@
932C9BD026DD62550053B3DB /* FileSystemHandle.cpp */,
932C9BDA26DD62610053B3DB /* FileSystemHandle.h */,
932C9BD926DD62600053B3DB /* FileSystemHandle.idl */,
- 931A075826F1B44F004474CD /* FileSystemHandleImpl.h */,
+ 935424272703BC88005CA72C /* FileSystemHandleIdentifier.h */,
+ 935424292703BCAD005CA72C /* FileSystemStorageConnection.h */,
93443E7B26E8A6BC0058538F /* StorageManager+FileSystemAccess.idl */,
93443E7D26E8A6BC0058538F /* StorageManagerFileSystemAccess.h */,
);
@@ -32486,7 +32489,8 @@
83FB33751F508A5B00986E54 /* FileSystemFileEntry.h in Headers */,
93443E8726E995C00058538F /* FileSystemFileHandle.h in Headers */,
93443E8826E995C40058538F /* FileSystemHandle.h in Headers */,
- 9312BAD926F3AC9A00FDDF5F /* FileSystemHandleImpl.h in Headers */,
+ 9354242F2703CA51005CA72C /* FileSystemHandleIdentifier.h in Headers */,
+ 935424302703CB86005CA72C /* FileSystemStorageConnection.h in Headers */,
BC5EB69F0E81DAEB00B25965 /* FillLayer.h in Headers */,
712BE4831FE865DD002031CC /* FillMode.h in Headers */,
845E72F80FD261EE00A87D79 /* Filter.h in Headers */,
Modified: trunk/Source/WebKit/ChangeLog (283270 => 283271)
--- trunk/Source/WebKit/ChangeLog 2021-09-29 22:44:55 UTC (rev 283270)
+++ trunk/Source/WebKit/ChangeLog 2021-09-29 22:45:23 UTC (rev 283271)
@@ -1,3 +1,64 @@
+2021-09-29 Sihui Liu <[email protected]>
+
+ Replace FileSystemHandleImpl with FileSystemStorageConnection
+ https://bugs.webkit.org/show_bug.cgi?id=230861
+ <rdar://problem/83606465>
+
+ Reviewed by Youenn Fablet.
+
+ Replace FileSystemStorageHandleProxy with WebFileSystemStorageConnection.
+
+ * NetworkProcess/storage/FileSystemStorageHandle.cpp:
+ (WebKit::FileSystemStorageHandle::FileSystemStorageHandle):
+ (WebKit::FileSystemStorageHandle::isSameEntry):
+ (WebKit::FileSystemStorageHandle::requestCreateHandle):
+ (WebKit::FileSystemStorageHandle::getFileHandle):
+ (WebKit::FileSystemStorageHandle::getDirectoryHandle):
+ (WebKit::FileSystemStorageHandle::resolve):
+ * NetworkProcess/storage/FileSystemStorageHandle.h:
+ (WebKit::FileSystemStorageHandle::identifier const):
+ * NetworkProcess/storage/FileSystemStorageHandleRegistry.cpp:
+ (WebKit::FileSystemStorageHandleRegistry::registerHandle):
+ (WebKit::FileSystemStorageHandleRegistry::unregisterHandle):
+ (WebKit::FileSystemStorageHandleRegistry::getHandle):
+ * NetworkProcess/storage/FileSystemStorageHandleRegistry.h:
+ * NetworkProcess/storage/FileSystemStorageManager.cpp:
+ (WebKit::FileSystemStorageManager::createHandle):
+ (WebKit::FileSystemStorageManager::getPath):
+ (WebKit::FileSystemStorageManager::getDirectory):
+ * NetworkProcess/storage/FileSystemStorageManager.h:
+ * NetworkProcess/storage/NetworkStorageManager.cpp:
+ (WebKit::NetworkStorageManager::fileSystemGetDirectory):
+ (WebKit::NetworkStorageManager::isSameEntry):
+ (WebKit::NetworkStorageManager::getFileHandle):
+ (WebKit::NetworkStorageManager::getDirectoryHandle):
+ (WebKit::NetworkStorageManager::removeEntry):
+ (WebKit::NetworkStorageManager::resolve):
+ * NetworkProcess/storage/NetworkStorageManager.h:
+ * NetworkProcess/storage/NetworkStorageManager.messages.in:
+ * NetworkProcess/storage/OriginStorageManager.h:
+ * Scripts/webkit/messages.py:
+ (types_that_cannot_be_forward_declared):
+ * Sources.txt:
+ * WebKit.xcodeproj/project.pbxproj:
+ * WebProcess/WebCoreSupport/WebFileSystemStorageConnection.cpp: Renamed from Source/WebKit/WebProcess/WebCoreSupport/FileSystemStorageHandleProxy.cpp.
+ (WebKit::WebFileSystemStorageConnection::create):
+ (WebKit::WebFileSystemStorageConnection::WebFileSystemStorageConnection):
+ (WebKit::WebFileSystemStorageConnection::connectionClosed):
+ (WebKit::WebFileSystemStorageConnection::isSameEntry):
+ (WebKit::WebFileSystemStorageConnection::getFileHandle):
+ (WebKit::WebFileSystemStorageConnection::getDirectoryHandle):
+ (WebKit::WebFileSystemStorageConnection::removeEntry):
+ (WebKit::WebFileSystemStorageConnection::resolve):
+ * WebProcess/WebCoreSupport/WebFileSystemStorageConnection.h: Renamed from Source/WebKit/WebProcess/WebCoreSupport/FileSystemStorageHandleProxy.h.
+ * WebProcess/WebCoreSupport/WebStorageConnection.cpp:
+ (WebKit::WebStorageConnection::persist):
+ (WebKit::WebStorageConnection::fileSystemGetDirectory):
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::networkProcessConnectionClosed):
+ (WebKit::WebProcess::fileSystemStorageConnection):
+ * WebProcess/WebProcess.h:
+
2021-09-29 Per Arne <[email protected]>
Add telemetry to the Networking process sandbox
Modified: trunk/Source/WebKit/NetworkProcess/storage/FileSystemStorageHandle.cpp (283270 => 283271)
--- trunk/Source/WebKit/NetworkProcess/storage/FileSystemStorageHandle.cpp 2021-09-29 22:44:55 UTC (rev 283270)
+++ trunk/Source/WebKit/NetworkProcess/storage/FileSystemStorageHandle.cpp 2021-09-29 22:45:23 UTC (rev 283271)
@@ -38,7 +38,7 @@
#endif
FileSystemStorageHandle::FileSystemStorageHandle(FileSystemStorageManager& manager, Type type, String&& path, String&& name)
- : m_identifier(FileSystemStorageHandleIdentifier::generateThreadSafe())
+ : m_identifier(WebCore::FileSystemHandleIdentifier::generateThreadSafe())
, m_manager(makeWeakPtr(manager))
, m_type(type)
, m_path(WTFMove(path))
@@ -58,7 +58,7 @@
}
}
-bool FileSystemStorageHandle::isSameEntry(FileSystemStorageHandleIdentifier identifier)
+bool FileSystemStorageHandle::isSameEntry(WebCore::FileSystemHandleIdentifier identifier)
{
auto path = m_manager->getPath(identifier);
if (path.isEmpty())
@@ -67,7 +67,7 @@
return m_path == path;
}
-Expected<FileSystemStorageHandleIdentifier, FileSystemStorageError> FileSystemStorageHandle::requestCreateHandle(IPC::Connection::UniqueID connection, Type type, String&& name, bool createIfNecessary)
+Expected<WebCore::FileSystemHandleIdentifier, FileSystemStorageError> FileSystemStorageHandle::requestCreateHandle(IPC::Connection::UniqueID connection, Type type, String&& name, bool createIfNecessary)
{
if (m_type != FileSystemStorageHandle::Type::Directory)
return makeUnexpected(FileSystemStorageError::TypeMismatch);
@@ -83,12 +83,12 @@
return m_manager->createHandle(connection, type, WTFMove(path), WTFMove(name), createIfNecessary);
}
-Expected<FileSystemStorageHandleIdentifier, FileSystemStorageError> FileSystemStorageHandle::getFileHandle(IPC::Connection::UniqueID connection, String&& name, bool createIfNecessary)
+Expected<WebCore::FileSystemHandleIdentifier, FileSystemStorageError> FileSystemStorageHandle::getFileHandle(IPC::Connection::UniqueID connection, String&& name, bool createIfNecessary)
{
return requestCreateHandle(connection, FileSystemStorageHandle::Type::File, WTFMove(name), createIfNecessary);
}
-Expected<FileSystemStorageHandleIdentifier, FileSystemStorageError> FileSystemStorageHandle::getDirectoryHandle(IPC::Connection::UniqueID connection, String&& name, bool createIfNecessary)
+Expected<WebCore::FileSystemHandleIdentifier, FileSystemStorageError> FileSystemStorageHandle::getDirectoryHandle(IPC::Connection::UniqueID connection, String&& name, bool createIfNecessary)
{
return requestCreateHandle(connection, FileSystemStorageHandle::Type::Directory, WTFMove(name), createIfNecessary);
}
@@ -123,7 +123,7 @@
return result;
}
-Expected<Vector<String>, FileSystemStorageError> FileSystemStorageHandle::resolve(FileSystemStorageHandleIdentifier identifier)
+Expected<Vector<String>, FileSystemStorageError> FileSystemStorageHandle::resolve(WebCore::FileSystemHandleIdentifier identifier)
{
if (!m_manager)
return makeUnexpected(FileSystemStorageError::Unknown);
Modified: trunk/Source/WebKit/NetworkProcess/storage/FileSystemStorageHandle.h (283270 => 283271)
--- trunk/Source/WebKit/NetworkProcess/storage/FileSystemStorageHandle.h 2021-09-29 22:44:55 UTC (rev 283270)
+++ trunk/Source/WebKit/NetworkProcess/storage/FileSystemStorageHandle.h 2021-09-29 22:45:23 UTC (rev 283271)
@@ -26,8 +26,7 @@
#pragma once
#include "Connection.h"
-#include "FileSystemStorageHandleIdentifier.h"
-
+#include <WebCore/FileSystemHandleIdentifier.h>
#include <wtf/WeakPtr.h>
namespace WebKit {
@@ -41,19 +40,19 @@
enum class Type : bool { File, Directory };
FileSystemStorageHandle(FileSystemStorageManager&, Type, String&& path, String&& name);
- FileSystemStorageHandleIdentifier identifier() const { return m_identifier; }
+ WebCore::FileSystemHandleIdentifier identifier() const { return m_identifier; }
const String& path() const { return m_path; }
- bool isSameEntry(FileSystemStorageHandleIdentifier);
- Expected<FileSystemStorageHandleIdentifier, FileSystemStorageError> getFileHandle(IPC::Connection::UniqueID, String&& name, bool createIfNecessary);
- Expected<FileSystemStorageHandleIdentifier, FileSystemStorageError> getDirectoryHandle(IPC::Connection::UniqueID, String&& name, bool createIfNecessary);
+ bool isSameEntry(WebCore::FileSystemHandleIdentifier);
+ Expected<WebCore::FileSystemHandleIdentifier, FileSystemStorageError> getFileHandle(IPC::Connection::UniqueID, String&& name, bool createIfNecessary);
+ Expected<WebCore::FileSystemHandleIdentifier, FileSystemStorageError> getDirectoryHandle(IPC::Connection::UniqueID, String&& name, bool createIfNecessary);
std::optional<FileSystemStorageError> removeEntry(const String& name, bool deleteRecursively);
- Expected<Vector<String>, FileSystemStorageError> resolve(FileSystemStorageHandleIdentifier);
+ Expected<Vector<String>, FileSystemStorageError> resolve(WebCore::FileSystemHandleIdentifier);
private:
- Expected<FileSystemStorageHandleIdentifier, FileSystemStorageError> requestCreateHandle(IPC::Connection::UniqueID, Type, String&& name, bool createIfNecessary);
+ Expected<WebCore::FileSystemHandleIdentifier, FileSystemStorageError> requestCreateHandle(IPC::Connection::UniqueID, Type, String&& name, bool createIfNecessary);
- FileSystemStorageHandleIdentifier m_identifier;
+ WebCore::FileSystemHandleIdentifier m_identifier;
WeakPtr<FileSystemStorageManager> m_manager;
Type m_type;
String m_path;
Deleted: trunk/Source/WebKit/NetworkProcess/storage/FileSystemStorageHandleIdentifier.h (283270 => 283271)
--- trunk/Source/WebKit/NetworkProcess/storage/FileSystemStorageHandleIdentifier.h 2021-09-29 22:44:55 UTC (rev 283270)
+++ trunk/Source/WebKit/NetworkProcess/storage/FileSystemStorageHandleIdentifier.h 2021-09-29 22:45:23 UTC (rev 283271)
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2021 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <wtf/ObjectIdentifier.h>
-
-namespace WebKit {
-
-enum FileSystemStorageHandleIdentifierType { };
-using FileSystemStorageHandleIdentifier = ObjectIdentifier<FileSystemStorageHandleIdentifierType>;
-
-} // namespace WebKit
Modified: trunk/Source/WebKit/NetworkProcess/storage/FileSystemStorageHandleRegistry.cpp (283270 => 283271)
--- trunk/Source/WebKit/NetworkProcess/storage/FileSystemStorageHandleRegistry.cpp 2021-09-29 22:44:55 UTC (rev 283270)
+++ trunk/Source/WebKit/NetworkProcess/storage/FileSystemStorageHandleRegistry.cpp 2021-09-29 22:45:23 UTC (rev 283271)
@@ -32,7 +32,7 @@
FileSystemStorageHandleRegistry::FileSystemStorageHandleRegistry() = default;
-void FileSystemStorageHandleRegistry::registerHandle(FileSystemStorageHandleIdentifier identifier, FileSystemStorageHandle& handle)
+void FileSystemStorageHandleRegistry::registerHandle(WebCore::FileSystemHandleIdentifier identifier, FileSystemStorageHandle& handle)
{
ASSERT(!m_handles.contains(identifier));
@@ -39,7 +39,7 @@
m_handles.add(identifier, makeWeakPtr(handle));
}
-void FileSystemStorageHandleRegistry::unregisterHandle(FileSystemStorageHandleIdentifier identifier)
+void FileSystemStorageHandleRegistry::unregisterHandle(WebCore::FileSystemHandleIdentifier identifier)
{
ASSERT(m_handles.contains(identifier));
@@ -46,7 +46,7 @@
m_handles.remove(identifier);
}
-FileSystemStorageHandle* FileSystemStorageHandleRegistry::getHandle(FileSystemStorageHandleIdentifier identifier)
+FileSystemStorageHandle* FileSystemStorageHandleRegistry::getHandle(WebCore::FileSystemHandleIdentifier identifier)
{
if (auto handle = m_handles.get(identifier))
return handle.get();
Modified: trunk/Source/WebKit/NetworkProcess/storage/FileSystemStorageHandleRegistry.h (283270 => 283271)
--- trunk/Source/WebKit/NetworkProcess/storage/FileSystemStorageHandleRegistry.h 2021-09-29 22:44:55 UTC (rev 283270)
+++ trunk/Source/WebKit/NetworkProcess/storage/FileSystemStorageHandleRegistry.h 2021-09-29 22:45:23 UTC (rev 283271)
@@ -26,7 +26,7 @@
#pragma once
#include "Connection.h"
-#include "FileSystemStorageHandleIdentifier.h"
+#include <WebCore/FileSystemHandleIdentifier.h>
#include <wtf/WeakPtr.h>
namespace WebKit {
@@ -37,12 +37,12 @@
WTF_MAKE_FAST_ALLOCATED;
public:
FileSystemStorageHandleRegistry();
- void registerHandle(FileSystemStorageHandleIdentifier, FileSystemStorageHandle&);
- void unregisterHandle(FileSystemStorageHandleIdentifier);
- FileSystemStorageHandle* getHandle(FileSystemStorageHandleIdentifier);
+ void registerHandle(WebCore::FileSystemHandleIdentifier, FileSystemStorageHandle&);
+ void unregisterHandle(WebCore::FileSystemHandleIdentifier);
+ FileSystemStorageHandle* getHandle(WebCore::FileSystemHandleIdentifier);
private:
- HashMap<FileSystemStorageHandleIdentifier, WeakPtr<FileSystemStorageHandle>> m_handles;
+ HashMap<WebCore::FileSystemHandleIdentifier, WeakPtr<FileSystemStorageHandle>> m_handles;
};
} // namespace WebKit
Modified: trunk/Source/WebKit/NetworkProcess/storage/FileSystemStorageManager.cpp (283270 => 283271)
--- trunk/Source/WebKit/NetworkProcess/storage/FileSystemStorageManager.cpp 2021-09-29 22:44:55 UTC (rev 283270)
+++ trunk/Source/WebKit/NetworkProcess/storage/FileSystemStorageManager.cpp 2021-09-29 22:45:23 UTC (rev 283271)
@@ -46,7 +46,7 @@
m_registry.unregisterHandle(identifier);
}
-Expected<FileSystemStorageHandleIdentifier, FileSystemStorageError> FileSystemStorageManager::createHandle(IPC::Connection::UniqueID connection, FileSystemStorageHandle::Type type, String&& path, String&& name, bool createIfNecessary)
+Expected<WebCore::FileSystemHandleIdentifier, FileSystemStorageError> FileSystemStorageManager::createHandle(IPC::Connection::UniqueID connection, FileSystemStorageHandle::Type type, String&& path, String&& name, bool createIfNecessary)
{
ASSERT(!RunLoop::isMain());
@@ -70,7 +70,7 @@
auto newHandle = makeUnique<FileSystemStorageHandle>(*this, type, WTFMove(path), WTFMove(name));
auto newHandleIdentifier = newHandle->identifier();
m_handlesByConnection.ensure(connection, [&] {
- return HashSet<FileSystemStorageHandleIdentifier> { };
+ return HashSet<WebCore::FileSystemHandleIdentifier> { };
}).iterator->value.add(newHandleIdentifier);
m_registry.registerHandle(newHandleIdentifier, *newHandle);
m_handles.add(newHandleIdentifier, WTFMove(newHandle));
@@ -77,7 +77,7 @@
return newHandleIdentifier;
}
-const String& FileSystemStorageManager::getPath(FileSystemStorageHandleIdentifier identifier)
+const String& FileSystemStorageManager::getPath(WebCore::FileSystemHandleIdentifier identifier)
{
auto handle = m_handles.find(identifier);
return handle == m_handles.end() ? emptyString() : handle->value->path();
@@ -98,7 +98,7 @@
m_handlesByConnection.remove(handles);
}
-Expected<FileSystemStorageHandleIdentifier, FileSystemStorageError> FileSystemStorageManager::getDirectory(IPC::Connection::UniqueID connection)
+Expected<WebCore::FileSystemHandleIdentifier, FileSystemStorageError> FileSystemStorageManager::getDirectory(IPC::Connection::UniqueID connection)
{
ASSERT(!RunLoop::isMain());
Modified: trunk/Source/WebKit/NetworkProcess/storage/FileSystemStorageManager.h (283270 => 283271)
--- trunk/Source/WebKit/NetworkProcess/storage/FileSystemStorageManager.h 2021-09-29 22:44:55 UTC (rev 283270)
+++ trunk/Source/WebKit/NetworkProcess/storage/FileSystemStorageManager.h 2021-09-29 22:45:23 UTC (rev 283271)
@@ -26,7 +26,7 @@
#pragma once
#include "FileSystemStorageHandle.h"
-#include "FileSystemStorageHandleIdentifier.h"
+#include <WebCore/FileSystemHandleIdentifier.h>
namespace WebKit {
@@ -39,16 +39,16 @@
FileSystemStorageManager(String&& path, FileSystemStorageHandleRegistry&);
~FileSystemStorageManager();
- Expected<FileSystemStorageHandleIdentifier, FileSystemStorageError> createHandle(IPC::Connection::UniqueID, FileSystemStorageHandle::Type, String&& path, String&& name, bool createIfNecessary);
- const String& getPath(FileSystemStorageHandleIdentifier);
+ Expected<WebCore::FileSystemHandleIdentifier, FileSystemStorageError> createHandle(IPC::Connection::UniqueID, FileSystemStorageHandle::Type, String&& path, String&& name, bool createIfNecessary);
+ const String& getPath(WebCore::FileSystemHandleIdentifier);
void connectionClosed(IPC::Connection::UniqueID);
- Expected<FileSystemStorageHandleIdentifier, FileSystemStorageError> getDirectory(IPC::Connection::UniqueID);
+ Expected<WebCore::FileSystemHandleIdentifier, FileSystemStorageError> getDirectory(IPC::Connection::UniqueID);
private:
String m_path;
FileSystemStorageHandleRegistry& m_registry;
- HashMap<IPC::Connection::UniqueID, HashSet<FileSystemStorageHandleIdentifier>> m_handlesByConnection;
- HashMap<FileSystemStorageHandleIdentifier, std::unique_ptr<FileSystemStorageHandle>> m_handles;
+ HashMap<IPC::Connection::UniqueID, HashSet<WebCore::FileSystemHandleIdentifier>> m_handlesByConnection;
+ HashMap<WebCore::FileSystemHandleIdentifier, std::unique_ptr<FileSystemStorageHandle>> m_handles;
};
} // namespace WebKit
Modified: trunk/Source/WebKit/NetworkProcess/storage/NetworkStorageManager.cpp (283270 => 283271)
--- trunk/Source/WebKit/NetworkProcess/storage/NetworkStorageManager.cpp 2021-09-29 22:44:55 UTC (rev 283270)
+++ trunk/Source/WebKit/NetworkProcess/storage/NetworkStorageManager.cpp 2021-09-29 22:45:23 UTC (rev 283271)
@@ -164,7 +164,7 @@
});
}
-void NetworkStorageManager::fileSystemGetDirectory(IPC::Connection& connection, const WebCore::ClientOrigin& origin, CompletionHandler<void(Expected<FileSystemStorageHandleIdentifier, FileSystemStorageError>)>&& completionHandler)
+void NetworkStorageManager::fileSystemGetDirectory(IPC::Connection& connection, const WebCore::ClientOrigin& origin, CompletionHandler<void(Expected<WebCore::FileSystemHandleIdentifier, FileSystemStorageError>)>&& completionHandler)
{
ASSERT(!RunLoop::isMain());
@@ -171,7 +171,7 @@
completionHandler(localOriginStorageManager(origin).fileSystemStorageManager(*m_fileSystemStorageHandleRegistry).getDirectory(connection.uniqueID()));
}
-void NetworkStorageManager::isSameEntry(FileSystemStorageHandleIdentifier identifier, FileSystemStorageHandleIdentifier targetIdentifier, CompletionHandler<void(bool)>&& completionHandler)
+void NetworkStorageManager::isSameEntry(WebCore::FileSystemHandleIdentifier identifier, WebCore::FileSystemHandleIdentifier targetIdentifier, CompletionHandler<void(bool)>&& completionHandler)
{
ASSERT(!RunLoop::isMain());
@@ -182,7 +182,7 @@
completionHandler(handle->isSameEntry(targetIdentifier));
}
-void NetworkStorageManager::getFileHandle(IPC::Connection& connection, FileSystemStorageHandleIdentifier identifier, String&& name, bool createIfNecessary, CompletionHandler<void(Expected<FileSystemStorageHandleIdentifier, FileSystemStorageError>)>&& completionHandler)
+void NetworkStorageManager::getFileHandle(IPC::Connection& connection, WebCore::FileSystemHandleIdentifier identifier, String&& name, bool createIfNecessary, CompletionHandler<void(Expected<WebCore::FileSystemHandleIdentifier, FileSystemStorageError>)>&& completionHandler)
{
ASSERT(!RunLoop::isMain());
@@ -193,7 +193,7 @@
completionHandler(handle->getFileHandle(connection.uniqueID(), WTFMove(name), createIfNecessary));
}
-void NetworkStorageManager::getDirectoryHandle(IPC::Connection& connection, FileSystemStorageHandleIdentifier identifier, String&& name, bool createIfNecessary, CompletionHandler<void(Expected<FileSystemStorageHandleIdentifier, FileSystemStorageError>)>&& completionHandler)
+void NetworkStorageManager::getDirectoryHandle(IPC::Connection& connection, WebCore::FileSystemHandleIdentifier identifier, String&& name, bool createIfNecessary, CompletionHandler<void(Expected<WebCore::FileSystemHandleIdentifier, FileSystemStorageError>)>&& completionHandler)
{
ASSERT(!RunLoop::isMain());
@@ -204,7 +204,7 @@
completionHandler(handle->getDirectoryHandle(connection.uniqueID(), WTFMove(name), createIfNecessary));
}
-void NetworkStorageManager::removeEntry(FileSystemStorageHandleIdentifier identifier, const String& name, bool deleteRecursively, CompletionHandler<void(std::optional<FileSystemStorageError>)>&& completionHandler)
+void NetworkStorageManager::removeEntry(WebCore::FileSystemHandleIdentifier identifier, const String& name, bool deleteRecursively, CompletionHandler<void(std::optional<FileSystemStorageError>)>&& completionHandler)
{
ASSERT(!RunLoop::isMain());
@@ -215,7 +215,7 @@
completionHandler(handle->removeEntry(name, deleteRecursively));
}
-void NetworkStorageManager::resolve(FileSystemStorageHandleIdentifier identifier, FileSystemStorageHandleIdentifier targetIdentifier, CompletionHandler<void(Expected<Vector<String>, FileSystemStorageError>)>&& completionHandler)
+void NetworkStorageManager::resolve(WebCore::FileSystemHandleIdentifier identifier, WebCore::FileSystemHandleIdentifier targetIdentifier, CompletionHandler<void(Expected<Vector<String>, FileSystemStorageError>)>&& completionHandler)
{
ASSERT(!RunLoop::isMain());
Modified: trunk/Source/WebKit/NetworkProcess/storage/NetworkStorageManager.h (283270 => 283271)
--- trunk/Source/WebKit/NetworkProcess/storage/NetworkStorageManager.h 2021-09-29 22:44:55 UTC (rev 283270)
+++ trunk/Source/WebKit/NetworkProcess/storage/NetworkStorageManager.h 2021-09-29 22:45:23 UTC (rev 283271)
@@ -27,9 +27,9 @@
#include "Connection.h"
#include "FileSystemStorageError.h"
-#include "FileSystemStorageHandleIdentifier.h"
#include "OriginStorageManager.h"
#include <WebCore/ClientOrigin.h>
+#include <WebCore/FileSystemHandleIdentifier.h>
#include <pal/SessionID.h>
namespace WebCore {
@@ -63,12 +63,12 @@
// Message handlers
void persisted(const WebCore::ClientOrigin&, CompletionHandler<void(bool)>&&);
void persist(const WebCore::ClientOrigin&, CompletionHandler<void(bool)>&&);
- void fileSystemGetDirectory(IPC::Connection&, const WebCore::ClientOrigin&, CompletionHandler<void(Expected<FileSystemStorageHandleIdentifier, FileSystemStorageError>)>&&);
- void isSameEntry(FileSystemStorageHandleIdentifier, FileSystemStorageHandleIdentifier, CompletionHandler<void(bool)>&&);
- void getFileHandle(IPC::Connection&, FileSystemStorageHandleIdentifier, String&& name, bool createIfNecessary, CompletionHandler<void(Expected<FileSystemStorageHandleIdentifier, FileSystemStorageError>)>&&);
- void getDirectoryHandle(IPC::Connection&, FileSystemStorageHandleIdentifier, String&& name, bool createIfNecessary, CompletionHandler<void(Expected<FileSystemStorageHandleIdentifier, FileSystemStorageError>)>&&);
- void removeEntry(FileSystemStorageHandleIdentifier, const String& name, bool deleteRecursively, CompletionHandler<void(std::optional<FileSystemStorageError>)>&&);
- void resolve(FileSystemStorageHandleIdentifier, FileSystemStorageHandleIdentifier, CompletionHandler<void(Expected<Vector<String>, FileSystemStorageError>)>&&);
+ void fileSystemGetDirectory(IPC::Connection&, const WebCore::ClientOrigin&, CompletionHandler<void(Expected<WebCore::FileSystemHandleIdentifier, FileSystemStorageError>)>&&);
+ void isSameEntry(WebCore::FileSystemHandleIdentifier, WebCore::FileSystemHandleIdentifier, CompletionHandler<void(bool)>&&);
+ void getFileHandle(IPC::Connection&, WebCore::FileSystemHandleIdentifier, String&& name, bool createIfNecessary, CompletionHandler<void(Expected<WebCore::FileSystemHandleIdentifier, FileSystemStorageError>)>&&);
+ void getDirectoryHandle(IPC::Connection&, WebCore::FileSystemHandleIdentifier, String&& name, bool createIfNecessary, CompletionHandler<void(Expected<WebCore::FileSystemHandleIdentifier, FileSystemStorageError>)>&&);
+ void removeEntry(WebCore::FileSystemHandleIdentifier, const String& name, bool deleteRecursively, CompletionHandler<void(std::optional<FileSystemStorageError>)>&&);
+ void resolve(WebCore::FileSystemHandleIdentifier, WebCore::FileSystemHandleIdentifier, CompletionHandler<void(Expected<Vector<String>, FileSystemStorageError>)>&&);
PAL::SessionID m_sessionID;
Ref<WorkQueue> m_queue;
Modified: trunk/Source/WebKit/NetworkProcess/storage/NetworkStorageManager.messages.in (283270 => 283271)
--- trunk/Source/WebKit/NetworkProcess/storage/NetworkStorageManager.messages.in 2021-09-29 22:44:55 UTC (rev 283270)
+++ trunk/Source/WebKit/NetworkProcess/storage/NetworkStorageManager.messages.in 2021-09-29 22:45:23 UTC (rev 283271)
@@ -26,10 +26,10 @@
messages -> NetworkStorageManager {
Persisted(struct WebCore::ClientOrigin origin) -> (bool persisted) Async
Persist(struct WebCore::ClientOrigin origin) -> (bool persisted) Async
- FileSystemGetDirectory(struct WebCore::ClientOrigin origin) -> (Expected<WebKit::FileSystemStorageHandleIdentifier, WebKit::FileSystemStorageError> result) Async WantsConnection
- IsSameEntry(WebKit::FileSystemStorageHandleIdentifier identifier, WebKit::FileSystemStorageHandleIdentifier targetIdentifier) -> (bool result) Async
- GetFileHandle(WebKit::FileSystemStorageHandleIdentifier identifier, String name, bool createIfNecessary) -> (Expected<WebKit::FileSystemStorageHandleIdentifier, WebKit::FileSystemStorageError> result) Async WantsConnection
- GetDirectoryHandle(WebKit::FileSystemStorageHandleIdentifier identifier, String name, bool createIfNecessary) -> (Expected<WebKit::FileSystemStorageHandleIdentifier, WebKit::FileSystemStorageError> result) Async WantsConnection
- RemoveEntry(WebKit::FileSystemStorageHandleIdentifier identifier, String name, bool deleteRecursively) -> (std::optional<WebKit::FileSystemStorageError> result) Async
- Resolve(WebKit::FileSystemStorageHandleIdentifier identifier, WebKit::FileSystemStorageHandleIdentifier targetIdentifier) -> (Expected<Vector<String>, WebKit::FileSystemStorageError> result) Async
+ FileSystemGetDirectory(struct WebCore::ClientOrigin origin) -> (Expected<WebCore::FileSystemHandleIdentifier, WebKit::FileSystemStorageError> result) Async WantsConnection
+ IsSameEntry(WebCore::FileSystemHandleIdentifier identifier, WebCore::FileSystemHandleIdentifier targetIdentifier) -> (bool result) Async
+ GetFileHandle(WebCore::FileSystemHandleIdentifier identifier, String name, bool createIfNecessary) -> (Expected<WebCore::FileSystemHandleIdentifier, WebKit::FileSystemStorageError> result) Async WantsConnection
+ GetDirectoryHandle(WebCore::FileSystemHandleIdentifier identifier, String name, bool createIfNecessary) -> (Expected<WebCore::FileSystemHandleIdentifier, WebKit::FileSystemStorageError> result) Async WantsConnection
+ RemoveEntry(WebCore::FileSystemHandleIdentifier identifier, String name, bool deleteRecursively) -> (std::optional<WebKit::FileSystemStorageError> result) Async
+ Resolve(WebCore::FileSystemHandleIdentifier identifier, WebCore::FileSystemHandleIdentifier targetIdentifier) -> (Expected<Vector<String>, WebKit::FileSystemStorageError> result) Async
}
Modified: trunk/Source/WebKit/NetworkProcess/storage/OriginStorageManager.h (283270 => 283271)
--- trunk/Source/WebKit/NetworkProcess/storage/OriginStorageManager.h 2021-09-29 22:44:55 UTC (rev 283270)
+++ trunk/Source/WebKit/NetworkProcess/storage/OriginStorageManager.h 2021-09-29 22:45:23 UTC (rev 283271)
@@ -26,7 +26,6 @@
#pragma once
#include "Connection.h"
-#include "FileSystemStorageHandleIdentifier.h"
#include <wtf/text/WTFString.h>
namespace WebKit {
Modified: trunk/Source/WebKit/Scripts/webkit/messages.py (283270 => 283271)
--- trunk/Source/WebKit/Scripts/webkit/messages.py 2021-09-29 22:44:55 UTC (rev 283270)
+++ trunk/Source/WebKit/Scripts/webkit/messages.py 2021-09-29 22:45:23 UTC (rev 283271)
@@ -281,6 +281,7 @@
'WebCore::DocumentOrWorkerIdentifier',
'WebCore::DragApplicationFlags',
'WebCore::FetchIdentifier',
+ 'WebCore::FileSystemHandleIdentifier',
'WebCore::FrameIdentifier',
'WebCore::GraphicsContextGLAttributes',
'WebCore::ImageDecoderIdentifier',
@@ -317,7 +318,6 @@
'WebKit::DisplayLinkObserverID',
'WebKit::DownloadID',
'WebKit::FileSystemStorageError',
- 'WebKit::FileSystemStorageHandleIdentifier',
'WebKit::FormSubmitListenerIdentifier',
'WebKit::GeolocationIdentifier',
'WebKit::GraphicsContextGLIdentifier',
Modified: trunk/Source/WebKit/Sources.txt (283270 => 283271)
--- trunk/Source/WebKit/Sources.txt 2021-09-29 22:44:55 UTC (rev 283270)
+++ trunk/Source/WebKit/Sources.txt 2021-09-29 22:45:23 UTC (rev 283271)
@@ -695,7 +695,6 @@
WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp
WebProcess/WebAuthentication/WebAuthnProcessConnection.cpp
-WebProcess/WebCoreSupport/FileSystemStorageHandleProxy.cpp
WebProcess/WebCoreSupport/SessionStateConversion.cpp
WebProcess/WebCoreSupport/ShareableBitmapUtilities.cpp
WebProcess/WebCoreSupport/WebBroadcastChannelRegistry.cpp
@@ -707,6 +706,7 @@
WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp
WebProcess/WebCoreSupport/WebDragClient.cpp
WebProcess/WebCoreSupport/WebEditorClient.cpp
+WebProcess/WebCoreSupport/WebFileSystemStorageConnection.cpp
WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
WebProcess/WebCoreSupport/WebGeolocationClient.cpp
WebProcess/WebCoreSupport/WebMediaKeySystemClient.cpp
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (283270 => 283271)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2021-09-29 22:44:55 UTC (rev 283270)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2021-09-29 22:45:23 UTC (rev 283271)
@@ -1485,6 +1485,7 @@
933E835B23A1B75000DEF289 /* WebIDBServerMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 933E835823A1ADF500DEF289 /* WebIDBServerMessageReceiver.cpp */; };
9342589A255B535A0059EEDD /* MediaPermissionUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 93425898255B534B0059EEDD /* MediaPermissionUtilities.h */; };
934B724419F5B9BE00AE96D6 /* WKActionMenuItemTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 934B724319F5B9BE00AE96D6 /* WKActionMenuItemTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 9354242C2703BDCB005CA72C /* WebFileSystemStorageConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 9354242A2703BDCB005CA72C /* WebFileSystemStorageConnection.h */; };
9356F2DC2152B6B500E6D5DF /* WebSWClientConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 517A53021F4793B200DCDC0A /* WebSWClientConnection.h */; };
9356F2DD2152B6F600E6D5DF /* WebSWServerConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 93BA04E02151ADF4007F455F /* WebSWServerConnection.h */; };
9356F2DE2152B71000E6D5DF /* WebSWOriginStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 93BA04DE2151ADF4007F455F /* WebSWOriginStore.h */; };
@@ -4942,9 +4943,6 @@
931A075126F06310004474CD /* FileSystemStorageManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileSystemStorageManager.cpp; sourceTree = "<group>"; };
931A075226F06AB4004474CD /* FileSystemStorageHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileSystemStorageHandle.cpp; sourceTree = "<group>"; };
931A075326F06AB4004474CD /* FileSystemStorageHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileSystemStorageHandle.h; sourceTree = "<group>"; };
- 931A075726F125A3004474CD /* FileSystemStorageHandleIdentifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileSystemStorageHandleIdentifier.h; sourceTree = "<group>"; };
- 931A075926F1B967004474CD /* FileSystemStorageHandleProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileSystemStorageHandleProxy.cpp; sourceTree = "<group>"; };
- 931A075A26F1B968004474CD /* FileSystemStorageHandleProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileSystemStorageHandleProxy.h; sourceTree = "<group>"; };
931A1BE026F85C320081A7E5 /* FileSystemStorageError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileSystemStorageError.h; sourceTree = "<group>"; };
9321D5851A38EE3C008052BE /* WKImmediateActionController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKImmediateActionController.h; sourceTree = "<group>"; };
9321D5871A38EE74008052BE /* WKImmediateActionController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKImmediateActionController.mm; sourceTree = "<group>"; };
@@ -4960,6 +4958,8 @@
9342588F2555DCA50059EEDD /* MediaPermissionUtilities.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MediaPermissionUtilities.mm; sourceTree = "<group>"; };
93425898255B534B0059EEDD /* MediaPermissionUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaPermissionUtilities.h; sourceTree = "<group>"; };
934B724319F5B9BE00AE96D6 /* WKActionMenuItemTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKActionMenuItemTypes.h; sourceTree = "<group>"; };
+ 9354242A2703BDCB005CA72C /* WebFileSystemStorageConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebFileSystemStorageConnection.h; sourceTree = "<group>"; };
+ 9354242B2703BDCB005CA72C /* WebFileSystemStorageConnection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebFileSystemStorageConnection.cpp; sourceTree = "<group>"; };
935B579826F51270008B48AC /* FileSystemStorageHandleRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileSystemStorageHandleRegistry.h; sourceTree = "<group>"; };
935B579926F5192F008B48AC /* FileSystemStorageHandleRegistry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileSystemStorageHandleRegistry.cpp; sourceTree = "<group>"; };
935EEB951277616D003322B8 /* WKBundleBackForwardList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundleBackForwardList.cpp; sourceTree = "<group>"; };
@@ -9754,7 +9754,6 @@
931A1BE026F85C320081A7E5 /* FileSystemStorageError.h */,
931A075226F06AB4004474CD /* FileSystemStorageHandle.cpp */,
931A075326F06AB4004474CD /* FileSystemStorageHandle.h */,
- 931A075726F125A3004474CD /* FileSystemStorageHandleIdentifier.h */,
935B579926F5192F008B48AC /* FileSystemStorageHandleRegistry.cpp */,
935B579826F51270008B48AC /* FileSystemStorageHandleRegistry.h */,
931A075126F06310004474CD /* FileSystemStorageManager.cpp */,
@@ -10074,8 +10073,6 @@
CD6178111E6DE98000FDA57D /* cocoa */,
2D28F3DF1885CCB4004B9EAE /* ios */,
BC111ADE112F5B9A00337BAB /* mac */,
- 931A075926F1B967004474CD /* FileSystemStorageHandleProxy.cpp */,
- 931A075A26F1B968004474CD /* FileSystemStorageHandleProxy.h */,
1A7284441959ED100007BCE5 /* SessionStateConversion.cpp */,
1A7284451959ED100007BCE5 /* SessionStateConversion.h */,
F43A9CDE25D72E2D00990E26 /* ShareableBitmapUtilities.cpp */,
@@ -10101,6 +10098,8 @@
BC032D6610F4378D0058C15A /* WebDragClient.h */,
BC111A57112F4FBB00337BAB /* WebEditorClient.cpp */,
BC032D6810F4378D0058C15A /* WebEditorClient.h */,
+ 9354242B2703BDCB005CA72C /* WebFileSystemStorageConnection.cpp */,
+ 9354242A2703BDCB005CA72C /* WebFileSystemStorageConnection.h */,
BC111A58112F4FBB00337BAB /* WebFrameLoaderClient.cpp */,
BC032D6A10F4378D0058C15A /* WebFrameLoaderClient.h */,
BC1BE1DF12D54A410004A228 /* WebGeolocationClient.cpp */,
@@ -12784,6 +12783,7 @@
BC032DB910F4380F0058C15A /* WebEvent.h in Headers */,
BC032DBB10F4380F0058C15A /* WebEventConversion.h in Headers */,
BC111B5D112F629800337BAB /* WebEventFactory.h in Headers */,
+ 9354242C2703BDCB005CA72C /* WebFileSystemStorageConnection.h in Headers */,
1A90C1EE1264FD50003E44D4 /* WebFindOptions.h in Headers */,
BCE469541214E6CB000B98EB /* WebFormClient.h in Headers */,
BCE469561214E6CB000B98EB /* WebFormSubmissionListenerProxy.h in Headers */,
Deleted: trunk/Source/WebKit/WebProcess/WebCoreSupport/FileSystemStorageHandleProxy.cpp (283270 => 283271)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/FileSystemStorageHandleProxy.cpp 2021-09-29 22:44:55 UTC (rev 283270)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/FileSystemStorageHandleProxy.cpp 2021-09-29 22:45:23 UTC (rev 283271)
@@ -1,137 +0,0 @@
-/*
- * Copyright (C) 2021 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "FileSystemStorageHandleProxy.h"
-
-#include "FileSystemStorageError.h"
-#include "NetworkStorageManagerMessages.h"
-#include <WebCore/ExceptionOr.h>
-#include <WebCore/FileSystemDirectoryHandle.h>
-#include <WebCore/FileSystemFileHandle.h>
-
-namespace WebKit {
-
-Ref<FileSystemStorageHandleProxy> FileSystemStorageHandleProxy::create(FileSystemStorageHandleIdentifier identifier, IPC::Connection& connection)
-{
- return adoptRef(*new FileSystemStorageHandleProxy(identifier, connection));
-}
-
-FileSystemStorageHandleProxy::FileSystemStorageHandleProxy(FileSystemStorageHandleIdentifier identifier, IPC::Connection& connection)
- : m_identifier(identifier)
- , m_connection(&connection)
-{
-}
-
-void FileSystemStorageHandleProxy::connectionClosed()
-{
- m_connection = nullptr;
-}
-
-void FileSystemStorageHandleProxy::isSameEntry(FileSystemHandleImpl& handle, CompletionHandler<void(WebCore::ExceptionOr<bool>&&)>&& completionHandler)
-{
- if (!m_connection)
- return completionHandler(WebCore::Exception { WebCore::UnknownError, "Connection is lost" });
-
- auto identifier = handle.storageHandleIdentifier();
- if (!identifier)
- return completionHandler(false);
-
- if (m_identifier.toUInt64() == *identifier)
- return completionHandler(true);
-
- m_connection->sendWithAsyncReply(Messages::NetworkStorageManager::IsSameEntry(m_identifier, makeObjectIdentifier<FileSystemStorageHandleIdentifierType>(*identifier)), [completionHandler = WTFMove(completionHandler)](bool result) mutable {
- completionHandler(result);
- });
-}
-
-void FileSystemStorageHandleProxy::getFileHandle(const String& name, bool createIfNecessary, CompletionHandler<void(WebCore::ExceptionOr<Ref<WebCore::FileSystemHandleImpl>>&&)>&& completionHandler)
-{
- if (!m_connection)
- return completionHandler(WebCore::Exception { WebCore::UnknownError, "Connection is lost" });
-
- m_connection->sendWithAsyncReply(Messages::NetworkStorageManager::GetFileHandle(m_identifier, name, createIfNecessary), [connection = m_connection, name, completionHandler = WTFMove(completionHandler)](auto result) mutable {
- if (!result)
- return completionHandler(WebCore::Exception { convertToExceptionCode(result.error()) });
-
- auto handleIdentifier = result.value();
- if (!handleIdentifier.isValid())
- return completionHandler(WebCore::Exception { WebCore::UnknownError, "Connection is lost"_s });
-
- Ref<WebCore::FileSystemHandleImpl> impl = FileSystemStorageHandleProxy::create(handleIdentifier, *connection);
- completionHandler(WTFMove(impl));
- });
-}
-
-void FileSystemStorageHandleProxy::getDirectoryHandle(const String& name, bool createIfNecessary, CompletionHandler<void(WebCore::ExceptionOr<Ref<WebCore::FileSystemHandleImpl>>&&)>&& completionHandler)
-{
- if (!m_connection)
- return completionHandler(WebCore::Exception { WebCore::UnknownError, "Connection is lost" });
-
- m_connection->sendWithAsyncReply(Messages::NetworkStorageManager::GetDirectoryHandle(m_identifier, name, createIfNecessary), [connection = m_connection, name, completionHandler = WTFMove(completionHandler)](auto result) mutable {
- if (!result)
- return completionHandler(WebCore::Exception { convertToExceptionCode(result.error()) });
-
- auto handleIdentifier = result.value();
- if (!handleIdentifier.isValid())
- return completionHandler(WebCore::Exception { WebCore::UnknownError, "Connection is lost"_s });
-
- Ref<WebCore::FileSystemHandleImpl> impl = FileSystemStorageHandleProxy::create(handleIdentifier, *connection);
- completionHandler(WTFMove(impl));
- });
-}
-
-void FileSystemStorageHandleProxy::removeEntry(const String& name, bool deleteRecursively, CompletionHandler<void(WebCore::ExceptionOr<void>&&)>&& completionHandler)
-{
- if (!m_connection)
- return completionHandler(WebCore::Exception { WebCore::UnknownError, "Connection is lost" });
-
- m_connection->sendWithAsyncReply(Messages::NetworkStorageManager::RemoveEntry(m_identifier, name, deleteRecursively), [completionHandler = WTFMove(completionHandler)](auto error) mutable {
- if (error)
- return completionHandler(WebCore::Exception { convertToExceptionCode(error.value()) });
-
- completionHandler({ });
- });
-}
-
-void FileSystemStorageHandleProxy::resolve(FileSystemHandleImpl& handle, CompletionHandler<void(WebCore::ExceptionOr<Vector<String>>&&)>&& completionHandler)
-{
- if (!m_connection)
- return completionHandler(WebCore::Exception { WebCore::UnknownError, "Connection is lost" });
-
- auto identifier = handle.storageHandleIdentifier();
- if (!identifier)
- return completionHandler(Vector<String> { });
-
- m_connection->sendWithAsyncReply(Messages::NetworkStorageManager::Resolve(m_identifier, makeObjectIdentifier<FileSystemStorageHandleIdentifierType>(*identifier)), [completionHandler = WTFMove(completionHandler)](auto result) mutable {
- if (!result)
- return completionHandler(WebCore::Exception { convertToExceptionCode(result.error()) });
-
- completionHandler(WTFMove(result.value()));
- });
-}
-
-} // namespace WebKit
-
Deleted: trunk/Source/WebKit/WebProcess/WebCoreSupport/FileSystemStorageHandleProxy.h (283270 => 283271)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/FileSystemStorageHandleProxy.h 2021-09-29 22:44:55 UTC (rev 283270)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/FileSystemStorageHandleProxy.h 2021-09-29 22:45:23 UTC (rev 283271)
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2021 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include "FileSystemStorageHandleIdentifier.h"
-#include <WebCore/FileSystemHandleImpl.h>
-
-namespace IPC {
-class Connection;
-}
-
-namespace WebCore {
-template<typename> class ExceptionOr;
-class FileSystemDirectoryHandle;
-class FileSystemFileHandle;
-}
-
-namespace WebKit {
-
-class FileSystemStorageHandleProxy final : public WebCore::FileSystemHandleImpl {
-public:
- static Ref<FileSystemStorageHandleProxy> create(FileSystemStorageHandleIdentifier, IPC::Connection&);
- void connectionClosed();
-
-private:
- FileSystemStorageHandleProxy(FileSystemStorageHandleIdentifier, IPC::Connection&);
-
- // FileSystemHandleImpl
- std::optional<uint64_t> storageHandleIdentifier() { return m_identifier.toUInt64(); }
- void isSameEntry(FileSystemHandleImpl&, CompletionHandler<void(WebCore::ExceptionOr<bool>&&)>&&) final;
- void getFileHandle(const String& name, bool createIfNecessary, CompletionHandler<void(WebCore::ExceptionOr<Ref<WebCore::FileSystemHandleImpl>>&&)>&&) final;
- void getDirectoryHandle(const String& name, bool createIfNecessary, CompletionHandler<void(WebCore::ExceptionOr<Ref<WebCore::FileSystemHandleImpl>>&&)>&&) final;
- void removeEntry(const String& name, bool deleteRecursively, CompletionHandler<void(WebCore::ExceptionOr<void>&&)>&&) final;
- void resolve(FileSystemHandleImpl&, CompletionHandler<void(WebCore::ExceptionOr<Vector<String>>&&)>&&) final;
-
- FileSystemStorageHandleIdentifier m_identifier;
- RefPtr<IPC::Connection> m_connection;
-};
-
-} // namespace WebKit
Copied: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFileSystemStorageConnection.cpp (from rev 283270, trunk/Source/WebKit/WebProcess/WebCoreSupport/FileSystemStorageHandleProxy.cpp) (0 => 283271)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFileSystemStorageConnection.cpp (rev 0)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFileSystemStorageConnection.cpp 2021-09-29 22:45:23 UTC (rev 283271)
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebFileSystemStorageConnection.h"
+
+#include "FileSystemStorageError.h"
+#include "NetworkStorageManagerMessages.h"
+#include <WebCore/ExceptionOr.h>
+#include <WebCore/FileSystemDirectoryHandle.h>
+#include <WebCore/FileSystemFileHandle.h>
+
+namespace WebKit {
+
+Ref<WebFileSystemStorageConnection> WebFileSystemStorageConnection::create(IPC::Connection& connection)
+{
+ return adoptRef(*new WebFileSystemStorageConnection(connection));
+}
+
+WebFileSystemStorageConnection::WebFileSystemStorageConnection(IPC::Connection& connection)
+ : m_connection(&connection)
+{
+}
+
+void WebFileSystemStorageConnection::connectionClosed()
+{
+ m_connection = nullptr;
+}
+
+void WebFileSystemStorageConnection::isSameEntry(WebCore::FileSystemHandleIdentifier identifier, WebCore::FileSystemHandleIdentifier otherIdentifier, WebCore::FileSystemStorageConnection::SameEntryCallback&& completionHandler)
+{
+ if (!m_connection)
+ return completionHandler(WebCore::Exception { WebCore::UnknownError, "Connection is lost" });
+
+ if (identifier == otherIdentifier)
+ return completionHandler(true);
+
+ m_connection->sendWithAsyncReply(Messages::NetworkStorageManager::IsSameEntry(identifier, otherIdentifier), WTFMove(completionHandler));
+}
+
+void WebFileSystemStorageConnection::getFileHandle(WebCore::FileSystemHandleIdentifier identifier, const String& name, bool createIfNecessary, WebCore::FileSystemStorageConnection::GetHandleCallback&& completionHandler)
+{
+ if (!m_connection)
+ return completionHandler(WebCore::Exception { WebCore::UnknownError, "Connection is lost" });
+
+ m_connection->sendWithAsyncReply(Messages::NetworkStorageManager::GetFileHandle(identifier, name, createIfNecessary), [name, completionHandler = WTFMove(completionHandler)](auto result) mutable {
+ if (!result)
+ return completionHandler(WebCore::Exception { convertToExceptionCode(result.error()) });
+
+ auto identifier = result.value();
+ if (!identifier.isValid())
+ return completionHandler(WebCore::Exception { WebCore::UnknownError, "Connection is lost"_s });
+
+ completionHandler(WTFMove(identifier));
+ });
+}
+
+void WebFileSystemStorageConnection::getDirectoryHandle(WebCore::FileSystemHandleIdentifier identifier, const String& name, bool createIfNecessary, WebCore::FileSystemStorageConnection::GetHandleCallback&& completionHandler)
+{
+ if (!m_connection)
+ return completionHandler(WebCore::Exception { WebCore::UnknownError, "Connection is lost" });
+
+ m_connection->sendWithAsyncReply(Messages::NetworkStorageManager::GetDirectoryHandle(identifier, name, createIfNecessary), [name, completionHandler = WTFMove(completionHandler)](auto result) mutable {
+ if (!result)
+ return completionHandler(WebCore::Exception { convertToExceptionCode(result.error()) });
+
+ auto identifier = result.value();
+ if (!identifier.isValid())
+ return completionHandler(WebCore::Exception { WebCore::UnknownError, "Connection is lost"_s });
+
+ completionHandler(WTFMove(identifier));
+ });
+}
+
+void WebFileSystemStorageConnection::removeEntry(WebCore::FileSystemHandleIdentifier identifier, const String& name, bool deleteRecursively, WebCore::FileSystemStorageConnection::RemoveEntryCallback&& completionHandler)
+{
+ if (!m_connection)
+ return completionHandler(WebCore::Exception { WebCore::UnknownError, "Connection is lost" });
+
+ m_connection->sendWithAsyncReply(Messages::NetworkStorageManager::RemoveEntry(identifier, name, deleteRecursively), [completionHandler = WTFMove(completionHandler)](auto error) mutable {
+ if (error)
+ return completionHandler(WebCore::Exception { convertToExceptionCode(error.value()) });
+
+ completionHandler({ });
+ });
+}
+
+void WebFileSystemStorageConnection::resolve(WebCore::FileSystemHandleIdentifier identifier, WebCore::FileSystemHandleIdentifier otherIdentifier, WebCore::FileSystemStorageConnection::ResolveCallback&& completionHandler)
+{
+ if (!m_connection)
+ return completionHandler(WebCore::Exception { WebCore::UnknownError, "Connection is lost" });
+
+ m_connection->sendWithAsyncReply(Messages::NetworkStorageManager::Resolve(identifier, otherIdentifier), [completionHandler = WTFMove(completionHandler)](auto result) mutable {
+ if (!result)
+ return completionHandler(WebCore::Exception { convertToExceptionCode(result.error()) });
+
+ completionHandler(WTFMove(result.value()));
+ });
+}
+
+} // namespace WebKit
Copied: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFileSystemStorageConnection.h (from rev 283270, trunk/Source/WebKit/WebProcess/WebCoreSupport/FileSystemStorageHandleProxy.h) (0 => 283271)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFileSystemStorageConnection.h (rev 0)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFileSystemStorageConnection.h 2021-09-29 22:45:23 UTC (rev 283271)
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <WebCore/FileSystemStorageConnection.h>
+
+namespace IPC {
+class Connection;
+}
+
+namespace WebCore {
+template<typename> class ExceptionOr;
+class FileSystemDirectoryHandle;
+class FileSystemFileHandle;
+}
+
+namespace WebKit {
+
+class WebFileSystemStorageConnection final : public WebCore::FileSystemStorageConnection {
+public:
+ static Ref<WebFileSystemStorageConnection> create(IPC::Connection&);
+ void connectionClosed();
+
+private:
+ explicit WebFileSystemStorageConnection(IPC::Connection&);
+
+ // FileSystemStorageConnection
+ void isSameEntry(WebCore::FileSystemHandleIdentifier, WebCore::FileSystemHandleIdentifier, WebCore::FileSystemStorageConnection::SameEntryCallback&&);
+ void getFileHandle(WebCore::FileSystemHandleIdentifier, const String& name, bool createIfNecessary, WebCore::FileSystemStorageConnection::GetHandleCallback&&);
+ void getDirectoryHandle(WebCore::FileSystemHandleIdentifier, const String& name, bool createIfNecessary, WebCore::FileSystemStorageConnection::GetHandleCallback&&);
+ void removeEntry(WebCore::FileSystemHandleIdentifier, const String& name, bool deleteRecursively, WebCore::FileSystemStorageConnection::RemoveEntryCallback&&);
+ void resolve(WebCore::FileSystemHandleIdentifier, WebCore::FileSystemHandleIdentifier, WebCore::FileSystemStorageConnection::ResolveCallback&&);
+
+ RefPtr<IPC::Connection> m_connection;
+};
+
+} // namespace WebKit
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebStorageConnection.cpp (283270 => 283271)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebStorageConnection.cpp 2021-09-29 22:44:55 UTC (rev 283270)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebStorageConnection.cpp 2021-09-29 22:45:23 UTC (rev 283271)
@@ -26,12 +26,13 @@
#include "config.h"
#include "WebStorageConnection.h"
-#include "FileSystemStorageHandleProxy.h"
#include "NetworkProcessConnection.h"
#include "NetworkStorageManagerMessages.h"
+#include "WebFileSystemStorageConnection.h"
#include "WebProcess.h"
#include <WebCore/ClientOrigin.h>
#include <WebCore/ExceptionOr.h>
+#include <WebCore/FileSystemHandleIdentifier.h>
namespace WebKit {
@@ -45,23 +46,24 @@
connection().sendWithAsyncReply(Messages::NetworkStorageManager::Persisted(origin), WTFMove(completionHandler));
}
-void WebStorageConnection::persist(const WebCore::ClientOrigin& origin, CompletionHandler<void(bool)>&& completionHandler)
+void WebStorageConnection::persist(const WebCore::ClientOrigin& origin, StorageConnection::PersistCallback&& completionHandler)
{
connection().sendWithAsyncReply(Messages::NetworkStorageManager::Persist(origin), WTFMove(completionHandler));
}
-void WebStorageConnection::fileSystemGetDirectory(const WebCore::ClientOrigin& origin, CompletionHandler<void(WebCore::ExceptionOr<Ref<WebCore::FileSystemHandleImpl>>&&)>&& completionHandler)
+void WebStorageConnection::fileSystemGetDirectory(const WebCore::ClientOrigin& origin, StorageConnection::GetDirectoryCallback&& completionHandler)
{
auto& connection = WebProcess::singleton().ensureNetworkProcessConnection().connection();
- connection.sendWithAsyncReply(Messages::NetworkStorageManager::FileSystemGetDirectory(origin), [weakConnection = makeWeakPtr(connection), completionHandler = WTFMove(completionHandler)](auto result) mutable {
+ connection.sendWithAsyncReply(Messages::NetworkStorageManager::FileSystemGetDirectory(origin), [completionHandler = WTFMove(completionHandler)](auto result) mutable {
if (!result)
return completionHandler(WebCore::Exception { convertToExceptionCode(result.error()) });
- if (!weakConnection || !result.value().isValid())
+ auto identifier = result.value();
+ if (!identifier.isValid())
return completionHandler(WebCore::Exception { WebCore::UnknownError, "Connection is lost"_s });
- Ref<WebCore::FileSystemHandleImpl> impl = FileSystemStorageHandleProxy::create(result.value(), *weakConnection);
- return completionHandler(WTFMove(impl));
+ auto connection = RefPtr<WebCore::FileSystemStorageConnection> { &WebProcess::singleton().fileSystemStorageConnection() };
+ return completionHandler(std::pair { identifier, WTFMove(connection) });
});
}
Modified: trunk/Source/WebKit/WebProcess/WebProcess.cpp (283270 => 283271)
--- trunk/Source/WebKit/WebProcess/WebProcess.cpp 2021-09-29 22:44:55 UTC (rev 283270)
+++ trunk/Source/WebKit/WebProcess/WebProcess.cpp 2021-09-29 22:45:23 UTC (rev 283271)
@@ -59,6 +59,7 @@
#include "WebConnectionToUIProcess.h"
#include "WebCookieJar.h"
#include "WebCoreArgumentCoders.h"
+#include "WebFileSystemStorageConnection.h"
#include "WebFrame.h"
#include "WebFrameNetworkingContext.h"
#include "WebGamepadProvider.h"
@@ -1207,8 +1208,22 @@
paymentCoordinator->networkProcessConnectionClosed();
#endif
}
+
+ // Recreate a new connection with valid IPC connection on next operation.
+ if (m_fileSystemStorageConnection) {
+ m_fileSystemStorageConnection->connectionClosed();
+ m_fileSystemStorageConnection = nullptr;
+ }
}
+WebFileSystemStorageConnection& WebProcess::fileSystemStorageConnection()
+{
+ if (!m_fileSystemStorageConnection)
+ m_fileSystemStorageConnection = WebFileSystemStorageConnection::create(ensureNetworkProcessConnection().connection());
+
+ return *m_fileSystemStorageConnection;
+}
+
WebLoaderStrategy& WebProcess::webLoaderStrategy()
{
return m_webLoaderStrategy;
Modified: trunk/Source/WebKit/WebProcess/WebProcess.h (283270 => 283271)
--- trunk/Source/WebKit/WebProcess/WebProcess.h 2021-09-29 22:44:55 UTC (rev 283270)
+++ trunk/Source/WebKit/WebProcess/WebProcess.h 2021-09-29 22:45:23 UTC (rev 283271)
@@ -140,6 +140,7 @@
class WebCookieJar;
class WebCompiledContentRuleListData;
class WebConnectionToUIProcess;
+class WebFileSystemStorageConnection;
class WebFrame;
class WebLoaderStrategy;
class WebPage;
@@ -245,6 +246,7 @@
void networkProcessConnectionClosed(NetworkProcessConnection*);
NetworkProcessConnection* existingNetworkProcessConnection() { return m_networkProcessConnection.get(); }
WebLoaderStrategy& webLoaderStrategy();
+ WebFileSystemStorageConnection& fileSystemStorageConnection();
#if ENABLE(GPU_PROCESS)
GPUProcessConnection& ensureGPUProcessConnection();
@@ -651,6 +653,7 @@
String m_uiProcessBundleIdentifier;
RefPtr<NetworkProcessConnection> m_networkProcessConnection;
WebLoaderStrategy& m_webLoaderStrategy;
+ RefPtr<WebFileSystemStorageConnection> m_fileSystemStorageConnection;
#if ENABLE(GPU_PROCESS)
RefPtr<GPUProcessConnection> m_gpuProcessConnection;