Commit 83a6ac21 authored by ddkilzer@apple.com's avatar ddkilzer@apple.com

<http://webkit.org/b/56381> Objective-C classes should be typedef-ed as structs (not void*) in C++

Reviewed by Simon Fraser.

Typedef-ing Objective-C classes as void* for pure C++ makes it
easier for bugs to creep in because compilers can't do any type
checking for void pointers.

* platform/graphics/GraphicsContext3D.h: Changed typedef
declarations for CALayer and WebGLLayer from void* to structs.
(WebCore::GraphicsContext3D::platformLayer): Changed
static_cast<CALayer*> to reinterpret_cast<CALayer*> now that
CALayer and WebGLLayer are not void pointers.
* platform/graphics/GraphicsLayer.h: Changed typedef declaration
for PlatformLayer from void* to struct CALayer.
* platform/graphics/ca/PlatformCAAnimation.h: Changed typedef
declaration for CAPropertyAnimation from void* to a struct.
Extracted typdef for PlatformAnimationRef.

git-svn-id: svn://svn.chromium.org/blink/trunk@81156 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 8d3a38c9
2011-03-15 David Kilzer <ddkilzer@apple.com>
<http://webkit.org/b/56381> Objective-C classes should be typedef-ed as structs (not void*) in C++
Reviewed by Simon Fraser.
Typedef-ing Objective-C classes as void* for pure C++ makes it
easier for bugs to creep in because compilers can't do any type
checking for void pointers.
* platform/graphics/GraphicsContext3D.h: Changed typedef
declarations for CALayer and WebGLLayer from void* to structs.
(WebCore::GraphicsContext3D::platformLayer): Changed
static_cast<CALayer*> to reinterpret_cast<CALayer*> now that
CALayer and WebGLLayer are not void pointers.
* platform/graphics/GraphicsLayer.h: Changed typedef declaration
for PlatformLayer from void* to struct CALayer.
* platform/graphics/ca/PlatformCAAnimation.h: Changed typedef
declaration for CAPropertyAnimation from void* to a struct.
Extracted typdef for PlatformAnimationRef.
2011-03-15 Ilya Sherman <isherman@chromium.org> 2011-03-15 Ilya Sherman <isherman@chromium.org>
Reviewed by Tony Chang. Reviewed by Tony Chang.
......
...@@ -51,8 +51,8 @@ ...@@ -51,8 +51,8 @@
@class CALayer; @class CALayer;
@class WebGLLayer; @class WebGLLayer;
#else #else
typedef void* CALayer; typedef struct CALayer CALayer;
typedef void* WebGLLayer; typedef struct WebGLLayer WebGLLayer;
#endif #endif
#elif PLATFORM(QT) #elif PLATFORM(QT)
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
...@@ -450,7 +450,7 @@ public: ...@@ -450,7 +450,7 @@ public:
#if PLATFORM(MAC) #if PLATFORM(MAC)
PlatformGraphicsContext3D platformGraphicsContext3D() const { return m_contextObj; } PlatformGraphicsContext3D platformGraphicsContext3D() const { return m_contextObj; }
Platform3DObject platformTexture() const { return m_texture; } Platform3DObject platformTexture() const { return m_texture; }
CALayer* platformLayer() const { return static_cast<CALayer*>(m_webGLLayer.get()); } CALayer* platformLayer() const { return reinterpret_cast<CALayer*>(m_webGLLayer.get()); }
#elif PLATFORM(CHROMIUM) #elif PLATFORM(CHROMIUM)
PlatformGraphicsContext3D platformGraphicsContext3D() const; PlatformGraphicsContext3D platformGraphicsContext3D() const;
Platform3DObject platformTexture() const; Platform3DObject platformTexture() const;
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
@class CALayer; @class CALayer;
typedef CALayer PlatformLayer; typedef CALayer PlatformLayer;
#else #else
typedef void* PlatformLayer; typedef struct CALayer PlatformLayer;
#endif #endif
#elif PLATFORM(WIN) #elif PLATFORM(WIN)
typedef struct _CACFLayer PlatformLayer; typedef struct _CACFLayer PlatformLayer;
......
...@@ -38,11 +38,10 @@ ...@@ -38,11 +38,10 @@
#if PLATFORM(MAC) #if PLATFORM(MAC)
#ifdef __OBJC__ #ifdef __OBJC__
@class CAPropertyAnimation; @class CAPropertyAnimation;
typedef CAPropertyAnimation* PlatformAnimationRef;
#else #else
typedef void* CAPropertyAnimation; // So the m_animation declaration works typedef struct CAPropertyAnimation CAPropertyAnimation;
typedef void* PlatformAnimationRef;
#endif #endif
typedef CAPropertyAnimation* PlatformAnimationRef;
#elif PLATFORM(WIN) #elif PLATFORM(WIN)
typedef struct _CACFAnimation* CACFAnimationRef; typedef struct _CACFAnimation* CACFAnimationRef;
typedef CACFAnimationRef PlatformAnimationRef; typedef CACFAnimationRef PlatformAnimationRef;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment