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

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

Issue 1270293002: Merge to XFA: Don't dispose the isolate if its provided by the embedder (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 4 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 7dfe326c54623fe58f46c69c2c36e25d6ffeb72b..927965e5a4635beeacf29c99e4b818bfeb0318e4 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;
}
« 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