electron/patches/v8/add_realloc.patch
Electron Bot 37db307153
chore: bump chromium to 4563763ef26ad940d4e988d7245dd (master) (#23219)
* chore: bump chromium in DEPS to 461ecae368fd0832f18e0b13e61f3561d83f0031

* update patches

* update patches

* Remove both vs browser/child split in content gn files.

https://chromium-review.googlesource.com/c/chromium/src/+/2157965

* chore: bump chromium in DEPS to 7ff3897f3104563763ef26ad940d4e988d7245dd

* update patches

* update patches

* Add ElectronKioskDelegate for extensions

https://chromium-review.googlesource.com/c/chromium/src/+/2159760

Co-authored-by: John Kleinschmidt <jkleinsc@github.com>
Co-authored-by: Electron Bot <anonymous@electronjs.org>
2020-04-23 21:55:17 -04:00

46 lines
1.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shelley Vohr <shelley.vohr@gmail.com>
Date: Mon, 22 Oct 2018 10:47:11 -0700
Subject: add_realloc.patch
Blink overrides ArrayBuffer's allocator with its own one, while Node simply
uses malloc and free, so we need to use v8's allocator in Node. As part of the
10.6.0 upgrade, we needed to make SerializerDelegate accept an allocator
argument in its constructor, and override ReallocateBufferMemory and
FreeBufferMemory to use the allocator. We cannot simply allocate and then memcpy
when we override ReallocateBufferMemory, so we therefore need to implement
Realloc on the v8 side.
diff --git a/include/v8.h b/include/v8.h
index 5a2a701774b7dc25ef2c6863a893d8d9bff41dfd..153065b131fdb7c65b6dd5493b15168048b3df1e 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -5041,6 +5041,13 @@ class V8_EXPORT ArrayBuffer : public Object {
*/
virtual void* AllocateUninitialized(size_t length) = 0;
+ /**
+ * Free the memory block of size |length|, pointed to by |data|.
+ * That memory must be previously allocated by |Allocate| and not yet freed
+ * with a call to |Free| or |Realloc|
+ */
+ virtual void* Realloc(void* data, size_t length);
+
/**
* Free the memory block of size |length|, pointed to by |data|.
* That memory is guaranteed to be previously allocated by |Allocate|.
diff --git a/src/api/api.cc b/src/api/api.cc
index 05d70ef5adf3ef5fd58228eabfad12cc22e96b2e..66f7a5f6fb2b004f40c5622514a5d8cc6b0edc5c 100644
--- a/src/api/api.cc
+++ b/src/api/api.cc
@@ -529,6 +529,10 @@ void V8::SetSnapshotDataBlob(StartupData* snapshot_blob) {
i::V8::SetSnapshotBlob(snapshot_blob);
}
+void* v8::ArrayBuffer::Allocator::Realloc(void* data, size_t length) {
+ UNIMPLEMENTED();
+}
+
namespace {
class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {