mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 740194 - [Skia] Implement a version of SkMemory for Mozilla that uses the infallible mozalloc allocators r=cjones
This commit is contained in:
parent
19ddb6ee61
commit
4a11ba2c89
@ -37,7 +37,6 @@ ifndef LIBXUL_SDK
|
||||
ifeq (android,$(MOZ_WIDGET_TOOLKIT))
|
||||
tier_base_dirs += \
|
||||
other-licenses/android \
|
||||
other-licenses/skia-npapi \
|
||||
$(NULL)
|
||||
endif
|
||||
ifeq (gonk,$(MOZ_WIDGET_TOOLKIT))
|
||||
|
@ -231,7 +231,7 @@ CPPSRCS = \
|
||||
SkMaskFilter.cpp \
|
||||
SkMath.cpp \
|
||||
SkMatrix.cpp \
|
||||
SkMemory_malloc.cpp \
|
||||
SkMemory_mozalloc.cpp \
|
||||
SkMetaData.cpp \
|
||||
SkMorphologyImageFilter.cpp \
|
||||
SkOrderedReadBuffer.cpp \
|
||||
|
@ -35,6 +35,16 @@
|
||||
commented out, so including it will have no effect.
|
||||
*/
|
||||
|
||||
/*
|
||||
Override new/delete with Mozilla's allocator, mozalloc
|
||||
|
||||
Ideally we shouldn't need to do this here, but until
|
||||
http://code.google.com/p/skia/issues/detail?id=598 is fixed
|
||||
we need to include this here to override operator new and delete
|
||||
*/
|
||||
|
||||
#include "mozilla/mozalloc.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/* Scalars (the fractional value type in skia) can be implemented either as
|
||||
|
40
gfx/skia/src/ports/SkMemory_mozalloc.cpp
Normal file
40
gfx/skia/src/ports/SkMemory_mozalloc.cpp
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright 2011 Google Inc.
|
||||
* Copyright 2012 Mozilla Foundation
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "SkTypes.h"
|
||||
|
||||
#include "mozilla/mozalloc.h"
|
||||
#include "mozilla/mozalloc_abort.h"
|
||||
#include "mozilla/mozalloc_oom.h"
|
||||
|
||||
void sk_throw() {
|
||||
SkDEBUGFAIL("sk_throw");
|
||||
mozalloc_abort("Abort from sk_throw");
|
||||
}
|
||||
|
||||
void sk_out_of_memory(void) {
|
||||
SkDEBUGFAIL("sk_out_of_memory");
|
||||
mozalloc_handle_oom(0);
|
||||
}
|
||||
|
||||
void* sk_malloc_throw(size_t size) {
|
||||
return sk_malloc_flags(size, SK_MALLOC_THROW);
|
||||
}
|
||||
|
||||
void* sk_realloc_throw(void* addr, size_t size) {
|
||||
return moz_xrealloc(addr, size);
|
||||
}
|
||||
|
||||
void sk_free(void* p) {
|
||||
moz_free(p);
|
||||
}
|
||||
|
||||
void* sk_malloc_flags(size_t size, unsigned flags) {
|
||||
return (flags & SK_MALLOC_THROW) ? moz_xmalloc(size) : moz_malloc(size);
|
||||
}
|
||||
|
@ -179,6 +179,13 @@ tier_platform_dirs += \
|
||||
xpfe/appshell \
|
||||
$(NULL)
|
||||
|
||||
# This needs to be built after the gfx/ directory
|
||||
# to ensure all dependencies for skia (e.g. mozalloc, xpcom)
|
||||
# have been built
|
||||
ifeq (android,$(MOZ_WIDGET_TOOLKIT))
|
||||
tier_platform_dirs += other-licenses/skia-npapi
|
||||
endif
|
||||
|
||||
ifdef MOZ_UNIVERSALCHARDET
|
||||
tier_platform_dirs += extensions/universalchardet
|
||||
endif
|
||||
|
Loading…
Reference in New Issue
Block a user