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

Side by Side Diff: fxjs/fxjs_v8.cpp

Issue 2354923003: Fix leaks related to the usage of JSE runtime data (Closed)
Patch Set: Created 4 years, 3 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 | « fxjs/cfxjse_runtimedata.cpp ('k') | fxjs/include/fxjs_v8.h » ('j') | 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 "fxjs/include/fxjs_v8.h" 7 #include "fxjs/include/fxjs_v8.h"
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 if (!pIsolate->GetData(g_embedderDataSlot)) 208 if (!pIsolate->GetData(g_embedderDataSlot))
209 pIsolate->SetData(g_embedderDataSlot, new FXJS_PerIsolateData()); 209 pIsolate->SetData(g_embedderDataSlot, new FXJS_PerIsolateData());
210 } 210 }
211 211
212 // static 212 // static
213 FXJS_PerIsolateData* FXJS_PerIsolateData::Get(v8::Isolate* pIsolate) { 213 FXJS_PerIsolateData* FXJS_PerIsolateData::Get(v8::Isolate* pIsolate) {
214 return static_cast<FXJS_PerIsolateData*>( 214 return static_cast<FXJS_PerIsolateData*>(
215 pIsolate->GetData(g_embedderDataSlot)); 215 pIsolate->GetData(g_embedderDataSlot));
216 } 216 }
217 217
218 #ifndef PDF_ENABLE_XFA
219 FXJS_PerIsolateData::FXJS_PerIsolateData() : m_pDynamicObjsMap(nullptr) {} 218 FXJS_PerIsolateData::FXJS_PerIsolateData() : m_pDynamicObjsMap(nullptr) {}
220 #else // PDF_ENABLE_XFA
221 FXJS_PerIsolateData::FXJS_PerIsolateData()
222 : m_pFXJSERuntimeData(nullptr), m_pDynamicObjsMap(nullptr) {}
223 #endif // PDF_ENABLE_XFA
224 219
225 CFXJS_Engine::CFXJS_Engine() : m_isolate(nullptr) {} 220 CFXJS_Engine::CFXJS_Engine() : m_isolate(nullptr) {}
226 221
227 CFXJS_Engine::~CFXJS_Engine() { 222 CFXJS_Engine::~CFXJS_Engine() {
228 m_V8PersistentContext.Reset(); 223 m_V8PersistentContext.Reset();
229 } 224 }
230 225
231 // static 226 // static
232 CFXJS_Engine* CFXJS_Engine::CurrentEngineFromIsolate(v8::Isolate* pIsolate) { 227 CFXJS_Engine* CFXJS_Engine::CurrentEngineFromIsolate(v8::Isolate* pIsolate) {
233 return static_cast<CFXJS_Engine*>( 228 return static_cast<CFXJS_Engine*>(
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 } 795 }
801 796
802 void CFXJS_Engine::SetConstArray(const CFX_WideString& name, 797 void CFXJS_Engine::SetConstArray(const CFX_WideString& name,
803 v8::Local<v8::Array> array) { 798 v8::Local<v8::Array> array) {
804 m_ConstArrays[name] = v8::Global<v8::Array>(GetIsolate(), array); 799 m_ConstArrays[name] = v8::Global<v8::Array>(GetIsolate(), array);
805 } 800 }
806 801
807 v8::Local<v8::Array> CFXJS_Engine::GetConstArray(const CFX_WideString& name) { 802 v8::Local<v8::Array> CFXJS_Engine::GetConstArray(const CFX_WideString& name) {
808 return v8::Local<v8::Array>::New(GetIsolate(), m_ConstArrays[name]); 803 return v8::Local<v8::Array>::New(GetIsolate(), m_ConstArrays[name]);
809 } 804 }
OLDNEW
« no previous file with comments | « fxjs/cfxjse_runtimedata.cpp ('k') | fxjs/include/fxjs_v8.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698