Bug 1080994 - Build libclearkey without a dependency on mozalloc or mozglue. r=dkeeler,r=cpearce

This commit is contained in:
Mike Hommey 2014-10-14 07:13:25 +09:00
parent 7dfc0f99b9
commit 951b27b2b0
3 changed files with 11 additions and 2 deletions

View File

@ -10,4 +10,6 @@ CLEARKEY_CDM_FILES = \
clearkey.info \
$(NULL)
MOZ_GLUE_LDFLAGS =
include $(topsrcdir)/config/rules.mk

View File

@ -20,4 +20,6 @@ LOCAL_INCLUDES += [
]
USE_STATIC_LIBS = True
USE_LIBS += [ 'mozalloc' ]
DISABLE_STL_WRAPPING = True
DEFINES['MOZ_NO_MOZALLOC'] = True

View File

@ -11,7 +11,9 @@
#include "NSSErrorsService.h"
#include "mozilla/Likely.h"
#ifndef MOZ_NO_MOZALLOC
#include "mozilla/mozalloc_oom.h"
#endif
#include "mozilla/Scoped.h"
#include "nsError.h"
#include "nsDebug.h"
@ -257,8 +259,11 @@ inline void
SECITEM_AllocItem(SECItem & item, uint32_t len)
{
if (MOZ_UNLIKELY(!SECITEM_AllocItem(nullptr, &item, len))) {
#ifndef MOZ_NO_MOZALLOC
mozalloc_handle_oom(len);
if (MOZ_UNLIKELY(!SECITEM_AllocItem(nullptr, &item, len))) {
if (MOZ_UNLIKELY(!SECITEM_AllocItem(nullptr, &item, len)))
#endif
{
MOZ_CRASH();
}
}