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 "fpdfsdk/include/jsapi/fxjs_v8.h" | 7 #include "fpdfsdk/include/jsapi/fxjs_v8.h" |
8 | 8 |
9 #include "core/include/fxcrt/fx_basic.h" | 9 #include "core/include/fxcrt/fx_basic.h" |
10 | 10 |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 pObj = v8::Local<v8::Object>::New(pIsolate, *pStaticObjects->at(i)); | 344 pObj = v8::Local<v8::Object>::New(pIsolate, *pStaticObjects->at(i)); |
345 delete pStaticObjects->at(i); | 345 delete pStaticObjects->at(i); |
346 pStaticObjects->at(i) = nullptr; | 346 pStaticObjects->at(i) = nullptr; |
347 } | 347 } |
348 | 348 |
349 if (!pObj.IsEmpty()) { | 349 if (!pObj.IsEmpty()) { |
350 if (pObjDef->m_pDestructor) | 350 if (pObjDef->m_pDestructor) |
351 pObjDef->m_pDestructor(pObj); | 351 pObjDef->m_pDestructor(pObj); |
352 FXJS_FreePrivate(pObj); | 352 FXJS_FreePrivate(pObj); |
353 } | 353 } |
354 delete pObjDef; | |
355 } | 354 } |
356 | 355 |
357 if (pIsolate == g_isolate && --g_isolate_ref_count > 0) | 356 if (pIsolate == g_isolate && --g_isolate_ref_count > 0) |
358 return; | 357 return; |
359 | 358 |
| 359 for (int i = 0; i < maxID; ++i) |
| 360 delete CFXJS_ObjDefinition::ForID(pIsolate, i); |
| 361 |
360 pIsolate->SetData(g_embedderDataSlot, nullptr); | 362 pIsolate->SetData(g_embedderDataSlot, nullptr); |
361 delete pData; | 363 delete pData; |
362 } | 364 } |
363 | 365 |
364 IJS_Runtime* FXJS_GetRuntimeFromIsolate(v8::Isolate* pIsolate) { | 366 IJS_Runtime* FXJS_GetRuntimeFromIsolate(v8::Isolate* pIsolate) { |
365 v8::Local<v8::Context> context = pIsolate->GetCurrentContext(); | 367 v8::Local<v8::Context> context = pIsolate->GetCurrentContext(); |
366 return static_cast<IJS_Runtime*>( | 368 return static_cast<IJS_Runtime*>( |
367 context->GetAlignedPointerFromEmbedderData(kPerContextDataIndex)); | 369 context->GetAlignedPointerFromEmbedderData(kPerContextDataIndex)); |
368 } | 370 } |
369 | 371 |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 return v8::Local<v8::Array>(); | 751 return v8::Local<v8::Array>(); |
750 v8::Local<v8::Context> context = pIsolate->GetCurrentContext(); | 752 v8::Local<v8::Context> context = pIsolate->GetCurrentContext(); |
751 return v8::Local<v8::Array>::Cast(pValue->ToObject(context).ToLocalChecked()); | 753 return v8::Local<v8::Array>::Cast(pValue->ToObject(context).ToLocalChecked()); |
752 } | 754 } |
753 | 755 |
754 void FXJS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom) { | 756 void FXJS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom) { |
755 pTo = pFrom; | 757 pTo = pFrom; |
756 } | 758 } |
757 | 759 |
758 | 760 |
OLD | NEW |