Begin deprecating C API
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Sep 2018 23:04:56 +0000 (23:04 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Sep 2018 23:04:56 +0000 (23:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=189810

Reviewed by Andy Estes.

* Shared/API/c/WKDeprecated.h: Added.
* UIProcess/API/C/WKPage.h:
* UIProcess/API/Cocoa/WKBrowsingContextController.mm:
(setUpPagePolicyClient):
(-[WKBrowsingContextController setPolicyDelegate:]):
* WebKit.xcodeproj/project.pbxproj:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236436 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/Shared/API/c/WKDeprecated.h [new file with mode: 0644]
Source/WebKit/UIProcess/API/C/WKPage.h
Source/WebKit/UIProcess/API/Cocoa/WKBrowsingContextController.mm
Source/WebKit/WebKit.xcodeproj/project.pbxproj

index 0a7782c..f62dfd1 100644 (file)
@@ -1,3 +1,17 @@
+2018-09-24  Alex Christensen  <achristensen@webkit.org>
+
+        Begin deprecating C API
+        https://bugs.webkit.org/show_bug.cgi?id=189810
+
+        Reviewed by Andy Estes.
+
+        * Shared/API/c/WKDeprecated.h: Added.
+        * UIProcess/API/C/WKPage.h:
+        * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
+        (setUpPagePolicyClient):
+        (-[WKBrowsingContextController setPolicyDelegate:]):
+        * WebKit.xcodeproj/project.pbxproj:
+
 2018-09-24  Chris Dumez  <cdumez@apple.com>
 
         Unreviewed, rolling out r236368.
diff --git a/Source/WebKit/Shared/API/c/WKDeprecated.h b/Source/WebKit/Shared/API/c/WKDeprecated.h
new file mode 100644 (file)
index 0000000..f9e2280
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2018 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
+
+#ifdef _MSC_VER
+#define WK_C_API_DEPRECATED_WITH_REPLACEMENT(...)
+#else
+#define WK_C_API_DEPRECATED_WITH_REPLACEMENT(_replacement, ...) __attribute__((deprecated("use " #_replacement)))
+#endif
index b041643..3abc221 100644 (file)
@@ -27,6 +27,7 @@
 #define WKPage_h
 
 #include <WebKit/WKBase.h>
+#include <WebKit/WKDeprecated.h>
 #include <WebKit/WKErrorRef.h>
 #include <WebKit/WKEvent.h>
 #include <WebKit/WKFindOptions.h>
@@ -224,8 +225,8 @@ WK_EXPORT void WKPageSetPageUIClient(WKPageRef page, const WKPageUIClientBase* c
 WK_EXPORT void WKPageSetPageInjectedBundleClient(WKPageRef page, const WKPageInjectedBundleClientBase* client);
 
 // A client can implement either a navigation client or loader and policy clients, but never both.
-WK_EXPORT void WKPageSetPageLoaderClient(WKPageRef page, const WKPageLoaderClientBase* client);
-WK_EXPORT void WKPageSetPagePolicyClient(WKPageRef page, const WKPagePolicyClientBase* client);
+WK_EXPORT void WKPageSetPageLoaderClient(WKPageRef page, const WKPageLoaderClientBase* client) WK_C_API_DEPRECATED_WITH_REPLACEMENT(WKPageSetPageNavigationClient, macosx(WK_MAC_TBA));
+WK_EXPORT void WKPageSetPagePolicyClient(WKPageRef page, const WKPagePolicyClientBase* client) WK_C_API_DEPRECATED_WITH_REPLACEMENT(WKPageSetPageNavigationClient, macosx(WK_MAC_TBA));
 WK_EXPORT void WKPageSetPageNavigationClient(WKPageRef page, const WKPageNavigationClientBase* client);
 
 typedef void (*WKPageRunJavaScriptFunction)(WKSerializedScriptValueRef, WKErrorRef, void*);
index 391127a..176858e 100644 (file)
@@ -514,7 +514,9 @@ static void setUpPagePolicyClient(WKBrowsingContextController *browsingContext,
             WKFramePolicyListenerUse(listener);
     };
 
+    ALLOW_DEPRECATED_DECLARATIONS_BEGIN
     WKPageSetPagePolicyClient(toAPI(&page), &policyClient.base);
+    ALLOW_DEPRECATED_DECLARATIONS_END
 }
 
 - (id <WKBrowsingContextLoadDelegate>)loadDelegate
@@ -543,8 +545,11 @@ static void setUpPagePolicyClient(WKBrowsingContextController *browsingContext,
 
     if (policyDelegate)
         setUpPagePolicyClient(self, *_page);
-    else
+    else {
+        ALLOW_DEPRECATED_DECLARATIONS_BEGIN
         WKPageSetPagePolicyClient(toAPI(_page.get()), nullptr);
+        ALLOW_DEPRECATED_DECLARATIONS_END
+    }
 }
 
 - (id <WKBrowsingContextHistoryDelegate>)historyDelegate
index 3dc029a..0cee874 100644 (file)
                5C20CBA01BB1ECD800895BB1 /* NetworkSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C20CB9E1BB0DD1800895BB1 /* NetworkSession.h */; };
                5C26958520043212005C439B /* WKOpenPanelParametersPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C26958420042F12005C439B /* WKOpenPanelParametersPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
                5C298DA01C3DF02100470AFE /* PendingDownload.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C298D9E1C3DEF2900470AFE /* PendingDownload.h */; };
