Skip to content

Commit

Permalink
Bug 1423512 - Remove infallible allocator exception for xpcom glue co…
Browse files Browse the repository at this point in the history
…de. r=erahm

Back when mozalloc was a separate library, the xpcom glue code could not
use the infallible allocator API. But since bug 868814, that's not the
case anymore, so we can safely include mozalloc.h when XPCOM_GLUE is
set.

--HG--
extra : rebase_source : a8fbf8dc7020765d7287e2eb7ceaf41c99be8b18
  • Loading branch information
glandium committed Dec 6, 2017
1 parent c6b6415 commit f0c6dab
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
6 changes: 2 additions & 4 deletions config/gcc-stl-wrapper.template.h
Expand Up @@ -45,10 +45,8 @@
#pragma GCC visibility pop

#ifdef MOZ_INCLUDE_MOZALLOC_H_FROM_${HEADER}
// See if we're in code that can use mozalloc. NB: this duplicates
// code in nscore.h because nscore.h pulls in prtypes.h, and chromium
// can't build with that being included before base/basictypes.h.
# if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
// See if we're in code that can use mozalloc.
# if !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
# include "mozilla/mozalloc.h"
# else
# error "STL code can only be used with infallible ::operator new()"
Expand Down
6 changes: 2 additions & 4 deletions config/msvc-stl-wrapper.template.h
Expand Up @@ -62,10 +62,8 @@
#pragma warning( pop )

#ifdef MOZ_INCLUDE_MOZALLOC_H_FROM_${HEADER}
// See if we're in code that can use mozalloc. NB: this duplicates
// code in nscore.h because nscore.h pulls in prtypes.h, and chromium
// can't build with that being included before base/basictypes.h.
# if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
// See if we're in code that can use mozalloc.
# if !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
# include "mozilla/mozalloc.h"
# else
# error "STL code can only be used with infallible ::operator new()"
Expand Down
2 changes: 1 addition & 1 deletion xpcom/base/nscore.h
Expand Up @@ -16,7 +16,7 @@
#endif

/* Definitions of functions and operators that allocate memory. */
#if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
#if !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
# include "mozilla/mozalloc.h"
#endif

Expand Down

0 comments on commit f0c6dab

Please sign in to comment.