Flutter Engine
The Flutter Engine
SkSLMemoryPool.h
Go to the documentation of this file.
1/*
2 * Copyright 2020 Google LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SKSL_MEMORYPOOL
9#define SKSL_MEMORYPOOL
10
11#include <memory>
12
15
16namespace SkSL {
17
19public:
20 static std::unique_ptr<MemoryPool> Make() {
21 return std::make_unique<MemoryPool>();
22 }
23 void* allocate(size_t size) {
24 return fArena.makeBytesAlignedTo(size, kAlignment);
25 }
26 void release(void*) {
27 // SkArenaAlloc does not ever attempt to reclaim space.
28 }
29
30private:
31#ifdef SK_FORCE_8_BYTE_ALIGNMENT
32 // https://github.com/emscripten-core/emscripten/issues/10072
33 // Since Skia does not use "long double" (16 bytes), we should be ok to force it back to 8 bytes
34 // until emscripten is fixed.
35 static constexpr size_t kAlignment = 8;
36#else
37 // Guaranteed alignment of pointer returned by allocate().
38 static constexpr size_t kAlignment = alignof(std::max_align_t);
39#endif
40
41 SkSTArenaAlloc<65536> fArena{/*firstHeapAllocation=*/32768};
42};
43
44} // namespace SkSL
45
46#endif // SKSL_MEMORYPOOL
void * makeBytesAlignedTo(size_t size, size_t align)
Definition: SkArenaAlloc.h:200
static std::unique_ptr< MemoryPool > Make()
void release(void *)
void * allocate(size_t size)
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