+               5C359C0D2154739F009E7948 /* WKDeprecated.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C359C0C21547321009E7948 /* WKDeprecated.h */; settings = {ATTRIBUTES = (Private, ); }; };
                5C4B9D8B210A8CCF008F14D1 /* UndoOrRedo.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C4B9D8A210A8C46008F14D1 /* UndoOrRedo.h */; };
                5C62FDF91EFC271C00CE072E /* WKURLSchemeTaskPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C62FDF81EFC263C00CE072E /* WKURLSchemeTaskPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
                5C8DD3801FE4521600F2A556 /* WebsiteAutoplayPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C8DD37F1FE4519200F2A556 /* WebsiteAutoplayPolicy.h */; };
                5C20CB9E1BB0DD1800895BB1 /* NetworkSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkSession.h; sourceTree = "<group>"; };
                5C26958420042F12005C439B /* WKOpenPanelParametersPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKOpenPanelParametersPrivate.h; sourceTree = "<group>"; };
                5C298D9E1C3DEF2900470AFE /* PendingDownload.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PendingDownload.h; sourceTree = "<group>"; };
+               5C359C0C21547321009E7948 /* WKDeprecated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKDeprecated.h; sourceTree = "<group>"; };
                5C3AEA8E1FE1F1DF002318D3 /* WebsitePoliciesData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebsitePoliciesData.cpp; sourceTree = "<group>"; };
                5C4B9D8A210A8C46008F14D1 /* UndoOrRedo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UndoOrRedo.h; sourceTree = "<group>"; };
                5C62FDF81EFC263C00CE072E /* WKURLSchemeTaskPrivate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WKURLSchemeTaskPrivate.h; sourceTree = "<group>"; };
                                BC4075DB124FF0270068F20A /* WKData.cpp */,
                                BC4075DC124FF0270068F20A /* WKData.h */,
                                377EAD4417E2C51A002D193D /* WKDeclarationSpecifiers.h */,
+                               5C359C0C21547321009E7948 /* WKDeprecated.h */,
                                1AFF48FE1833DE78009AB15A /* WKDeprecatedFunctions.cpp */,
                                8372DB2E1A677D4A00C697C5 /* WKDiagnosticLoggingResultType.h */,
                                BC4075DD124FF0270068F20A /* WKDictionary.cpp */,
                                37A709A91E3EA40C00CA5969 /* WKDataDetectorTypesInternal.h in Headers */,
                                2E94FC1620351A6D00974BA0 /* WKDatePickerViewController.h in Headers */,
                                377EAD4517E2C51A002D193D /* WKDeclarationSpecifiers.h in Headers */,
+                               5C359C0D2154739F009E7948 /* WKDeprecated.h in Headers */,
                                8372DB2F1A677D4A00C697C5 /* WKDiagnosticLoggingResultType.h in Headers */,
                                BC4075FA124FF0270068F20A /* WKDictionary.h in Headers */,
                                BC017D0716260FF4007054F5 /* WKDOMDocument.h in Headers */,