Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Unified Diff: fpdfsdk/src/javascript/JS_Runtime.cpp

Issue 1118043002: Provide an array buffer allocator to V8. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Indent. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/include/javascript/JS_Runtime.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/javascript/JS_Runtime.cpp
diff --git a/fpdfsdk/src/javascript/JS_Runtime.cpp b/fpdfsdk/src/javascript/JS_Runtime.cpp
index 4ff3c0bc98c567dee03b20551191a79fcf933315..e2f50067e6820b7bc426e0a6761cf3e65da922da 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();
« no previous file with comments | « fpdfsdk/include/javascript/JS_Runtime.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698