Title: [169356] trunk/Source/WebKit2
Revision
169356
Author
m...@apple.com
Date
2014-05-26 11:00:47 -0700 (Mon, 26 May 2014)

Log Message

[Cocoa] Rewrite WK_DESIGNATED_INITIALIZER in installed headers
https://bugs.webkit.org/show_bug.cgi?id=133290

Reviewed by Anders Carlsson.

* Shared/API/Cocoa/WKFoundation.h: When WK_API_AVAILABILITY_ENABLED is defined, don’t
provide definitions of WK_DESIGNATED_INITIALIZER and WK_UNAVAILABLE, since those macros will
be rewritten out of the headers. When WK_API_AVAILABILITY_ENABLED isn’t defined, provide
definitions of the other two macros as appropriate for the target OS.
* UIProcess/API/Cocoa/WKProcessPoolPrivate.h: Removed WK_DESIGNATED_INITIALIZER from a
category method declaration.
* UIProcess/API/Cocoa/WKWebView.h: Mark the superclass designated initializer
-initWithCoder: as unavailable.
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView initWithCoder:]): Override this designated initializer of the superclass by
returning nil.
* mac/rewrite-availability-macros.sh: Rewrite WK_DESIGNATED_INITIALIZER to
NS_DESIGNATED_INITIALIZER and WK_UNAVAILABLE to NS_UNAVAILABLE. Also make sure to process
all headers if the script has changed since the last time it was run.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (169355 => 169356)


--- trunk/Source/WebKit2/ChangeLog	2014-05-26 17:45:08 UTC (rev 169355)
+++ trunk/Source/WebKit2/ChangeLog	2014-05-26 18:00:47 UTC (rev 169356)
@@ -1,3 +1,25 @@
+2014-05-26  Dan Bernstein  <m...@apple.com>
+
+        [Cocoa] Rewrite WK_DESIGNATED_INITIALIZER in installed headers
+        https://bugs.webkit.org/show_bug.cgi?id=133290
+
+        Reviewed by Anders Carlsson.
+
+        * Shared/API/Cocoa/WKFoundation.h: When WK_API_AVAILABILITY_ENABLED is defined, don’t
+        provide definitions of WK_DESIGNATED_INITIALIZER and WK_UNAVAILABLE, since those macros will
+        be rewritten out of the headers. When WK_API_AVAILABILITY_ENABLED isn’t defined, provide
+        definitions of the other two macros as appropriate for the target OS.
+        * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: Removed WK_DESIGNATED_INITIALIZER from a
+        category method declaration.
+        * UIProcess/API/Cocoa/WKWebView.h: Mark the superclass designated initializer
+        -initWithCoder: as unavailable.
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView initWithCoder:]): Override this designated initializer of the superclass by
+        returning nil.
+        * mac/rewrite-availability-macros.sh: Rewrite WK_DESIGNATED_INITIALIZER to
+        NS_DESIGNATED_INITIALIZER and WK_UNAVAILABLE to NS_UNAVAILABLE. Also make sure to process
+        all headers if the script has changed since the last time it was run.
+
 2014-05-26  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, rolling out r169122.

Modified: trunk/Source/WebKit2/Shared/API/Cocoa/WKFoundation.h (169355 => 169356)


--- trunk/Source/WebKit2/Shared/API/Cocoa/WKFoundation.h	2014-05-26 17:45:08 UTC (rev 169355)
+++ trunk/Source/WebKit2/Shared/API/Cocoa/WKFoundation.h	2014-05-26 18:00:47 UTC (rev 169356)
@@ -47,13 +47,19 @@
 
 #if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 1090
 
+#define WK_DESIGNATED_INITIALIZER
+#define WK_UNAVAILABLE
+
 #ifdef __OBJC__
 #import <Foundation/Foundation.h>
 typedef NSUInteger NSEventModifierFlags;
 #endif
 
