Title: [244652] trunk/Source
Revision
244652
Author
[email protected]
Date
2019-04-25 10:36:58 -0700 (Thu, 25 Apr 2019)

Log Message

Remove DeprecatedOptional
https://bugs.webkit.org/show_bug.cgi?id=197161

Reviewed by Darin Adler.

Source/_javascript_Core:

We need to keep a symbol exported from _javascript_Core for binary compatibility with iOS12.
We need this symbol to be in a file that doesn't include anything because libcxx's implementation of
std::optional is actually std::__1::optional, which has a different mangled name.  This change will
prevent protocol errors from being reported if you are running the iOS12 simulator with a custom build of WebKit
and using the web inspector with it, but it's necessary to allow us to start using C++17 in WebKit.

* _javascript_Core.xcodeproj/project.pbxproj:
* inspector/InspectorBackendDispatcher.cpp:
* inspector/InspectorBackendDispatcher.h:
* inspector/InspectorBackendDispatcherCompatibility.cpp: Added.
(Inspector::BackendDispatcher::reportProtocolError):
* inspector/InspectorBackendDispatcherCompatibility.h: Added.

Source/WTF:

* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/DeprecatedOptional.h: Removed.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (244651 => 244652)


--- trunk/Source/_javascript_Core/ChangeLog	2019-04-25 17:24:34 UTC (rev 244651)
+++ trunk/Source/_javascript_Core/ChangeLog	2019-04-25 17:36:58 UTC (rev 244652)
@@ -1,3 +1,23 @@
+2019-04-25  Alex Christensen  <[email protected]>
+
+        Remove DeprecatedOptional
+        https://bugs.webkit.org/show_bug.cgi?id=197161
+
+        Reviewed by Darin Adler.
+
+        We need to keep a symbol exported from _javascript_Core for binary compatibility with iOS12.
+        We need this symbol to be in a file that doesn't include anything because libcxx's implementation of
+        std::optional is actually std::__1::optional, which has a different mangled name.  This change will
+        prevent protocol errors from being reported if you are running the iOS12 simulator with a custom build of WebKit
+        and using the web inspector with it, but it's necessary to allow us to start using C++17 in WebKit.
+
+        * _javascript_Core.xcodeproj/project.pbxproj:
+        * inspector/InspectorBackendDispatcher.cpp:
+        * inspector/InspectorBackendDispatcher.h:
+        * inspector/InspectorBackendDispatcherCompatibility.cpp: Added.
+        (Inspector::BackendDispatcher::reportProtocolError):
+        * inspector/InspectorBackendDispatcherCompatibility.h: Added.
+
 2019-04-24  Saam Barati  <[email protected]>
 
         Add SPI callbacks for before and after module execution

Modified: trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (244651 => 244652)


--- trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj	2019-04-25 17:24:34 UTC (rev 244651)
+++ trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj	2019-04-25 17:36:58 UTC (rev 244652)
@@ -1104,6 +1104,7 @@
 		5B70CFDE1DB69E6600EC23F9 /* JSAsyncFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = 5B70CFD81DB69E5C00EC23F9 /* JSAsyncFunction.h */; };
 		5B70CFE01DB69E6600EC23F9 /* AsyncFunctionPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = 5B70CFDA1DB69E5C00EC23F9 /* AsyncFunctionPrototype.h */; };
 		5B70CFE21DB69E6600EC23F9 /* AsyncFunctionConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 5B70CFDC1DB69E5C00EC23F9 /* AsyncFunctionConstructor.h */; };
+		5C4196622270E0000047B7CD /* InspectorBackendDispatcherCompatibility.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C4196612270DFF30047B7CD /* InspectorBackendDispatcherCompatibility.cpp */; };
 		5C4E8E961DBEBE620036F1FC /* JSONParseTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C4E8E941DBEBDA20036F1FC /* JSONParseTest.cpp */; };
 		5D5D8AD10E0D0EBE00F9C692 /* libedit.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D5D8AD00E0D0EBE00F9C692 /* libedit.dylib */; };
 		5DBB151B131D0B310056AD36 /* testapi.js in Copy Support Script */ = {isa = PBXBuildFile; fileRef = 14D857740A4696C80032146C /* testapi.js */; };
