aboutsummaryrefslogtreecommitdiffstats
path: root/devel/electron35/files/patch-build_rust_allocator_allocator__impls.h
blob: 9249cdc938d26ce1e4fb62907d10adf1cd40fd37 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
--- build/rust/allocator/allocator_impls.h.orig	2025-05-20 09:16:26 UTC
+++ build/rust/allocator/allocator_impls.h
@@ -0,0 +1,24 @@
+// Copyright 2025 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BUILD_RUST_ALLOCATOR_ALLOCATOR_IMPLS_H_
+#define BUILD_RUST_ALLOCATOR_ALLOCATOR_IMPLS_H_
+
+#include <cstddef>
+
+// This header exposes a C++ allocator (e.g. PartitionAlloc) to Rust.
+// The APIs below are called from `impl GlobalAlloc` in `lib.rs`.
+namespace rust_allocator_internal {
+
+unsigned char* alloc(size_t size, size_t align);
+void dealloc(unsigned char* p, size_t size, size_t align);
+unsigned char* realloc(unsigned char* p,
+                       size_t old_size,
+                       size_t align,
+                       size_t new_size);
+unsigned char* alloc_zeroed(size_t size, size_t align);
+
+}  // namespace rust_allocator_internal
+
+#endif  // BUILD_RUST_ALLOCATOR_ALLOCATOR_IMPLS_H_