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

Side by Side Diff: fpdfsdk/src/javascript/JS_Runtime.cpp

Issue 1372353002: Leak per-isolate data in pdfium (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 FXJS_ReleaseRuntime(GetIsolate(), m_context); 66
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);
67 73
68 m_pApp = NULL; 74 m_pApp = NULL;
69 m_pDocument = NULL; 75 m_pDocument = NULL;
70 m_context.Reset(); 76 m_context.Reset();
71 77
72 if (m_isolateManaged) 78 if (m_isolateManaged)
73 m_isolate->Dispose(); 79 m_isolate->Dispose();
74 } 80 }
75 81
76 void CJS_Runtime::DefineJSObjects() { 82 void CJS_Runtime::DefineJSObjects() {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 185
180 v8::Local<v8::Context> CJS_Runtime::NewJSContext() { 186 v8::Local<v8::Context> CJS_Runtime::NewJSContext() {
181 return v8::Local<v8::Context>::New(m_isolate, m_context); 187 return v8::Local<v8::Context>::New(m_isolate, m_context);
182 } 188 }
183 189
184 CFX_WideString ChangeObjName(const CFX_WideString& str) { 190 CFX_WideString ChangeObjName(const CFX_WideString& str) {
185 CFX_WideString sRet = str; 191 CFX_WideString sRet = str;
186 sRet.Replace(L"_", L"."); 192 sRet.Replace(L"_", L".");
187 return sRet; 193 return sRet;
188 } 194 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698