Add helper macro for forward declaring objective-c classes
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Jan 2012 23:46:16 +0000 (23:46 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Jan 2012 23:46:16 +0000 (23:46 +0000)
https://bugs.webkit.org/show_bug.cgi?id=76485

Reviewed by Anders Carlsson.

Source/JavaScriptCore:

* wtf/Compiler.h:
Add OBJC_CLASS macro which helps reduce code when forward declaring an
objective-c class in a header which can be included from both Objective-C
and non-Objective-C files.

Source/WebCore:

* accessibility/AccessibilityObject.h:
* bindings/js/ScriptController.h:
* bridge/objc/objc_utility.h:
* page/DragClient.h:
* page/EditorClient.h:
* platform/AutodrainedPool.h:
* platform/ContextMenuItem.h:
* platform/Cursor.h:
* platform/DragData.h:
* platform/DragImage.h:
* platform/KURL.h:
* platform/Pasteboard.h:
* platform/PlatformKeyboardEvent.h:
* platform/PlatformMenuDescription.h:
* platform/PlatformScreen.h:
* platform/SharedBuffer.h:
* platform/Widget.h:
* platform/cf/SchedulePair.h:
* platform/graphics/BitmapImage.h:
* platform/graphics/FontPlatformData.h:
* platform/graphics/GraphicsContext3D.h:
* platform/graphics/GraphicsLayer.h:
* platform/graphics/Icon.h:
* platform/graphics/Image.h:
* platform/graphics/MediaPlayer.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
* platform/graphics/ca/PlatformCAAnimation.h:
* platform/graphics/ca/mac/TileCache.h:
* platform/graphics/mac/ColorMac.h:
* platform/graphics/mac/MediaPlayerPrivateQTKit.h:
* platform/graphics/mac/MediaPlayerProxy.h:
* platform/mac/ClipboardMac.h:
* platform/mac/LocalCurrentGraphicsContext.h:
* platform/mac/PasteboardHelper.h:
* platform/mac/PopupMenuMac.h:
* platform/mac/ScrollAnimatorMac.h:
* platform/mac/WebCoreSystemInterface.h:
* platform/network/ResourceHandle.h:
* platform/network/ResourceHandleClient.h:
* platform/network/ResourceHandleInternal.h:
* platform/network/cf/AuthenticationChallenge.h:
* platform/network/cf/ResourceError.h:
* platform/network/cf/ResourceRequest.h:
* platform/network/cf/ResourceResponse.h:
* rendering/RenderThemeMac.h:
Deploy OBJC_CLASS for a little code reduction.

Source/WebKit2:

* WebProcess/WebCoreSupport/WebDragClient.h:
Deploy OBJC_CLASS for a little code reduction.

* config.h:
Remove duplicate copy of OBJC_CLASS.

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

51 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/wtf/Compiler.h
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityObject.h
Source/WebCore/bindings/js/ScriptController.h
Source/WebCore/bridge/objc/objc_utility.h
Source/WebCore/page/DragClient.h
Source/WebCore/page/EditorClient.h
Source/WebCore/platform/AutodrainedPool.h
Source/WebCore/platform/ContextMenuItem.h
Source/WebCore/platform/Cursor.h
Source/WebCore/platform/DragData.h
Source/WebCore/platform/DragImage.h
Source/WebCore/platform/KURL.h
Source/WebCore/platform/Pasteboard.h
Source/WebCore/platform/PlatformKeyboardEvent.h
Source/WebCore/platform/PlatformMenuDescription.h
Source/WebCore/platform/PlatformScreen.h
Source/WebCore/platform/SharedBuffer.h
Source/WebCore/platform/Widget.h
Source/WebCore/platform/cf/SchedulePair.h
Source/WebCore/platform/graphics/BitmapImage.h
Source/WebCore/platform/graphics/FontPlatformData.h
Source/WebCore/platform/graphics/GraphicsContext3D.h
Source/WebCore/platform/graphics/GraphicsLayer.h
Source/WebCore/platform/graphics/Icon.h
Source/WebCore/platform/graphics/Image.h
Source/WebCore/platform/graphics/MediaPlayer.h
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h
Source/WebCore/platform/graphics/ca/PlatformCAAnimation.h
Source/WebCore/platform/graphics/ca/mac/TileCache.h
Source/WebCore/platform/graphics/mac/ColorMac.h
Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h
Source/WebCore/platform/graphics/mac/MediaPlayerProxy.h
Source/WebCore/platform/mac/ClipboardMac.h
Source/WebCore/platform/mac/LocalCurrentGraphicsContext.h
Source/WebCore/platform/mac/PasteboardHelper.h
Source/WebCore/platform/mac/PopupMenuMac.h
Source/WebCore/platform/mac/ScrollAnimatorMac.h
Source/WebCore/platform/mac/WebCoreSystemInterface.h
Source/WebCore/platform/network/ResourceHandle.h
Source/WebCore/platform/network/ResourceHandleClient.h
Source/WebCore/platform/network/ResourceHandleInternal.h
Source/WebCore/platform/network/cf/AuthenticationChallenge.h
Source/WebCore/platform/network/cf/ResourceError.h
Source/WebCore/platform/network/cf/ResourceRequest.h
Source/WebCore/platform/network/cf/ResourceResponse.h
Source/WebCore/rendering/RenderThemeMac.h
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h
Source/WebKit2/config.h

index 27a7b79..eb5f466 100644 (file)
@@ -1,3 +1,15 @@
+2012-01-17  Sam Weinig  <sam@webkit.org>
+
+        Add helper macro for forward declaring objective-c classes
+        https://bugs.webkit.org/show_bug.cgi?id=76485
+
+        Reviewed by Anders Carlsson.
+
+        * wtf/Compiler.h:
+        Add OBJC_CLASS macro which helps reduce code when forward declaring an
+        objective-c class in a header which can be included from both Objective-C
+        and non-Objective-C files.
+
 2012-01-17  Filip Pizlo  <fpizlo@apple.com>
 
         DFG should be able to do JS and custom getter caching
index 93d3316..96ad6e4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 #define FINAL
 #endif
 
+/* OBJC_CLASS */
+
+#ifndef OBJC_CLASS
+#ifdef __OBJC__
+#define OBJC_CLASS @class
+#else
+#define OBJC_CLASS class
+#endif
+#endif
+
 #endif /* WTF_Compiler_h */
index 95dd985..45692a8 100644 (file)
@@ -1,3 +1,57 @@
+2012-01-17  Sam Weinig  <sam@webkit.org>
+
+        Add helper macro for forward declaring objective-c classes
+        https://bugs.webkit.org/show_bug.cgi?id=76485
+
+        Reviewed by Anders Carlsson.
+
+        * accessibility/AccessibilityObject.h:
+        * bindings/js/ScriptController.h:
+        * bridge/objc/objc_utility.h:
+        * page/DragClient.h:
+        * page/EditorClient.h:
+        * platform/AutodrainedPool.h:
+        * platform/ContextMenuItem.h:
+        * platform/Cursor.h:
+        * platform/DragData.h:
+        * platform/DragImage.h:
+        * platform/KURL.h:
+        * platform/Pasteboard.h:
+        * platform/PlatformKeyboardEvent.h:
+        * platform/PlatformMenuDescription.h:
+        * platform/PlatformScreen.h:
+        * platform/SharedBuffer.h:
+        * platform/Widget.h:
+        * platform/cf/SchedulePair.h:
+        * platform/graphics/BitmapImage.h:
+        * platform/graphics/FontPlatformData.h:
+        * platform/graphics/GraphicsContext3D.h:
+        * platform/graphics/GraphicsLayer.h:
+        * platform/graphics/Icon.h:
+        * platform/graphics/Image.h:
+        * platform/graphics/MediaPlayer.h:
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
+        * platform/graphics/ca/PlatformCAAnimation.h:
+        * platform/graphics/ca/mac/TileCache.h:
+        * platform/graphics/mac/ColorMac.h:
+        * platform/graphics/mac/MediaPlayerPrivateQTKit.h:
+        * platform/graphics/mac/MediaPlayerProxy.h:
+        * platform/mac/ClipboardMac.h:
+        * platform/mac/LocalCurrentGraphicsContext.h:
+        * platform/mac/PasteboardHelper.h:
+        * platform/mac/PopupMenuMac.h:
+        * platform/mac/ScrollAnimatorMac.h:
+        * platform/mac/WebCoreSystemInterface.h:
+        * platform/network/ResourceHandle.h:
+        * platform/network/ResourceHandleClient.h:
+        * platform/network/ResourceHandleInternal.h:
+        * platform/network/cf/AuthenticationChallenge.h:
+        * platform/network/cf/ResourceError.h:
+        * platform/network/cf/ResourceRequest.h:
+        * platform/network/cf/ResourceResponse.h:
+        * rendering/RenderThemeMac.h:
+        Deploy OBJC_CLASS for a little code reduction.
+
 2012-01-17  Andreas Kling  <awesomekling@apple.com>
 
         SpaceSplitString: Share equivalent string piece vectors.
index 428324d..737e2df 100644 (file)
 #include "AccessibilityObjectWrapper.h"
 #endif
 
+#if PLATFORM(MAC)
+
 typedef struct _NSRange NSRange;
 
-#ifdef __OBJC__
-@class NSArray;
-@class NSAttributedString;
-@class NSData;
-@class NSMutableAttributedString;
-@class NSString;
-@class NSValue;
-@class NSView;
-@class WebAccessibilityObjectWrapper;
-#else
-class NSArray;
-class NSAttributedString;
-class NSData;
-class NSMutableAttributedString;
-class NSString;
-class NSValue;
-class NSView;
-#if PLATFORM(GTK)
+OBJC_CLASS NSArray;
+OBJC_CLASS NSAttributedString;
+OBJC_CLASS NSData;
+OBJC_CLASS NSMutableAttributedString;
+OBJC_CLASS NSString;
+OBJC_CLASS NSValue;
+OBJC_CLASS NSView;
+OBJC_CLASS WebAccessibilityObjectWrapper;
+
+typedef WebAccessibilityObjectWrapper AccessibilityObjectWrapper;
+
+#elif PLATFORM(GTK)
 typedef struct _AtkObject AtkObject;
 typedef struct _AtkObject AccessibilityObjectWrapper;
-#elif PLATFORM(MAC)
-class WebAccessibilityObjectWrapper;
 #else
 class AccessibilityObjectWrapper;
 #endif
-#endif
-
-#if PLATFORM(MAC)
-typedef WebAccessibilityObjectWrapper AccessibilityObjectWrapper;
-#endif
 
 namespace WebCore {
 
index d672f42..6b662da 100644 (file)
 
 #if PLATFORM(MAC)
 #include <wtf/RetainPtr.h>
-
-#ifdef __OBJC__
-@class WebScriptObject;
-#else
-class WebScriptObject;
-#endif
+OBJC_CLASS WebScriptObject;
 #endif
 
 struct NPObject;
index 4810752..533c11e 100644 (file)
 #include <runtime/Error.h>
 #include <runtime/JSObject.h>
 
-#ifdef __OBJC__
-@class NSString;
-#else
-class NSString;
-#endif
+OBJC_CLASS NSString;
 
 namespace JSC {
 namespace Bindings {
index ea70c5e..090c29d 100644 (file)
 #include "IntPoint.h"
 
 #if PLATFORM(MAC)
-#ifdef __OBJC__
-@class DOMElement;
-@class NSURL;
-@class NSString;
-@class NSPasteboard;
-#else
-class DOMElement;
-class NSURL;
-class NSString;
-class NSPasteboard;
-#endif
+OBJC_CLASS DOMElement;
+OBJC_CLASS NSURL;
+OBJC_CLASS NSString;
+OBJC_CLASS NSPasteboard;
 #endif
 
 namespace WebCore {
index 5a4be2c..4d33e9f 100644 (file)
 #include <wtf/Vector.h>
 
 #if PLATFORM(MAC)
-#ifdef __OBJC__
-@class NSAttributedString;
-@class NSPasteboard;
-@class NSString;
-@class NSURL;
-#else
-class NSAttributedString;
-class NSPasteboard;
-class NSString;
-class NSURL;
-#endif
+OBJC_CLASS NSAttributedString;
+OBJC_CLASS NSPasteboard;
+OBJC_CLASS NSString;
+OBJC_CLASS NSURL;
 #endif
 
 namespace WebCore {
index f03ec81..207aadc 100644 (file)
 
 #include <wtf/Noncopyable.h>
 
-#ifdef __OBJC__
-@class NSAutoreleasePool;
-#else
-class NSAutoreleasePool;
-#endif
+OBJC_CLASS NSAutoreleasePool;
 
 namespace WebCore {
 
index c1c1825..2520c64 100644 (file)
 
 #if PLATFORM(MAC)
 #include <wtf/RetainPtr.h>
-
-#ifdef __OBJC__
-@class NSMenuItem;
-#else
-class NSMenuItem;
-#endif
+OBJC_CLASS NSMenuItem;
 #elif PLATFORM(WIN)
 typedef struct tagMENUITEMINFOW MENUITEMINFO;
 #elif PLATFORM(GTK)
index c324ef0..bc51840 100644 (file)
@@ -46,11 +46,7 @@ typedef HICON HCURSOR;
 #endif
 
 #if PLATFORM(MAC) && !PLATFORM(IOS)
-#ifdef __OBJC__
-@class NSCursor;
-#else
-class NSCursor;
-#endif
+OBJC_CLASS NSCursor;
 #endif
 
 #if PLATFORM(WX)
index bb242f9..17abd44 100644 (file)
 
 #if PLATFORM(MAC)
 #include <wtf/RetainPtr.h>
+
 #ifdef __OBJC__ 
 #import <Foundation/Foundation.h>
 #import <AppKit/NSDragging.h>
 typedef id <NSDraggingInfo> DragDataRef;
-@class NSPasteboard;
 #else
 typedef void* DragDataRef;
-class NSPasteboard;
 #endif
+
+OBJC_CLASS NSPasteboard;
+
 #elif PLATFORM(QT)
 QT_BEGIN_NAMESPACE
 class QMimeData;
index 811fa56..a22db6a 100644 (file)
 
 #if PLATFORM(MAC)
 #include <wtf/RetainPtr.h>
-#ifdef __OBJC__
-@class NSImage;
-#else
-class NSImage;
-#endif
+OBJC_CLASS NSImage;
 #elif PLATFORM(QT)
 QT_BEGIN_NAMESPACE
 class QPixmap;
index 49cd951..8dec81f 100644 (file)
@@ -35,11 +35,7 @@ typedef const struct __CFURL* CFURLRef;
 #endif
 
 #if PLATFORM(MAC) || (PLATFORM(QT) && USE(QTKIT))
-#ifdef __OBJC__
-@class NSURL;
-#else
-class NSURL;
-#endif
+OBJC_CLASS NSURL;
 #endif
 
 #if PLATFORM(QT)
index 866e7e5..8791d39 100644 (file)
 // knowledge of the frame and editor or moved into the editing directory.
 
 #if PLATFORM(MAC)
-#ifdef __OBJC__
-@class NSFileWrapper;
-@class NSPasteboard;
-@class NSArray;
-#else
-class NSFileWrapper;
-class NSPasteboard;
-class NSArray;
-#endif
+OBJC_CLASS NSFileWrapper;
+OBJC_CLASS NSPasteboard;
+OBJC_CLASS NSArray;
 #endif
 
 #if PLATFORM(WIN)
index f154966..5990098 100644 (file)
 
 #if PLATFORM(MAC)
 #include <wtf/RetainPtr.h>
-#ifdef __OBJC__
-@class NSEvent;
-#else
-class NSEvent;
-#endif
+OBJC_CLASS NSEvent;
 #endif
 
 #if PLATFORM(WIN)
index 08845cb..459d0a5 100644 (file)
 #define PlatformMenuDescription_h
 
 #if PLATFORM(MAC)
-#ifdef __OBJC__
-@class NSMutableArray;
-#else
-class NSMutableArray;
-#endif
+OBJC_CLASS NSMutableArray;
 #elif PLATFORM(QT)
 #include <qlist.h>
 #elif PLATFORM(GTK)
index a9acb5d..b4c78a5 100644 (file)
 #include <wtf/RefPtr.h>
 
 #if PLATFORM(MAC)
-#ifdef __OBJC__
-    @class NSScreen;
-    @class NSWindow;
-#else
-    class NSScreen;
-    class NSWindow;
-#endif
+OBJC_CLASS NSScreen;
+OBJC_CLASS NSWindow;
 #endif
 
 typedef uint32_t PlatformDisplayID;
index d85abba..57cfc29 100644 (file)
@@ -23,6 +23,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
+
 #ifndef SharedBuffer_h
 #define SharedBuffer_h
 
 #endif
 
 #if PLATFORM(MAC) || (PLATFORM(QT) && USE(QTKIT))
-#ifdef __OBJC__
-@class NSData;
-#else
-class NSData;
-#endif
-
+OBJC_CLASS NSData;
 #endif
 
 namespace WebCore {
index 9fddf70..3f19b61 100644 (file)
 #endif
 
 #if PLATFORM(MAC)
-#ifdef __OBJC__
-@class NSView;
-@class NSWindow;
-#else
-class NSView;
-class NSWindow;
-#endif
+OBJC_CLASS NSView;
+OBJC_CLASS NSWindow;
 typedef NSView *PlatformWidget;
 #endif
 
index 5172436..764c29f 100644 (file)
 #include <wtf/RetainPtr.h>
 
 #if PLATFORM(MAC)
-#ifdef __OBJC__
-@class NSRunLoop;
-#else
-class NSRunLoop;
-#endif
+OBJC_CLASS NSRunLoop;
 #endif
 
 namespace WebCore {
index f4d50ce..00802f6 100644 (file)
 
 #if PLATFORM(MAC)
 #include <wtf/RetainPtr.h>
-#ifdef __OBJC__
-@class NSImage;
-#else
-class NSImage;
-#endif
+OBJC_CLASS NSImage;
 #endif
 
 #if PLATFORM(WIN)
index 1fcba31..705c588 100644 (file)
 #endif
 
 #if OS(DARWIN)
-#ifdef __OBJC__
-@class NSFont;
-#else
-class NSFont;
-#endif
+OBJC_CLASS NSFont;
 
 typedef struct CGFont* CGFontRef;
 typedef const struct __CTFont* CTFontRef;
index e4f69d8..dfebbba 100644 (file)
 #if PLATFORM(MAC)
 #include <OpenGL/OpenGL.h>
 #include <wtf/RetainPtr.h>
-#ifdef __OBJC__
-@class CALayer;
-@class WebGLLayer;
-#else
-class CALayer;
-class WebGLLayer;
-#endif
+OBJC_CLASS CALayer;
+OBJC_CLASS WebGLLayer;
 #elif PLATFORM(QT)
 QT_BEGIN_NAMESPACE
 class QPainter;
index 14750c6..a6936c2 100644 (file)
 #include <wtf/PassOwnPtr.h>
 
 #if PLATFORM(MAC)
-#ifdef __OBJC__
-@class CALayer;
-#else
-class CALayer;
-#endif
+OBJC_CLASS CALayer;
 typedef CALayer PlatformLayer;
 #elif PLATFORM(WIN)
 typedef struct _CACFLayer PlatformLayer;
index 2797133..781a08c 100644 (file)
 
 #if PLATFORM(MAC)
 #include <wtf/RetainPtr.h>
-#ifdef __OBJC__
-@class NSImage;
-#else
-class NSImage;
-#endif
+OBJC_CLASS NSImage;
 #elif PLATFORM(WIN)
 typedef struct HICON__* HICON;
 #elif PLATFORM(QT)
index 21b37d3..b78fc7d 100644 (file)
 #include <wtf/text/WTFString.h>
 
 #if PLATFORM(MAC)
-#ifdef __OBJC__
-@class NSImage;
-#else
-class NSImage;
-#endif
+OBJC_CLASS NSImage;
 #endif
 
 #if USE(CG)
index da53de1..bde35cd 100644 (file)
 #include "GraphicsLayer.h"
 #endif
 
-#ifdef __OBJC__
-@class AVPlayer;
-@class QTMovie;
-#else
-class AVPlayer;
-class QTMovie;
-#endif
+OBJC_CLASS AVPlayer;
+OBJC_CLASS QTMovie;
+
 class AVCFPlayer;
 class QTMovieGWorld;
 class QTMovieVisualContext;
index 7fd2465..dcc046d 100644 (file)
 
 #include "MediaPlayerPrivateAVFoundation.h"
 
-#ifdef __OBJC__
-@class AVAsset;
-@class AVPlayer;
-@class AVPlayerItem;
-@class AVPlayerLayer;
-@class AVAssetImageGenerator;
-@class WebCoreAVFMovieObserver;
-#else
-class AVAsset;
-class AVPlayer;
-class AVPlayerItem;
-class AVPlayerLayer;
-class AVAssetImageGenerator;
-class WebCoreAVFMovieObserver;
+OBJC_CLASS AVAsset;
+OBJC_CLASS AVPlayer;
+OBJC_CLASS AVPlayerItem;
+OBJC_CLASS AVPlayerLayer;
+OBJC_CLASS AVAssetImageGenerator;
+OBJC_CLASS WebCoreAVFMovieObserver;
+
+#ifndef __OBJC__
 typedef struct objc_object *id;
 #endif
 
index bfd76c8..b2d3259 100644 (file)
 #include <wtf/Vector.h>
 
 #if PLATFORM(MAC)
-#ifdef __OBJC__
-@class CAPropertyAnimation;
-#else
-class CAPropertyAnimation;
-#endif
+OBJC_CLASS CAPropertyAnimation;
 typedef CAPropertyAnimation* PlatformAnimationRef;
 #elif PLATFORM(WIN)
 typedef struct _CACFAnimation* CACFAnimationRef;
index bb60c48..0fc25de 100644 (file)
 #include <wtf/PassOwnPtr.h>
 #include <wtf/RetainPtr.h>
 
-#ifdef __OBJC__
-@class CALayer;
-@class WebTileCacheLayer;
-@class WebTileLayer;
-#else
-class CALayer;
-class WebTileCacheLayer;
-class WebTileLayer;
-#endif
+OBJC_CLASS CALayer;
+OBJC_CLASS WebTileCacheLayer;
+OBJC_CLASS WebTileLayer;
 
 namespace WebCore {
 
index b68b157..2482b59 100644 (file)
 
 #include "Color.h"
 
-#ifdef __OBJC__
-@class NSColor;
-#else
-class NSColor;
-#endif
+OBJC_CLASS NSColor;
 
 namespace WebCore {
     
index 951dfff..3089ae2 100644 (file)
 
 #ifdef __OBJC__
 #import <QTKit/QTTime.h>
-@class QTMovie;
-@class QTMovieView;
-@class QTMovieLayer;
-@class QTVideoRendererWebKitOnly;
-@class WebCoreMovieObserver;
 #else
-class NSDictionary;
-class NSMutableDictionary;
-class QTMovie;
-class QTMovieView;
 class QTTime;
-class QTMovieLayer;
-class QTVideoRendererWebKitOnly;
-class WebCoreMovieObserver;
 #endif
 
+OBJC_CLASS NSDictionary;
+OBJC_CLASS NSMutableDictionary;
+OBJC_CLASS QTMovie;
+OBJC_CLASS QTMovieView;
+OBJC_CLASS QTMovieLayer;
+OBJC_CLASS QTVideoRendererWebKitOnly;
+OBJC_CLASS WebCoreMovieObserver;
+
 #ifndef DRAW_FRAME_RATE
 #define DRAW_FRAME_RATE 0
 #endif
index cc7ec95..c586fb8 100644 (file)
 #ifndef MediaPlayerProxy_h
 #define MediaPlayerProxy_h
 
-#ifdef __OBJC__
-@class WebMediaPlayerProxy;
-#else
-class WebMediaPlayerProxy;
-#endif
+OBJC_CLASS WebMediaPlayerProxy;
 
 enum MediaPlayerProxyNotificationType {
 
index 6c93ed5..24e9b80 100644 (file)
 #include "Clipboard.h"
 #include <wtf/RetainPtr.h>
 
-#ifdef __OBJC__
-@class NSImage;
-@class NSPasteboard;
-#else
-class NSImage;
-class NSPasteboard;
-#endif
+OBJC_CLASS NSImage;
+OBJC_CLASS NSPasteboard;
 
 namespace WebCore {
 
index 0907fac..d4df7e6 100644 (file)
 #include "skia/ext/skia_utils_mac.h"
 #endif
 
-#ifdef __OBJC__
-@class NSGraphicsContext;
-#else
-class NSGraphicsContext;
-#endif
+OBJC_CLASS NSGraphicsContext;
 
 namespace WebCore {
 
index 7bd62e5..6c1e844 100644 (file)
 
 #import <wtf/Forward.h>
 
-#ifdef __OBJC__
-@class DOMDocumentFragment;
-#else
-class DOMDocumentFragment;
-#endif
+OBJC_CLASS DOMDocumentFragment;
 
 namespace WebCore {
 
index 8e21913..8dd6aff 100644 (file)
 #include <wtf/RefCounted.h>
 #include <wtf/RetainPtr.h>
 
-#ifdef __OBJC__
-@class NSPopUpButtonCell;
-#else
-class NSPopUpButtonCell;
-#endif
+OBJC_CLASS NSPopUpButtonCell;
 
 namespace WebCore {
 
index a38883b..48ddf7d 100644 (file)
 #include "Timer.h"
 #include <wtf/RetainPtr.h>
 
-#ifdef __OBJC__
-@class WebScrollAnimationHelperDelegate;
-@class WebScrollbarPainterControllerDelegate;
-@class WebScrollbarPainterDelegate;
-#else
-class WebScrollAnimationHelperDelegate;
-class WebScrollbarPainterControllerDelegate;
-class WebScrollbarPainterDelegate;
-#endif
+OBJC_CLASS WebScrollAnimationHelperDelegate;
+OBJC_CLASS WebScrollbarPainterControllerDelegate;
+OBJC_CLASS WebScrollbarPainterDelegate;
 
 typedef id ScrollbarPainterController;
 
index beb36ca..d988669 100644 (file)
@@ -77,56 +77,29 @@ typedef struct _CFURLRequest* CFMutableURLRequestRef;
 typedef const struct _CFURLRequest* CFURLRequestRef;
 #endif
 
-#ifdef __OBJC__
-@class AVAsset;
-@class NSArray;
-@class NSButtonCell;
-@class NSControl;
-@class NSCursor;
-@class NSData;
-@class NSDate;
-@class NSEvent;
-@class NSFont;
-@class NSHTTPCookie;
-@class NSImage;
-@class NSMenu;
-@class NSMutableURLRequest;
-@class NSString;
-@class NSTextFieldCell;
-@class NSURL;
-@class NSURLConnection;
-@class NSURLRequest;
-@class NSURLResponse;
-@class NSView;
-@class NSWindow;
-@class QTMovie;
-@class QTMovieView;
-#else
-class AVAsset;
-class NSArray;
-class NSButtonCell;
-class NSControl;
-class NSCursor;
-class NSData;
-class NSDate;
-class NSEvent;
-class NSFont;
-class NSHTTPCookie;
-class NSImage;
-class NSMenu;
-class NSMutableArray;
-class NSMutableURLRequest;
-class NSURL;
-class NSURLRequest;
-class NSString;
-class NSTextFieldCell;
-class NSURLConnection;
-class NSURLResponse;
-class NSView;
-class NSWindow;
-class QTMovie;
-class QTMovieView;
-#endif
+OBJC_CLASS AVAsset;
+OBJC_CLASS NSArray;
+OBJC_CLASS NSButtonCell;
+OBJC_CLASS NSControl;
+OBJC_CLASS NSCursor;
+OBJC_CLASS NSData;
+OBJC_CLASS NSDate;
+OBJC_CLASS NSEvent;
+OBJC_CLASS NSFont;
+OBJC_CLASS NSHTTPCookie;
+OBJC_CLASS NSImage;
+OBJC_CLASS NSMenu;
+OBJC_CLASS NSMutableURLRequest;
+OBJC_CLASS NSString;
+OBJC_CLASS NSTextFieldCell;
+OBJC_CLASS NSURL;
+OBJC_CLASS NSURLConnection;
+OBJC_CLASS NSURLRequest;
+OBJC_CLASS NSURLResponse;
+OBJC_CLASS NSView;
+OBJC_CLASS NSWindow;
+OBJC_CLASS QTMovie;
+OBJC_CLASS QTMovieView;
 
 extern "C" {
 
index a3633b2..1b1eacc 100644 (file)
@@ -52,16 +52,11 @@ typedef LPVOID HINTERNET;
 #endif
 
 #if PLATFORM(MAC)
-#ifdef __OBJC__
-@class NSData;
-@class NSError;
-@class NSURLConnection;
-@class WebCoreResourceHandleAsDelegate;
-#else
-class NSData;
-class NSError;
-class NSURLConnection;
-class WebCoreResourceHandleAsDelegate;
+OBJC_CLASS NSData;
+OBJC_CLASS NSError;
+OBJC_CLASS NSURLConnection;
+OBJC_CLASS WebCoreResourceHandleAsDelegate;
+#ifndef __OBJC__
 typedef struct objc_object *id;
 #endif
 #endif
index a458b5d..befbccf 100644 (file)
 #endif
 
 #if PLATFORM(MAC)
-#ifdef __OBJC__
-@class NSCachedURLResponse;
-#else
-class NSCachedURLResponse;
-#endif
+OBJC_CLASS NSCachedURLResponse;
 #endif
 
 namespace WebCore {
index cad3834..8779979 100644 (file)
@@ -61,13 +61,8 @@ class QNetworkReplyHandler;
 #endif
 
 #if PLATFORM(MAC)
-#ifdef __OBJC__
-@class NSURLAuthenticationChallenge;
-@class NSURLConnection;
-#else
-class NSURLAuthenticationChallenge;
-class NSURLConnection;
-#endif
+OBJC_CLASS NSURLAuthenticationChallenge;
+OBJC_CLASS NSURLConnection;
 #endif
 
 // The allocations and releases in ResourceHandleInternal are
index ca4a06c..109ede8 100644 (file)
 #include <wtf/RefPtr.h>
 
 #if USE(CFNETWORK)
+
 typedef struct _CFURLAuthChallenge* CFURLAuthChallengeRef;
+
 #else
+
 #ifndef __OBJC__
 typedef struct objc_object *id;
-class NSURLAuthenticationChallenge;
-#else
-@class NSURLAuthenticationChallenge;
 #endif
+
+OBJC_CLASS NSURLAuthenticationChallenge;
+
 #endif
 
 namespace WebCore {
index 27c63ff..30e0a5e 100644 (file)
 #include <wincrypt.h> // windows.h must be included before wincrypt.h.
 #endif
 
-#ifdef __OBJC__
-@class NSError;
-#else
-class NSError;
+#if PLATFORM(MAC)
+OBJC_CLASS NSError;
 #endif
 
 namespace WebCore {
index 47b155b..72522d9 100644 (file)
 typedef const struct _CFURLRequest* CFURLRequestRef;
 #endif
 
-#ifdef __OBJC__
-@class NSURLRequest;
-#else
-class NSURLRequest;
-#endif
+OBJC_CLASS NSURLRequest;
 
 #if USE(CFURLSTORAGESESSIONS) && (defined(BUILDING_ON_SNOW_LEOPARD) || defined(BUILDING_ON_LEOPARD))
 typedef struct __CFURLStorageSession* CFURLStorageSessionRef;
index 946eee0..d83a661 100644 (file)
 typedef struct _CFURLResponse* CFURLResponseRef;
 #endif
 
-#ifdef __OBJC__
-@class NSURLResponse;
-#else
-class NSURLResponse;
-#endif
+OBJC_CLASS NSURLResponse;
 
 namespace WebCore {
 
index 42fe3e3..a6fc5b3 100644 (file)
 #import <wtf/HashMap.h>
 #import <wtf/RetainPtr.h>
 
-class RenderProgress;
 
-#ifdef __OBJC__
-@class WebCoreRenderThemeNotificationObserver;
-#else
-class WebCoreRenderThemeNotificationObserver;
-#endif
+OBJC_CLASS WebCoreRenderThemeNotificationObserver;
 
 namespace WebCore {
 
+class RenderProgress;
 class RenderStyle;
 
 class RenderThemeMac : public RenderTheme {
index 7fe6366..c3b72a0 100644 (file)
@@ -1,3 +1,16 @@
+2012-01-17  Sam Weinig  <sam@webkit.org>
+
+        Add helper macro for forward declaring objective-c classes
+        https://bugs.webkit.org/show_bug.cgi?id=76485
+
+        Reviewed by Anders Carlsson.
+
+        * WebProcess/WebCoreSupport/WebDragClient.h:
+        Deploy OBJC_CLASS for a little code reduction.
+
+        * config.h:
+        Remove duplicate copy of OBJC_CLASS.
+
 2012-01-17  Martin Robinson  <mrobinson@igalia.com>
 
         [GTK] [WK2] WebKitPrivate should include the entire WebKit2 C API
index f0109fd..913eb6e 100644 (file)
 #include <WebCore/DragClient.h>
 
 #if PLATFORM(MAC)
-#ifdef __OBJC__
-@class WKPasteboardFilePromiseOwner;
-@class WKPasteboardOwner;
-#else
-class WKPasteboardFilePromiseOwner;
-class WKPasteboardOwner;
-#endif
+OBJC_CLASS WKPasteboardFilePromiseOwner;
+OBJC_CLASS WKPasteboardOwner;
 #endif
 
 namespace WebKit {
index b8e8a77..7db76c0 100644 (file)
@@ -61,12 +61,6 @@ static const type& name() \
 
 #if PLATFORM(MAC)
 
-#ifdef __OBJC__
-#define OBJC_CLASS @class
-#else
-#define OBJC_CLASS class
-#endif
-
 #if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
 #define ENABLE_WEB_PROCESS_SANDBOX 1
 #endif