| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "../../include/javascript/JavaScript.h" | 7 #include "../../include/javascript/JavaScript.h" |
| 8 #include "../../include/javascript/IJavaScript.h" | 8 #include "../../include/javascript/IJavaScript.h" |
| 9 #include "../../include/javascript/JS_EventHandler.h" | 9 #include "../../include/javascript/JS_EventHandler.h" |
| 10 #include "../../include/javascript/JS_Runtime.h" | 10 #include "../../include/javascript/JS_Runtime.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 CJS_Context* pContext = (CJS_Context*)NewContext(); | 56 CJS_Context* pContext = (CJS_Context*)NewContext(); |
| 57 FXJS_InitializeRuntime(GetIsolate(), this, pContext, m_context); | 57 FXJS_InitializeRuntime(GetIsolate(), this, pContext, m_context); |
| 58 ReleaseContext(pContext); | 58 ReleaseContext(pContext); |
| 59 } | 59 } |
| 60 | 60 |
| 61 CJS_Runtime::~CJS_Runtime() { | 61 CJS_Runtime::~CJS_Runtime() { |
| 62 for (int i = 0, sz = m_ContextArray.GetSize(); i < sz; i++) | 62 for (int i = 0, sz = m_ContextArray.GetSize(); i < sz; i++) |
| 63 delete m_ContextArray.GetAt(i); | 63 delete m_ContextArray.GetAt(i); |
| 64 | 64 |
| 65 m_ContextArray.RemoveAll(); | 65 m_ContextArray.RemoveAll(); |
| 66 | 66 FXJS_ReleaseRuntime(GetIsolate(), m_context); |
| 67 // TODO(raymes): Currently we're freeing per-isolate data everytime a | |
| 68 // document is destroyed even though it may be in use by other documents. For | |
| 69 // now we leak the per-isolate data (when m_isolateManaged is false) until | |
| 70 // crbug.com/531339 is fixed. | |
| 71 if (m_isolateManaged) | |
| 72 FXJS_ReleaseRuntime(GetIsolate(), m_context); | |
| 73 | 67 |
| 74 m_pApp = NULL; | 68 m_pApp = NULL; |
| 75 m_pDocument = NULL; | 69 m_pDocument = NULL; |
| 76 m_context.Reset(); | 70 m_context.Reset(); |
| 77 | 71 |
| 78 if (m_isolateManaged) | 72 if (m_isolateManaged) |
| 79 m_isolate->Dispose(); | 73 m_isolate->Dispose(); |
| 80 } | 74 } |
| 81 | 75 |
| 82 void CJS_Runtime::DefineJSObjects() { | 76 void CJS_Runtime::DefineJSObjects() { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 | 179 |
| 186 v8::Local<v8::Context> CJS_Runtime::NewJSContext() { | 180 v8::Local<v8::Context> CJS_Runtime::NewJSContext() { |
| 187 return v8::Local<v8::Context>::New(m_isolate, m_context); | 181 return v8::Local<v8::Context>::New(m_isolate, m_context); |
| 188 } | 182 } |
| 189 | 183 |
| 190 CFX_WideString ChangeObjName(const CFX_WideString& str) { | 184 CFX_WideString ChangeObjName(const CFX_WideString& str) { |
| 191 CFX_WideString sRet = str; | 185 CFX_WideString sRet = str; |
| 192 sRet.Replace(L"_", L"."); | 186 sRet.Replace(L"_", L"."); |
| 193 return sRet; | 187 return sRet; |
| 194 } | 188 } |
| OLD | NEW |