From d2cc1b90fe1ffd3162bb685a3f120f867220b5e9 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Thu, 30 Apr 2015 15:19:03 -0700 Subject: Merge to XFA: Fix V8 array buffer allocator. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1118143003 --- fpdfsdk/include/javascript/JS_Runtime.h | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'fpdfsdk/include') diff --git a/fpdfsdk/include/javascript/JS_Runtime.h b/fpdfsdk/include/javascript/JS_Runtime.h index 86d49713a8..07e4e43c84 100644 --- a/fpdfsdk/include/javascript/JS_Runtime.h +++ b/fpdfsdk/include/javascript/JS_Runtime.h @@ -7,6 +7,7 @@ #ifndef _JS_RUNTIME_H_ #define _JS_RUNTIME_H_ +#include "../../../third_party/base/nonstd_unique_ptr.h" #include "../../../core/include/fxcrt/fx_basic.h" #include "../jsapi/fxjs_v8.h" #include "IJavaScript.h" @@ -14,6 +15,12 @@ class CJS_Context; +class CJS_ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { + void* Allocate(size_t length) override; + void* AllocateUninitialized(size_t length) override; + void Free(void* data, size_t length) override; +}; + class CJS_FieldEvent { public: @@ -57,15 +64,16 @@ public: virtual FX_BOOL GetHValueByName(FX_BSTR utf8Name, FXJSE_HVALUE hValue); virtual FX_BOOL SetHValueByName(FX_BSTR utf8Name, FXJSE_HVALUE hValue); protected: - CFX_ArrayTemplate m_ContextArray; - CPDFDoc_Environment * m_pApp; - CPDFSDK_Document * m_pDocument; + CFX_ArrayTemplate m_ContextArray; + CPDFDoc_Environment* m_pApp; + CPDFSDK_Document* m_pDocument; FX_BOOL m_bBlocking; + FX_BOOL m_bRegistered; CJS_FieldEvent* m_pFieldEventPath; - v8::Isolate* m_isolate; - v8::Persistent m_context; - FX_BOOL m_bRegistered; + v8::Isolate* m_isolate; + nonstd::unique_ptr m_pArrayBufferAllocator; + v8::Persistent m_context; }; #endif //_JS_RUNTIME_H_ -- cgit v1.2.3