summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authorJochen Eisinger <jochen@chromium.org>2015-08-05 09:02:13 +0200
committerJochen Eisinger <jochen@chromium.org>2015-08-05 09:02:13 +0200
commit29007840b6deb699174ae5a6ef6b1188d001aa05 (patch)
tree8e817e13e07a629764f9325510ca502a4ff35a31 /fpdfsdk
parente2bad47fa64137fdafacc0ca56434fccac4b028d (diff)
downloadpdfium-29007840b6deb699174ae5a6ef6b1188d001aa05.tar.xz
Merge to XFA: Don't dispose the isolate if its provided by the embedder
(cherry picked from commit 7ea305f1bd4efc1838fba053e4399358d6765ec7) Original Review URL: https://codereview.chromium.org/1269783005 . BUG=chromium:515718 TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1270293002 .
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/include/javascript/JS_Runtime.h1
-rw-r--r--fpdfsdk/src/javascript/JS_Runtime.cpp6
2 files changed, 6 insertions, 1 deletions
diff --git a/fpdfsdk/include/javascript/JS_Runtime.h b/fpdfsdk/include/javascript/JS_Runtime.h
index 1fb0348263..1e9f3a97ac 100644
--- a/fpdfsdk/include/javascript/JS_Runtime.h
+++ b/fpdfsdk/include/javascript/JS_Runtime.h
@@ -73,6 +73,7 @@ class CJS_Runtime : public IFXJS_Runtime {
CJS_FieldEvent* m_pFieldEventPath;
v8::Isolate* m_isolate;
+ bool m_isolateManaged;
nonstd::unique_ptr<CJS_ArrayBufferAllocator> m_pArrayBufferAllocator;
v8::Global<v8::Context> m_context;
};
diff --git a/fpdfsdk/src/javascript/JS_Runtime.cpp b/fpdfsdk/src/javascript/JS_Runtime.cpp
index 7dfe326c54..927965e5a4 100644
--- a/fpdfsdk/src/javascript/JS_Runtime.cpp
+++ b/fpdfsdk/src/javascript/JS_Runtime.cpp
@@ -101,7 +101,8 @@ CJS_Runtime::CJS_Runtime(CPDFDoc_Environment* pApp)
m_pDocument(NULL),
m_bBlocking(FALSE),
m_pFieldEventPath(NULL),
- m_isolate(NULL) {
+ m_isolate(NULL),
+ m_isolateManaged(false) {
if (CPDFXFA_App::GetInstance()->GetJSERuntime()) {
// TODO(tsepez): CPDFXFA_App should also use the embedder provided isolate.
m_isolate = (v8::Isolate*)CPDFXFA_App::GetInstance()->GetJSERuntime();
@@ -115,6 +116,7 @@ CJS_Runtime::CJS_Runtime(CPDFDoc_Environment* pApp)
v8::Isolate::CreateParams params;
params.array_buffer_allocator = m_pArrayBufferAllocator.get();
m_isolate = v8::Isolate::New(params);
+ m_isolateManaged = true;
}
v8::Isolate* isolate = m_isolate;
@@ -149,6 +151,8 @@ CJS_Runtime::~CJS_Runtime() {
m_pFieldEventPath = NULL;
m_context.Reset();
+ if (m_isolateManaged)
+ m_isolate->Dispose();
m_isolate = NULL;
}