@@ -3685,6 +3686,7 @@
 		5B70CFDC1DB69E5C00EC23F9 /* AsyncFunctionConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AsyncFunctionConstructor.h; sourceTree = "<group>"; };
 		5B70CFDD1DB69E5C00EC23F9 /* AsyncFunctionConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AsyncFunctionConstructor.cpp; sourceTree = "<group>"; };
 		5B8243041DB7AA4900EA6384 /* AsyncFunctionPrototype.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = AsyncFunctionPrototype.js; sourceTree = "<group>"; };
+		5C4196612270DFF30047B7CD /* InspectorBackendDispatcherCompatibility.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorBackendDispatcherCompatibility.cpp; sourceTree = "<group>"; };
 		5C4E8E941DBEBDA20036F1FC /* JSONParseTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSONParseTest.cpp; path = API/tests/JSONParseTest.cpp; sourceTree = "<group>"; };
 		5C4E8E951DBEBDA20036F1FC /* JSONParseTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSONParseTest.h; path = API/tests/JSONParseTest.h; sourceTree = "<group>"; };
 		5D5D8AD00E0D0EBE00F9C692 /* libedit.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libedit.dylib; path = /usr/lib/libedit.dylib; sourceTree = "<absolute>"; };
@@ -8203,6 +8205,7 @@
 				A593CF85184038CA00BFCE27 /* InspectorAgentRegistry.h */,
 				A593CF7A1840360300BFCE27 /* InspectorBackendDispatcher.cpp */,
 				A593CF7B1840360300BFCE27 /* InspectorBackendDispatcher.h */,
+				5C4196612270DFF30047B7CD /* InspectorBackendDispatcherCompatibility.cpp */,
 				A5D0A1BA1862301B00C7B496 /* InspectorEnvironment.h */,
 				A5945594182479EB00CC3843 /* InspectorFrontendChannel.h */,
 				99F1A6FC1B8E6D9400463B26 /* InspectorFrontendRouter.cpp */,
@@ -10723,6 +10726,7 @@
 				5333BBDB2110F7D2007618EC /* DFGSpeculativeJIT32_64.cpp in Sources */,
 				5333BBDD2110F7E1007618EC /* DFGSpeculativeJIT64.cpp in Sources */,
 				33B2A548226543BF005A0F79 /* FTLLowerDFGToB3.cpp in Sources */,
+				5C4196622270E0000047B7CD /* InspectorBackendDispatcherCompatibility.cpp in Sources */,
 				536B319E1F735F160037FC33 /* LowLevelInterpreter.cpp in Sources */,
 				0FF4274A158EBE91004CB9FF /* udis86.c in Sources */,
 				0FF42740158EBE8B004CB9FF /* udis86_decode.c in Sources */,

Modified: trunk/Source/_javascript_Core/inspector/InspectorBackendDispatcher.cpp (244651 => 244652)


--- trunk/Source/_javascript_Core/inspector/InspectorBackendDispatcher.cpp	2019-04-25 17:24:34 UTC (rev 244651)
+++ trunk/Source/_javascript_Core/inspector/InspectorBackendDispatcher.cpp	2019-04-25 17:36:58 UTC (rev 244652)
@@ -270,14 +270,6 @@
     m_protocolErrors.append(std::tuple<CommonErrorCode, String>(errorCode, errorMessage));
 }
 
