Flutter Engine
The Flutter Engine
unit_test_custom_zone.h
Go to the documentation of this file.
1// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
2// for details. All rights reserved. Use of this source code is governed by a
3// BSD-style license that can be found in the LICENSE file.
4
5#ifndef RUNTIME_VM_COMPILER_FFI_UNIT_TEST_CUSTOM_ZONE_H_
6#define RUNTIME_VM_COMPILER_FFI_UNIT_TEST_CUSTOM_ZONE_H_
7
8#include <vector>
9
10// We use a custom zone here which doesn't depend on VM internals (e.g. handles,
11// thread, ...)
12#if defined(RUNTIME_VM_ZONE_H_)
13#error "We want our own zone implementation"
14#endif
15#define RUNTIME_VM_ZONE_H_
16
17namespace dart {
18
19class Zone {
20 public:
21 Zone() {}
22 ~Zone();
23
24 template <class ElementType>
25 inline ElementType* Alloc(intptr_t length) {
26 return static_cast<ElementType*>(AllocUnsafe(sizeof(ElementType) * length));
27 }
28
29 template <class ElementType>
30 inline ElementType* Realloc(ElementType* old_array,
31 intptr_t old_length,
32 intptr_t new_length) {
33 void* memory = AllocUnsafe(sizeof(ElementType) * new_length);
34 memmove(memory, old_array, sizeof(ElementType) * old_length);
35 return static_cast<ElementType*>(memory);
36 }
37
38 template <class ElementType>
39 void Free(ElementType* old_array, intptr_t len) {}
40
41 void* AllocUnsafe(intptr_t size);
42
43 private:
44 Zone(const Zone&) = delete;
45 void operator=(const Zone&) = delete;
46 std::vector<void*> buffers_;
47};
48
49} // namespace dart
50
51#endif // RUNTIME_VM_COMPILER_FFI_UNIT_TEST_CUSTOM_ZONE_H_
void * AllocUnsafe(intptr_t size)
void Free(ElementType *old_array, intptr_t len)
ElementType * Realloc(ElementType *old_array, intptr_t old_length, intptr_t new_length)
ElementType * Alloc(intptr_t length)
size_t length
Definition: dart_vm.cc:33
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