Title: [281232] trunk/Source/WebKit
Revision
281232
Author
commit-qu...@webkit.org
Date
2021-08-19 05:20:30 -0700 (Thu, 19 Aug 2021)

Log Message

Adjust fallback SandboxExtension std::optional<Handle> construction
https://bugs.webkit.org/show_bug.cgi?id=229233

Patch by Zan Dobersek <zdober...@igalia.com> on 2021-08-19
Reviewed by Carlos Garcia Campos.

In r240512, std::optional<> was adopted as the return type for handle
creation methods in the SandboxExtension class. For no-op methods,
the construction of these return values was done using empty initializer
lists.

The changes here should match pre-r240512 behavior by creating empty
Handle objects and using those to implicitly construct the returning
std::optional<> object. In addition, this avoids compilation breakage
with GCC 8 where ambiguity between possible std::optional<> constructors
is detected.

* Shared/SandboxExtension.h:
(WebKit::SandboxExtension::createHandle):
(WebKit::SandboxExtension::createHandleWithoutResolvingPath):
(WebKit::SandboxExtension::createHandleForReadWriteDirectory):
(WebKit::SandboxExtension::createHandleForGenericExtension):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (281231 => 281232)


--- trunk/Source/WebKit/ChangeLog	2021-08-19 09:17:16 UTC (rev 281231)
+++ trunk/Source/WebKit/ChangeLog	2021-08-19 12:20:30 UTC (rev 281232)
@@ -1,3 +1,27 @@
+2021-08-19  Zan Dobersek  <zdober...@igalia.com>
+
+        Adjust fallback SandboxExtension std::optional<Handle> construction
+        https://bugs.webkit.org/show_bug.cgi?id=229233
+
+        Reviewed by Carlos Garcia Campos.
+
+        In r240512, std::optional<> was adopted as the return type for handle
+        creation methods in the SandboxExtension class. For no-op methods,
+        the construction of these return values was done using empty initializer
+        lists.
+
+        The changes here should match pre-r240512 behavior by creating empty
+        Handle objects and using those to implicitly construct the returning
+        std::optional<> object. In addition, this avoids compilation breakage
+        with GCC 8 where ambiguity between possible std::optional<> constructors
+        is detected.
+
+        * Shared/SandboxExtension.h:
+        (WebKit::SandboxExtension::createHandle):
+        (WebKit::SandboxExtension::createHandleWithoutResolvingPath):
+        (WebKit::SandboxExtension::createHandleForReadWriteDirectory):
+        (WebKit::SandboxExtension::createHandleForGenericExtension):
+
 2021-08-19  Youenn Fablet  <you...@apple.com>
 
         Rename MediaPlayer::setVisible to MediaPlayer::setPageIsVisible

Modified: trunk/Source/WebKit/Shared/SandboxExtension.h (281231 => 281232)


--- trunk/Source/WebKit/Shared/SandboxExtension.h	2021-08-19 09:17:16 UTC (rev 281231)
+++ trunk/Source/WebKit/Shared/SandboxExtension.h	2021-08-19 12:20:30 UTC (rev 281232)
@@ -162,12 +162,12 @@
 inline void SandboxExtension::HandleArray::encode(IPC::Encoder&) const { }
 inline auto SandboxExtension::HandleArray::decode(IPC::Decoder&) -> std::optional<HandleArray> { return { HandleArray() }; }
 inline RefPtr<SandboxExtension> SandboxExtension::create(Handle&&) { return nullptr; }
-inline auto SandboxExtension::createHandle(const String&, Type) -> std::optional<Handle> { return {{ }}; }
+inline auto SandboxExtension::createHandle(const String&, Type) -> std::optional<Handle> { return Handle { }; }
 inline SandboxExtension::HandleArray SandboxExtension::createReadOnlyHandlesForFiles(ASCIILiteral, const Vector<String>&) { return { }; }
-inline auto SandboxExtension::createHandleWithoutResolvingPath(const String&, Type) -> std::optional<Handle> { return {{ }}; }
-inline auto SandboxExtension::createHandleForReadWriteDirectory(const String&) -> std::optional<Handle> { return {{ }}; }
+inline auto SandboxExtension::createHandleWithoutResolvingPath(const String&, Type) -> std::optional<Handle> { return Handle { }; }
+inline auto SandboxExtension::createHandleForReadWriteDirectory(const String&) -> std::optional<Handle> { return Handle { }; }
 inline auto SandboxExtension::createHandleForTemporaryFile(const String& /*prefix*/, Type) -> std::optional<std::pair<Handle, String>> { return std::optional<std::pair<Handle, String>> { std::pair<Handle, String> { Handle { }, String { } } }; }
-inline auto SandboxExtension::createHandleForGenericExtension(ASCIILiteral /*extensionClass*/) -> std::optional<Handle> { return {{ }}; }
+inline auto SandboxExtension::createHandleForGenericExtension(ASCIILiteral /*extensionClass*/) -> std::optional<Handle> { return Handle { }; }
 inline SandboxExtension::~SandboxExtension() { }
 inline bool SandboxExtension::revoke() { return true; }
 inline bool SandboxExtension::consume() { return true; }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to