-void BackendDispatcher::reportProtocolError(WTF::DeprecatedOptional<long> relatedRequestId, CommonErrorCode errorCode, const String& errorMessage)
-{
-    if (relatedRequestId)
-        reportProtocolError(relatedRequestId.value(), errorCode, errorMessage);
-    else
-        reportProtocolError(WTF::nullopt, errorCode, errorMessage);
-}
-
 template<typename T>
 T BackendDispatcher::getPropertyValue(JSON::Object* object, const String& name, bool* out_optionalValueFound, T defaultValue, std::function<bool(JSON::Value&, T&)> asMethod, const char* typeName)
 {

Modified: trunk/Source/_javascript_Core/inspector/InspectorBackendDispatcher.h (244651 => 244652)


--- trunk/Source/_javascript_Core/inspector/InspectorBackendDispatcher.h	2019-04-25 17:24:34 UTC (rev 244651)
+++ trunk/Source/_javascript_Core/inspector/InspectorBackendDispatcher.h	2019-04-25 17:36:58 UTC (rev 244652)
@@ -29,7 +29,6 @@
 #include "InspectorFrontendRouter.h"
 #include "InspectorProtocolTypes.h"
 #include <functional>
-#include <wtf/DeprecatedOptional.h>
 #include <wtf/Optional.h>
 #include <wtf/RefCounted.h>
 #include <wtf/text/WTFString.h>
@@ -110,9 +109,6 @@
 private:
     BackendDispatcher(Ref<FrontendRouter>&&);
 
-    // This is necessary for some versions of Safari. Remove it when those versions of Safari are no longer supported.
-    void reportProtocolError(WTF::DeprecatedOptional<long> relatedRequestId, CommonErrorCode, const String& errorMessage);
-
     Ref<FrontendRouter> m_frontendRouter;
     HashMap<String, SupplementalBackendDispatcher*> m_dispatchers;
 

Added: trunk/Source/_javascript_Core/inspector/InspectorBackendDispatcherCompatibility.cpp (0 => 244652)


--- trunk/Source/_javascript_Core/inspector/InspectorBackendDispatcherCompatibility.cpp	                        (rev 0)
+++ trunk/Source/_javascript_Core/inspector/InspectorBackendDispatcherCompatibility.cpp	2019-04-25 17:36:58 UTC (rev 244652)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2019 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. ``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
+ * 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.
+ */
+
+namespace std {
+template<typename> class optional { };
+}
+
+namespace WTF {
+class String;
+}
+
+namespace Inspector {
+
+class __attribute__((visibility("default"))) BackendDispatcher {
+private:
+    enum CommonErrorCode { NotUsed };
+    void reportProtocolError(std::optional<long>, CommonErrorCode, const WTF::String&);
+};
+
+// This symbol must be exported from _javascript_Core to maintain binary compatibility with iOS 12.
+// We can, and should, remove this entire file once we no longer need binary compatibility with iOS 12.
+void BackendDispatcher::reportProtocolError(std::optional<long>, CommonErrorCode, const WTF::String&)
+{
+}
+
+}

Modified: trunk/Source/WTF/ChangeLog (244651 => 244652)


--- trunk/Source/WTF/ChangeLog	2019-04-25 17:24:34 UTC (rev 244651)
+++ trunk/Source/WTF/ChangeLog	2019-04-25 17:36:58 UTC (rev 244652)
@@ -1,3 +1,14 @@
+2019-04-25  Alex Christensen  <[email protected]>
+
+        Remove DeprecatedOptional
+        https://bugs.webkit.org/show_bug.cgi?id=197161
+
+        Reviewed by Darin Adler.
+
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/CMakeLists.txt:
+        * wtf/DeprecatedOptional.h: Removed.
+
 2019-04-24  Carlos Garcia Campos  <[email protected]>
 
         [GTK] Hardcoded text color in input fields

Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (244651 => 244652)


--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2019-04-25 17:24:34 UTC (rev 244651)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2019-04-25 17:36:58 UTC (rev 244652)
@@ -468,7 +468,6 @@
 		A3EE5C3F21FFACA200FABD61 /* SchedulePairMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SchedulePairMac.mm; sourceTree = "<group>"; };
 		A5098AFF1C169E0700087797 /* SandboxSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SandboxSPI.h; sourceTree = "<group>"; };
 		A5098B011C16A4F900087797 /* SecuritySPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SecuritySPI.h; sourceTree = "<group>"; };
-		A561F30F1DF2642100FF675D /* DeprecatedOptional.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeprecatedOptional.h; sourceTree = "<group>"; };
 		A5BA15F2182433A900A82E69 /* StringCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StringCocoa.mm; sourceTree = "<group>"; };
 		A5BA15F41824348000A82E69 /* StringImplCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StringImplCocoa.mm; sourceTree = "<group>"; };
 		A5BA15F7182435A600A82E69 /* AtomicStringImplCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AtomicStringImplCF.cpp; sourceTree = "<group>"; };
@@ -925,7 +924,6 @@
 				A8A4727A151A825A004123FF /* DateMath.h */,
 				996B17841EBA441C007E10EB /* DebugUtilities.h */,
 				0F2B66A417B6B4F700A7AE3F /* DeferrableRefCounted.h */,
-				A561F30F1DF2642100FF675D /* DeprecatedOptional.h */,
 				A8A4727E151A825A004123FF /* Deque.h */,
 				A9A4727F151A825A004123FF /* DisallowCType.h */,
 				0F4570421BE5B58F0062A629 /* Dominators.h */,
@@ -1535,7 +1533,6 @@
 				A8A473C3151A825B004123FF /* FastMalloc.cpp in Sources */,
 				0F9D3360165DBA73005AD387 /* FilePrintStream.cpp in Sources */,
 				A331D95B21F24992009F02AA /* FileSystem.cpp in Sources */,
-				FE1E2C42224187C600F6B729 /* PlatformRegisters.cpp in Sources */,
 				A331D95D21F249E4009F02AA /* FileSystemCF.cpp in Sources */,
 				A331D95F21F249F6009F02AA /* FileSystemCocoa.mm in Sources */,
 				A331D96121F24A0A009F02AA /* FileSystemMac.mm in Sources */,
@@ -1577,8 +1574,10 @@
 				51F1752B1F3D486000C74950 /* PersistentCoders.cpp in Sources */,
 				51F1752C1F3D486000C74950 /* PersistentDecoder.cpp in Sources */,
 				51F1752D1F3D486000C74950 /* PersistentEncoder.cpp in Sources */,
+				FE1E2C42224187C600F6B729 /* PlatformRegisters.cpp in Sources */,
 				0F9D3362165DBA73005AD387 /* PrintStream.cpp in Sources */,
 				7AF023B52061E17000A8EFD6 /* ProcessPrivilege.cpp in Sources */,
+				FE1E2C3B2240C06600F6B729 /* PtrTag.cpp in Sources */,
 				143F611F1565F0F900DB514A /* RAMSize.cpp in Sources */,
 				A3B725EC987446AD93F1A440 /* RandomDevice.cpp in Sources */,
 				A8A47414151A825B004123FF /* RandomNumber.cpp in Sources */,
@@ -1629,7 +1628,6 @@
 				1C181C8F1D307AB800F5FA16 /* UTextProvider.cpp in Sources */,
 				1C181C911D307AB800F5FA16 /* UTextProviderLatin1.cpp in Sources */,
 				1C181C931D307AB800F5FA16 /* UTextProviderUTF16.cpp in Sources */,
-				FE1E2C3B2240C06600F6B729 /* PtrTag.cpp in Sources */,
 				A8A47469151A825B004123FF /* UTF8Conversion.cpp in Sources */,
 				7AFEC6B11EB22B5900DADE36 /* UUID.cpp in Sources */,
 				0F66B2921DC97BAB004A1D3F /* WallTime.cpp in Sources */,

Modified: trunk/Source/WTF/wtf/CMakeLists.txt (244651 => 244652)


--- trunk/Source/WTF/wtf/CMakeLists.txt	2019-04-25 17:24:34 UTC (rev 244651)
+++ trunk/Source/WTF/wtf/CMakeLists.txt	2019-04-25 17:36:58 UTC (rev 244652)
@@ -47,7 +47,6 @@
     DateMath.h
     DebugUtilities.h
     DeferrableRefCounted.h
-    DeprecatedOptional.h
     Deque.h
     DisallowCType.h
     Dominators.h

Deleted: trunk/Source/WTF/wtf/DeprecatedOptional.h (244651 => 244652)


--- trunk/Source/WTF/wtf/DeprecatedOptional.h	2019-04-25 17:24:34 UTC (rev 244651)
+++ trunk/Source/WTF/wtf/DeprecatedOptional.h	2019-04-25 17:36:58 UTC (rev 244652)
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2014, 2016 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.
- */
-
-// This file contains a deprecated version of std::optional which a released
-// version of Safari uses. Once Safari stops using this, we can remove this.
-// New code should use WTF::Optional.
-
-#pragma once
-
-#include <type_traits>
-#include <wtf/Optional.h>
-
-namespace std {
-
-template <class T>
-class optional : private WTF::OptionalBase<T> {
-public:
-    explicit constexpr operator bool() const __NOEXCEPT { return WTF::OptionalBase<T>::init_; }
-    constexpr T const& value() const& { return WTF::OptionalBase<T>::storage_.value_; }
-};
-
-}
-
-namespace WTF {
-
-template<typename T> using DeprecatedOptional = std::optional<T>;
-
-} // namespace WTF
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to