diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /gfx/skia/patches/archive/0017-Bug-740194-SkMemory-mozalloc.patch | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/skia/patches/archive/0017-Bug-740194-SkMemory-mozalloc.patch')
-rw-r--r-- | gfx/skia/patches/archive/0017-Bug-740194-SkMemory-mozalloc.patch | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/gfx/skia/patches/archive/0017-Bug-740194-SkMemory-mozalloc.patch b/gfx/skia/patches/archive/0017-Bug-740194-SkMemory-mozalloc.patch new file mode 100644 index 0000000000..719fda1650 --- /dev/null +++ b/gfx/skia/patches/archive/0017-Bug-740194-SkMemory-mozalloc.patch @@ -0,0 +1,73 @@ +commit 5786f516119bcb677510f3c9256b870c3b5616c8 +Author: George Wright <gwright@mozilla.com> +Date: Wed Aug 15 23:51:34 2012 -0400 + + Bug 740194 - [Skia] Implement a version of SkMemory for Mozilla that uses the infallible mozalloc allocators r=cjones + +diff --git a/gfx/skia/include/config/SkUserConfig.h b/gfx/skia/include/config/SkUserConfig.h +index f98ba85..17be191 100644 +--- a/gfx/skia/include/config/SkUserConfig.h ++++ b/gfx/skia/include/config/SkUserConfig.h +@@ -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 +diff --git a/gfx/skia/src/ports/SkMemory_mozalloc.cpp b/gfx/skia/src/ports/SkMemory_mozalloc.cpp +new file mode 100644 +index 0000000..1f16ee5 +--- /dev/null ++++ b/gfx/skia/src/ports/SkMemory_mozalloc.cpp +@@ -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) { ++ free(p); ++} ++ ++void* sk_malloc_flags(size_t size, unsigned flags) { ++ return (flags & SK_MALLOC_THROW) ? moz_xmalloc(size) : malloc(size); ++} ++ |