summaryrefslogtreecommitdiff
path: root/fpdfsdk/src
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-04-30 14:30:29 -0700
committerTom Sepez <tsepez@chromium.org>2015-04-30 14:30:29 -0700
commitf3fecc0c686418272e49c8d51da2cb12e80bd1a2 (patch)
tree082c6f9fbfd9d7d3f51707aaa4030e43e6c50d7d /fpdfsdk/src
parentbefafb6d0a6d2ae745c88193e50b631fda2c746a (diff)
downloadpdfium-f3fecc0c686418272e49c8d51da2cb12e80bd1a2.tar.xz
This allows PDFium to work with current V8, so unpin v8 in the pdfium DEPS file. (I also re-ordered one field in CJS_Runtime, just to put two bools together (may pack tighter), and to put all the v8 stuff together). BUG=pdfium:146 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1118043002
Diffstat (limited to 'fpdfsdk/src')
-rw-r--r--fpdfsdk/src/javascript/JS_Runtime.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/fpdfsdk/src/javascript/JS_Runtime.cpp b/fpdfsdk/src/javascript/JS_Runtime.cpp
index 4ff3c0bc98..e2f50067e6 100644
--- a/fpdfsdk/src/javascript/JS_Runtime.cpp
+++ b/fpdfsdk/src/javascript/JS_Runtime.cpp
@@ -91,17 +91,32 @@ void CJS_RuntimeFactory::ReleaseGlobalData()
}
}
+void* CJS_ArrayBufferAllocator::Allocate(size_t length) {
+ return calloc(1, length);
+}
+
+void* CJS_ArrayBufferAllocator::AllocateUninitialized(size_t length) {
+ return malloc(length);
+}
+
+void CJS_ArrayBufferAllocator::Free(void* data, size_t length) {
+ free(data);
+}
+
/* ------------------------------ CJS_Runtime ------------------------------ */
CJS_Runtime::CJS_Runtime(CPDFDoc_Environment * pApp) :
m_pApp(pApp),
m_pDocument(NULL),
m_bBlocking(FALSE),
- m_pFieldEventPath(NULL),
- m_bRegistered(FALSE)
+ m_bRegistered(FALSE),
+ m_pFieldEventPath(NULL)
{
- m_isolate = v8::Isolate::New();
- //m_isolate->Enter();
+ m_pArrayBufferAllocator.reset(new CJS_ArrayBufferAllocator());
+
+ v8::Isolate::CreateParams params;
+ params.array_buffer_allocator = m_pArrayBufferAllocator.get();
+ m_isolate = v8::Isolate::New(params);
InitJSObjects();