Deprecate WKNotificationProvider
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Dec 2013 21:53:21 +0000 (21:53 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Dec 2013 21:53:21 +0000 (21:53 +0000)
https://bugs.webkit.org/show_bug.cgi?id=125178

Reviewed by Sam Weinig.

Source/WebKit2:

* Shared/API/c/WKDeclarationSpecifiers.h:
Add WK_DEPRECATED and WK_ENUM_DEPRECATED macros so we can things as deprecated.

* UIProcess/API/C/WKNotificationManager.cpp:
(WKNotificationManagerSetProvider):
* UIProcess/API/C/WKNotificationManager.h:
WKNotificationManagerSetProvider now takes a WKNotificationProviderBase.

* UIProcess/API/C/WKNotificationProvider.h:
Deprecate WKNotificationProvider and kWKNotificationProviderCurrentVersion.

Tools:

Update for WebKit2 changes.

* WebKitTestRunner/TestController.cpp:
(WTR::TestController::initialize):
* WebKitTestRunner/WebNotificationProvider.cpp:
(WTR::WebNotificationProvider::provider):
* WebKitTestRunner/WebNotificationProvider.h:

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

Source/WebKit2/ChangeLog
Source/WebKit2/Shared/API/c/WKDeclarationSpecifiers.h
Source/WebKit2/UIProcess/API/C/WKNotificationManager.cpp
Source/WebKit2/UIProcess/API/C/WKNotificationManager.h
Source/WebKit2/UIProcess/API/C/WKNotificationProvider.h
Tools/ChangeLog
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/WebNotificationProvider.cpp
Tools/WebKitTestRunner/WebNotificationProvider.h

index d387da5..14f22e1 100644 (file)
@@ -1,3 +1,21 @@
+2013-12-03  Anders Carlsson  <andersca@apple.com>
+
+        Deprecate WKNotificationProvider
+        https://bugs.webkit.org/show_bug.cgi?id=125178
+
+        Reviewed by Sam Weinig.
+
+        * Shared/API/c/WKDeclarationSpecifiers.h:
+        Add WK_DEPRECATED and WK_ENUM_DEPRECATED macros so we can things as deprecated.
+
+        * UIProcess/API/C/WKNotificationManager.cpp:
+        (WKNotificationManagerSetProvider):
+        * UIProcess/API/C/WKNotificationManager.h:
+        WKNotificationManagerSetProvider now takes a WKNotificationProviderBase.
+
+        * UIProcess/API/C/WKNotificationProvider.h:
+        Deprecate WKNotificationProvider and kWKNotificationProviderCurrentVersion.
+
 2013-12-03  Brady Eidson  <beidson@apple.com>
 
         Indexed Database work should be done on a non-main queue
index 50ba028..070c28c 100644 (file)
 #endif
 #endif /* !defined(WK_INLINE) */
 
+#if defined(__has_extension) && __has_extension(enumerator_attributes) && __has_extension(attribute_unavailable_with_message)
+#define WK_DEPRECATED(message) __attribute__((deprecated(message)))
+#else
+#define WK_DEPRECATED(message)
+#endif
+
+#if defined(__has_extension) && __has_extension(enumerator_attributes) && __has_extension(attribute_unavailable_with_message)
+#define WK_ENUM_DEPRECATED(message) __attribute__((deprecated(message)))
+#else
+#define WK_ENUM_DEPRECATED(message)
+#endif
+
 #endif /* WKDeclarationSpecifiers_h */
index fae2713..1e050a6 100644 (file)
@@ -36,9 +36,9 @@ WKTypeID WKNotificationManagerGetTypeID()
     return toAPI(WebNotificationManagerProxy::APIType);
 }
 
-void WKNotificationManagerSetProvider(WKNotificationManagerRef managerRef, const WKNotificationProvider* wkProvider)
+void WKNotificationManagerSetProvider(WKNotificationManagerRef managerRef, const WKNotificationProviderBase* wkProvider)
 {
-    toImpl(managerRef)->initializeProvider(reinterpret_cast<const WKNotificationProviderBase*>(wkProvider));
+    toImpl(managerRef)->initializeProvider(wkProvider);
 }
 
 void WKNotificationManagerProviderDidShowNotification(WKNotificationManagerRef managerRef, uint64_t notificationID)
