Flutter Engine
The Flutter Engine
SkMemory_mozalloc.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2011 Google Inc.
3 * Copyright 2012 Mozilla Foundation
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
8
10
12#include "mozilla/mozalloc.h"
13#include "mozilla/mozalloc_abort.h"
14#include "mozilla/mozalloc_oom.h"
15
16// needed for std::max
17#include <algorithm>
18
20 mozalloc_abort("Abort from sk_abort");
21}
22
23void sk_out_of_memory(void) {
24 SkDEBUGFAIL("sk_out_of_memory");
25 mozalloc_handle_oom(0);
26}
27
28void sk_free(void* p) {
29 free(p);
30}
31
32void* sk_realloc_throw(void* addr, size_t size) {
33 return moz_xrealloc(addr, size);
34}
35
36void* sk_malloc_flags(size_t size, unsigned flags) {
38 return (flags & SK_MALLOC_THROW) ? moz_xcalloc(size, 1) : calloc(size, 1);
39 }
40 return (flags & SK_MALLOC_THROW) ? moz_xmalloc(size) : malloc(size);
41}
42
43size_t sk_malloc_size(void* addr, size_t size) {
44 return std::max(moz_malloc_usable_size(addr), size);
45}
#define SkDEBUGFAIL(message)
Definition: SkAssert.h:118
@ SK_MALLOC_ZERO_INITIALIZE
Definition: SkMalloc.h:34
@ SK_MALLOC_THROW
Definition: SkMalloc.h:40
void * sk_malloc_flags(size_t size, unsigned flags)
void sk_free(void *p)
size_t sk_malloc_size(void *addr, size_t size)
void * sk_realloc_throw(void *addr, size_t size)
void sk_abort_no_print()
void sk_out_of_memory(void)
FlutterSemanticsFlag flags
static float max(float r, float g, float b)
Definition: hsl.cpp:49
void * malloc(size_t size)
Definition: allocation.cc:19
void * calloc(size_t n, size_t size)
Definition: allocation.cc:11
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259