]> khamidou — GitHub mirrors - electron.git/commitdiff
Use blink's allocator in Node's Buffer
authorCheng Zhao <zcbenz@gmail.com>
Tue, 11 Aug 2015 04:31:41 +0000 (12:31 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Tue, 11 Aug 2015 04:31:41 +0000 (12:31 +0800)
atom/renderer/atom_renderer_client.cc
script/lib/config.py
vendor/node

index 0311f8b540b0cec250bc0fa04dcda64b73f48c91..af526df9f75e7b8a2c85ce8e6d31b57ab0efdaf2 100644 (file)
@@ -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();
 
index 2c6d1a3b29c22c9f65521643cb39a4af06b1a007..7132b9d63bf541ffbadbad165ce8d2f9e773cf2f 100644 (file)
@@ -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',
index 02d6e45de63d4bbb133cc73ab3937e5115fb4ddd..6472143e364343f73ee6a9e1b67902cc5c30f7ef 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 02d6e45de63d4bbb133cc73ab3937e5115fb4ddd
+Subproject commit 6472143e364343f73ee6a9e1b67902cc5c30f7ef