| 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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 pObj = v8::Local<v8::Object>::New(pIsolate, *pStaticObjects->at(i)); | 349 pObj = v8::Local<v8::Object>::New(pIsolate, *pStaticObjects->at(i)); |
| 350 delete pStaticObjects->at(i); | 350 delete pStaticObjects->at(i); |
| 351 pStaticObjects->at(i) = nullptr; | 351 pStaticObjects->at(i) = nullptr; |
| 352 } | 352 } |
| 353 | 353 |
| 354 if (!pObj.IsEmpty()) { | 354 if (!pObj.IsEmpty()) { |
| 355 if (pObjDef->m_pDestructor) | 355 if (pObjDef->m_pDestructor) |
| 356 pObjDef->m_pDestructor(pObj); | 356 pObjDef->m_pDestructor(pObj); |
| 357 FXJS_FreePrivate(pObj); | 357 FXJS_FreePrivate(pObj); |
| 358 } | 358 } |
| 359 delete pObjDef; | |
| 360 } | 359 } |
| 361 | 360 |
| 362 if (pIsolate == g_isolate && --g_isolate_ref_count > 0) | 361 if (pIsolate == g_isolate && --g_isolate_ref_count > 0) |
| 363 return; | 362 return; |
| 364 | 363 |
| 364 for (int i = 0; i < maxID; ++i) |
| 365 delete CFXJS_ObjDefinition::ForID(pIsolate, i); |
| 366 |
| 365 pIsolate->SetData(g_embedderDataSlot, nullptr); | 367 pIsolate->SetData(g_embedderDataSlot, nullptr); |
| 366 delete pData; | 368 delete pData; |
| 367 } | 369 } |
| 368 | 370 |
| 369 IJS_Runtime* FXJS_GetRuntimeFromIsolate(v8::Isolate* pIsolate) { | 371 IJS_Runtime* FXJS_GetRuntimeFromIsolate(v8::Isolate* pIsolate) { |
| 370 v8::Local<v8::Context> context = pIsolate->GetCurrentContext(); | 372 v8::Local<v8::Context> context = pIsolate->GetCurrentContext(); |
| 371 return static_cast<IJS_Runtime*>( | 373 return static_cast<IJS_Runtime*>( |
| 372 context->GetAlignedPointerFromEmbedderData(kPerContextDataIndex)); | 374 context->GetAlignedPointerFromEmbedderData(kPerContextDataIndex)); |
| 373 } | 375 } |
| 374 | 376 |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 759 return v8::Local<v8::Array>(); | 761 return v8::Local<v8::Array>(); |
| 760 v8::Local<v8::Context> context = pIsolate->GetCurrentContext(); | 762 v8::Local<v8::Context> context = pIsolate->GetCurrentContext(); |
| 761 return v8::Local<v8::Array>::Cast(pValue->ToObject(context).ToLocalChecked()); | 763 return v8::Local<v8::Array>::Cast(pValue->ToObject(context).ToLocalChecked()); |
| 762 } | 764 } |
| 763 | 765 |
| 764 void FXJS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom) { | 766 void FXJS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom) { |
| 765 pTo = pFrom; | 767 pTo = pFrom; |
| 766 } | 768 } |
| 767 | 769 |
| 768 | 770 |
| OLD | NEW |