+#else
+
+#define WK_DESIGNATED_INITIALIZER NS_DESIGNATED_INITIALIZER
+#define WK_UNAVAILABLE NS_UNAVAILABLE
+
 #endif
 
 #endif
-
-#define WK_DESIGNATED_INITIALIZER

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h (169355 => 169356)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h	2014-05-26 17:45:08 UTC (rev 169355)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h	2014-05-26 18:00:47 UTC (rev 169356)
@@ -32,7 +32,7 @@
 
 @interface WKProcessPool (WKPrivate)
 
-- (instancetype)_initWithConfiguration:(_WKProcessPoolConfiguration *)configuration __attribute__((objc_method_family(init))) WK_DESIGNATED_INITIALIZER;
+- (instancetype)_initWithConfiguration:(_WKProcessPoolConfiguration *)configuration __attribute__((objc_method_family(init)));
 
 @property (nonatomic, readonly) _WKProcessPoolConfiguration *_configuration;
 

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.h (169355 => 169356)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.h	2014-05-26 17:45:08 UTC (rev 169355)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.h	2014-05-26 18:00:47 UTC (rev 169356)
@@ -79,6 +79,8 @@
  */
 - (instancetype)initWithFrame:(CGRect)frame configuration:(WKWebViewConfiguration *)configuration WK_DESIGNATED_INITIALIZER;
 
+- (instancetype)initWithCoder:(NSCoder *)coder WK_UNAVAILABLE;
+
 /*! @abstract Navigates to the given NSURLRequest.
  @param request The NSURLRequest to navigate to.
  @result A new navigation for the given request.

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (169355 => 169356)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2014-05-26 17:45:08 UTC (rev 169355)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2014-05-26 18:00:47 UTC (rev 169356)
@@ -268,6 +268,12 @@
     return self;
 }
 
+- (instancetype)initWithCoder:(NSCoder *)coder
+{
+    [self release];
+    return nil;
+}
+
 - (void)dealloc
 {
     _page->close();

Modified: trunk/Source/WebKit2/mac/rewrite-availability-macros.sh (169355 => 169356)


--- trunk/Source/WebKit2/mac/rewrite-availability-macros.sh	2014-05-26 17:45:08 UTC (rev 169355)
+++ trunk/Source/WebKit2/mac/rewrite-availability-macros.sh	2014-05-26 18:00:47 UTC (rev 169356)
@@ -30,10 +30,14 @@
 
 TIMESTAMP_PATH=${TARGET_TEMP_DIR}/${0##*/}
 
+if [[ $0 -nt $TIMESTAMP_PATH ]]; then
+    rm "${TIMESTAMP_PATH}";
+fi
+
 function rewrite_headers () {
     for HEADER_PATH in $1/*.h; do
         if [[ $HEADER_PATH -nt $TIMESTAMP_PATH ]]; then
-            sed -e s/^WK_CLASS_AVAILABLE/NS_CLASS_AVAILABLE/ -e s/WK_AVAILABLE/NS_AVAILABLE/ -e s/WK_ENUM_AVAILABLE/NS_ENUM_AVAILABLE/ ${HEADER_PATH} > ${TARGET_TEMP_DIR}/${HEADER_PATH##*/} || exit $_;
+            sed -e s/^WK_CLASS_AVAILABLE/NS_CLASS_AVAILABLE/ -e s/WK_AVAILABLE/NS_AVAILABLE/ -e s/WK_DESIGNATED_INITIALIZER/NS_DESIGNATED_INITIALIZER/ -e s/WK_ENUM_AVAILABLE/NS_ENUM_AVAILABLE/ -e s/WK_UNAVAILABLE/NS_UNAVAILABLE/ ${HEADER_PATH} > ${TARGET_TEMP_DIR}/${HEADER_PATH##*/} || exit $_;
             mv ${TARGET_TEMP_DIR}/${HEADER_PATH##*/} $HEADER_PATH;
         fi
     done
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to