summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS1
-rw-r--r--BUILD.gn2
-rw-r--r--fpdfsdk/include/javascript/IJavaScript.h7
-rw-r--r--fpdfsdk/src/javascript/JS_Runtime.cpp7
-rw-r--r--pdfium.gyp3
5 files changed, 19 insertions, 1 deletions
diff --git a/AUTHORS b/AUTHORS
index 29bd3998d0..f12a5295df 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -12,6 +12,7 @@ Andrey Khalyavin <halyavin@chromium.org>
Brett Wilson <brettw@chromium.org>
Chris Palmer <palmer@chromium.org>
Finnur Thorarinsson <finnur@chromium.org>
+Jochen Eisinger <jochen@chromium.org>
John Abd-El-Malek <jam@chromium.org>
Julien Tinnes <jln@chromium.org>
Kostya Serebryany <kcc@chromium.org>
diff --git a/BUILD.gn b/BUILD.gn
index 7f5c821c09..9ecd70830e 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -803,6 +803,7 @@ static_library("javascript") {
}
configs += [ ":pdfium_config", "//build/config/compiler:no_chromium_code" ]
include_dirs = [
+ "//v8",
"//v8/include",
]
deps = [
@@ -823,6 +824,7 @@ static_library("jsapi") {
}
configs += [ ":pdfium_config", "//build/config/compiler:no_chromium_code" ]
include_dirs = [
+ "//v8",
"//v8/include",
]
deps = [
diff --git a/fpdfsdk/include/javascript/IJavaScript.h b/fpdfsdk/include/javascript/IJavaScript.h
index 3087b6a865..7633bbb486 100644
--- a/fpdfsdk/include/javascript/IJavaScript.h
+++ b/fpdfsdk/include/javascript/IJavaScript.h
@@ -7,6 +7,10 @@
#ifndef _IJAVASCRIPT_H_
#define _IJAVASCRIPT_H_
+namespace v8 {
+class Platform;
+}
+
class IFXJS_Context
{
public:
@@ -92,7 +96,7 @@ class CJS_GlobalData;
class CJS_RuntimeFactory
{
public:
- CJS_RuntimeFactory():m_bInit(FALSE),m_nRef(0),m_pGlobalData(NULL),m_nGlobalDataCount(0) {}
+ CJS_RuntimeFactory():m_bInit(FALSE),m_nRef(0),m_pGlobalData(NULL),m_nGlobalDataCount(0),m_platform(NULL) {}
~CJS_RuntimeFactory();
IFXJS_Runtime* NewJSRuntime(CPDFDoc_Environment* pApp);
void DeleteJSRuntime(IFXJS_Runtime* pRuntime);
@@ -106,6 +110,7 @@ private:
int m_nRef;
CJS_GlobalData* m_pGlobalData;
FX_INT32 m_nGlobalDataCount;
+ v8::Platform* m_platform;
};
#endif //_IJAVASCRIPT_H_
diff --git a/fpdfsdk/src/javascript/JS_Runtime.cpp b/fpdfsdk/src/javascript/JS_Runtime.cpp
index c7a92ebde2..543540bd4d 100644
--- a/fpdfsdk/src/javascript/JS_Runtime.cpp
+++ b/fpdfsdk/src/javascript/JS_Runtime.cpp
@@ -27,6 +27,8 @@
#include "../../include/javascript/global.h"
#include "../../include/javascript/console.h"
+#include <libplatform/libplatform.h>
+
CJS_RuntimeFactory::~CJS_RuntimeFactory()
{
}
@@ -36,6 +38,8 @@ IFXJS_Runtime* CJS_RuntimeFactory::NewJSRuntime(CPDFDoc_Environment* pApp)
if (!m_bInit)
{
JS_Initial();
+ m_platform = v8::platform::CreateDefaultPlatform();
+ v8::V8::InitializePlatform(m_platform);
m_bInit = TRUE;
}
@@ -55,6 +59,9 @@ void CJS_RuntimeFactory::Release()
{
JS_Release();
ReleaseGlobalData();
+ v8::V8::ShutdownPlatform();
+ delete m_platform;
+ m_platform = NULL;
m_bInit = FALSE;
}
}
diff --git a/pdfium.gyp b/pdfium.gyp
index 55a7db80a5..ff619319ab 100644
--- a/pdfium.gyp
+++ b/pdfium.gyp
@@ -750,10 +750,12 @@
'target_name': 'javascript',
'type': 'static_library',
'include_dirs': [
+ '<(DEPTH)/v8',
'<(DEPTH)/v8/include',
],
'dependencies': [
'<(DEPTH)/v8/tools/gyp/v8.gyp:v8',
+ '<(DEPTH)/v8/tools/gyp/v8.gyp:v8_libplatform',
],
'export_dependent_settings': [
'<(DEPTH)/v8/tools/gyp/v8.gyp:v8',
@@ -814,6 +816,7 @@
'<(DEPTH)/v8/tools/gyp/v8.gyp:v8',
],
'include_dirs': [
+ '<(DEPTH)/v8',
'<(DEPTH)/v8/include',
],
'ldflags': [ '-L<(PRODUCT_DIR)',],