mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
Use blink's allocator in Node's Buffer
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include "third_party/WebKit/public/web/WebPluginParams.h"
|
||||
#include "third_party/WebKit/public/web/WebKit.h"
|
||||
#include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
|
||||
#include "third_party/WebKit/Source/wtf/ArrayBufferContents.h"
|
||||
|
||||
#include "atom/common/node_includes.h"
|
||||
|
||||
@@ -52,6 +53,17 @@ bool IsGuestFrame(blink::WebFrame* frame) {
|
||||
return frame->uniqueName().utf8() == "ATOM_SHELL_GUEST_WEB_VIEW";
|
||||
}
|
||||
|
||||
void* BlinkAllocate(size_t size) {
|
||||
void* ptr = nullptr;
|
||||
WTF::ArrayBufferContents::allocateMemory(
|
||||
size, WTF::ArrayBufferContents::DontInitialize, ptr);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void BlinkFree(void* ptr, size_t size) {
|
||||
WTF::ArrayBufferContents::freeMemory(ptr, size);
|
||||
}
|
||||
|
||||
// Helper class to forward the messages to the client.
|
||||
class AtomRenderFrameObserver : public content::RenderFrameObserver {
|
||||
public:
|
||||
@@ -91,6 +103,9 @@ void AtomRendererClient::WebKitInitialized() {
|
||||
blink::WebCustomElement::addEmbedderCustomElementName("webview");
|
||||
blink::WebCustomElement::addEmbedderCustomElementName("browserplugin");
|
||||
|
||||
// Override Node's Buffer allocator with WTF's allocator.
|
||||
node::Buffer::SetAllocator(&BlinkAllocate, &BlinkFree);
|
||||
|
||||
node_bindings_->Initialize();
|
||||
node_bindings_->PrepareMessageLoop();
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import sys
|
||||
|
||||
BASE_URL = os.getenv('LIBCHROMIUMCONTENT_MIRROR') or \
|
||||
'http://github-janky-artifacts.s3.amazonaws.com/libchromiumcontent'
|
||||
LIBCHROMIUMCONTENT_COMMIT = '01345b4ef5f2a766e6f58dbbe7729fb089b357ba'
|
||||
LIBCHROMIUMCONTENT_COMMIT = '21768a17f4f1203a50df5c0908b788fa2ecb96ab'
|
||||
|
||||
PLATFORM = {
|
||||
'cygwin': 'win32',
|
||||
|
||||
2
vendor/node
vendored
2
vendor/node
vendored
Submodule vendor/node updated: 02d6e45de6...6472143e36
Reference in New Issue
Block a user