Added WITH_CXX_GUARDEDALLOC support for GHOST, disabled by default.

This commit is contained in:
Campbell Barton
2010-12-07 11:57:34 +00:00
parent 6c32bffab0
commit 3e7469cd01
8 changed files with 46 additions and 0 deletions

View File

@@ -83,6 +83,12 @@ public:
* @return The event data.
*/
virtual GHOST_TEventDataPtr getData() = 0;
#ifdef WITH_CXX_GUARDEDALLOC
public:
void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GHOST:GHOST_IEvent"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
#endif // _GHOST_IEVENT_H_

View File

@@ -62,6 +62,12 @@ public:
* @return Indication as to whether the event was handled.
*/
virtual bool processEvent(GHOST_IEvent* event) = 0;
#ifdef WITH_CXX_GUARDEDALLOC
public:
void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GHOST:GHOST_IEventConsumer"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
#endif // _GHOST_EVENT_CONSUMER_H_

View File

@@ -404,6 +404,12 @@ protected:
/** The one and only system */
static GHOST_ISystem* m_system;
#ifdef WITH_CXX_GUARDEDALLOC
public:
void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GHOST:GHOST_ISystem"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
#endif // _GHOST_ISYSTEM_H_

View File

@@ -83,6 +83,12 @@ public:
* @param data The timer user data.
*/
virtual void setUserData(const GHOST_TUserDataPtr userData) = 0;
#ifdef WITH_CXX_GUARDEDALLOC
public:
void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GHOST:GHOST_ITimerTask"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
#endif // _GHOST_ITIMER_TASK_H_

View File

@@ -305,6 +305,11 @@ public:
*/
virtual GHOST_TSuccess setCursorGrab(GHOST_TGrabCursorMode mode, GHOST_Rect *bounds) { return GHOST_kSuccess; };
#ifdef WITH_CXX_GUARDEDALLOC
public:
void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GHOST:GHOST_IWindow"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
#endif // _GHOST_IWINDOW_H_

View File

@@ -185,6 +185,12 @@ public:
GHOST_TInt32 m_r;
/** Bottom coordinate of the rectangle */
GHOST_TInt32 m_b;
#ifdef WITH_CXX_GUARDEDALLOC
public:
void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GHOST:GHOST_Rect"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};

View File

@@ -29,6 +29,10 @@
#ifndef _GHOST_TYPES_H_
#define _GHOST_TYPES_H_
#ifdef WITH_CXX_GUARDEDALLOC
#include "MEM_guardedalloc.h"
#endif
typedef char GHOST_TInt8;
typedef unsigned char GHOST_TUns8;
typedef short GHOST_TInt16;

View File

@@ -160,6 +160,13 @@ protected:
/** Window that was active before entering fullscreen state. */
GHOST_IWindow* m_activeWindowBeforeFullScreen;
#ifdef WITH_CXX_GUARDEDALLOC
public:
void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GHOST:GHOST_WindowManager"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
#endif // _GHOST_WINDOW_MANAGER_H_