index 7074a21..50f50d7 100644 (file)
@@ -34,7 +34,7 @@ extern "C" {
 #endif
 
 WK_EXPORT WKTypeID WKNotificationManagerGetTypeID();
-WK_EXPORT void WKNotificationManagerSetProvider(WKNotificationManagerRef managerRef, const WKNotificationProvider* wkProvider);
+WK_EXPORT void WKNotificationManagerSetProvider(WKNotificationManagerRef managerRef, const WKNotificationProviderBase* wkProvider);
 
 WK_EXPORT void WKNotificationManagerProviderDidShowNotification(WKNotificationManagerRef managerRef, uint64_t notificationID);
 WK_EXPORT void WKNotificationManagerProviderDidClickNotification(WKNotificationManagerRef managerRef, uint64_t notificationID);
index b59a8ea..920e297 100644 (file)
@@ -58,8 +58,7 @@ typedef struct WKNotificationProviderV0 {
     WKNotificationProviderClearNotificationsCallback                      clearNotifications;
 } WKNotificationProviderV0;
 
-// FIXME: Deprecate.
-enum { kWKNotificationProviderCurrentVersion = 0 };
+enum { kWKNotificationProviderCurrentVersion WK_ENUM_DEPRECATED("Use an explicit version number instead") = 0, };
 typedef struct WKNotificationProvider {
     int                                                                   version;
     const void*                                                           clientInfo;
@@ -72,7 +71,7 @@ typedef struct WKNotificationProvider {
     WKNotificationProviderRemoveNotificationManagerCallback               removeNotificationManager;
     WKNotificationProviderNotificationPermissionsCallback                 notificationPermissions;
     WKNotificationProviderClearNotificationsCallback                      clearNotifications;
-} WKNotificationProvider;
+} WKNotificationProvider WK_DEPRECATED("Use an explicit versioned struct instead");
 
 #ifdef __cplusplus
 }
index 5203d0e..4d46af4 100644 (file)
@@ -1,3 +1,18 @@
+2013-12-03  Anders Carlsson  <andersca@apple.com>
+
+        Deprecate WKNotificationProvider
+        https://bugs.webkit.org/show_bug.cgi?id=125178
+
+        Reviewed by Sam Weinig.
+
+        Update for WebKit2 changes.
+
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::initialize):
+        * WebKitTestRunner/WebNotificationProvider.cpp:
+        (WTR::WebNotificationProvider::provider):
+        * WebKitTestRunner/WebNotificationProvider.h:
+
 2013-12-03  Brent Fulgham  <bfulgham@apple.com>
 
         [Win] Support 64-bit Application Support Libraries Location 
index 34e283f..f654223 100644 (file)
@@ -376,8 +376,8 @@ void TestController::initialize(int argc, const char* argv[])
     WKContextSetInjectedBundleClient(m_context.get(), &injectedBundleClient);
 
     WKNotificationManagerRef notificationManager = WKContextGetNotificationManager(m_context.get());
-    WKNotificationProvider notificationKit = m_webNotificationProvider.provider();
-    WKNotificationManagerSetProvider(notificationManager, &notificationKit);
+    WKNotificationProviderV0 notificationKit = m_webNotificationProvider.provider();
+    WKNotificationManagerSetProvider(notificationManager, &notificationKit.base);
 
     if (testPluginDirectory())
         WKContextSetAdditionalPluginsDirectory(m_context.get(), testPluginDirectory());
index 14c9530..5506424 100644 (file)
@@ -68,11 +68,10 @@ WebNotificationProvider::~WebNotificationProvider()
     WKNotificationManagerSetProvider(m_notificationManager.get(), 0);
 }
 
-WKNotificationProvider WebNotificationProvider::provider()
+WKNotificationProviderV0 WebNotificationProvider::provider()
 {
-    WKNotificationProvider notificationProvider = {
-        kWKNotificationProviderCurrentVersion,
-        this,
+    WKNotificationProviderV0 notificationProvider = {
+        { kWKNotificationProviderCurrentVersion, this },
         WTR::showWebNotification,
         WTR::closeWebNotification,
         0, // didDestroyNotification
index b250829..fba2870 100644 (file)
@@ -37,7 +37,7 @@ class WebNotificationProvider {
 public:
     WebNotificationProvider();
     ~WebNotificationProvider();
-    WKNotificationProvider provider();
+    WKNotificationProviderV0 provider();
 
     void showWebNotification(WKPageRef, WKNotificationRef);
     void closeWebNotification(WKNotificationRef);