0

Fix compiler error in sandbox util in case exception is enabled.

Add operator delete that matches the placement form of the
operator new. This is required by compiler to generate code
to call operator delete in case the object's constructor
throws an exception.
See http://msdn.microsoft.com/en-us/library/cxdxz3x6.aspx

R=rvargas
BUG=none
TEST=sandbox code compiles if exception is enabled.


Review URL: http://codereview.chromium.org/2870017

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50486 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
victorw@chromium.org
2010-06-22 18:37:42 +00:00
parent 7ded59aeeb
commit 817e1dd8ae
2 changed files with 12 additions and 0 deletions

@ -560,6 +560,12 @@ void operator delete(void* memory, sandbox::AllocationType type) {
}
}
void operator delete(void* memory, sandbox::AllocationType type,
void* near_to) {
UNREFERENCED_PARAMETER(near_to);
operator delete(memory, type);
}
void* __cdecl operator new(size_t size, void* buffer,
sandbox::AllocationType type) {
UNREFERENCED_PARAMETER(size);

@ -13,6 +13,12 @@
void* __cdecl operator new(size_t size, sandbox::AllocationType type,
void* near_to = NULL);
void __cdecl operator delete(void* memory, sandbox::AllocationType type);
// Add operator delete that matches the placement form of the operator new
// above. This is required by compiler to generate code to call operator delete
// in case the object's constructor throws an exception.
// See http://msdn.microsoft.com/en-us/library/cxdxz3x6.aspx
void __cdecl operator delete(void* memory, sandbox::AllocationType type,
void* near_to);
// Regular placement new and delete
void* __cdecl operator new(size_t size, void* buffer,